Jump to content
  • 0

Hourly Points


Dev Blaze

Question


  • Group:  Members
  • Topic Count:  68
  • Topics Per Day:  0.02
  • Content Count:  212
  • Reputation:   5
  • Joined:  01/24/12
  • Last Seen:  

Allows players who afk and pubbing to gain points except players who use @autotrade or Vending I see this script any one help me

 

-    script    hourly_point_main    -1,{
    
    OnInit:
        .max_hour = 5;
        .duration = 3600;
        .npc_name$ = strnpcinfo(3);
        bindatcmd "hourly",    .npc_name$ + "::OnCheck";
        end;
        
    OnClock0000:
        query_sql( "DELETE FROM acc_reg_num` WHERE `key` = '#daily_hour_count' AND `account_id` IN ( SELECT `account_id` FROM `char` WHERE `login` = 0 GROUP BY `account_id` ) " );
        addrid(0);
        #daily_hour_count = -1;
        
    OnUpdate:
        deltimer .npc_name$+"::OnUpdate";
        #daily_hour_count++;
        switch ( #daily_hour_count ) {
            case 1:
                #KAFRAPOINTS += 1;
                getitem 512,1;
                break;
            case 2:
                #KAFRAPOINTS += 2;
                getitem 512,2;
                break;
            case 3:
                #KAFRAPOINTS += 3;
                getitem 512,3;
                break;
            case 4:
                #KAFRAPOINTS += 4;
                getitem 512,4;
                break;
            case 5:
                #KAFRAPOINTS += 5;
                getitem 512,6;
                break;
            default: break;
        }
        
    OnPCLoginEvent:
        if ( #daily_hour_count < .max_hour ) {
            @timer = gettimetick(2) + .duration;
            addtimer ( .duration * 1000 ), .npc_name$+"::OnUpdate";
        }
        if ( #daily_hour_count )    dispbottom "[ Hourly Rewards ] " + #daily_hour_count + "/" + .max_hour + " hour" + ((#daily_hour_count > 1)?"s":"") + " played!",0x9ae2d7;
        end;
        
    OnCheck:
        .@min = (@timer - gettimetick(2))/60;
        .@sec = (@timer - gettimetick(2))%60;
        dispbottom "[ Hourly Rewards ] Your next reward will be achieved in " +
                    ((.@min)?            "[ " + .@min + " ] minute"         + ((.@min > 1)?"s":""):"") +
                    ((.@min && .@sec)?    " and ":"") +
                    ((.@sec)?            "[ " + .@sec + " ] second"    + ((.@sec > 1)?"s":""):"") +
                    "!",0x9ae2d7;
        end;            
}

 

Edited by Akkarin
I've told you countless times before to use Codebox instead of Quotes for code. Don't do it again.
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  

6 hours ago, Dev Blaze said:

Allows players who afk and pubbing to gain points except players who use @autotrade or Vending

doc/script_commands.txt#L3665-L3685

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  101
  • Reputation:   3
  • Joined:  09/15/16
  • Last Seen:  

-	script	Hourly Active	-1,{
OnUpdate:
if( checkvending() == 0 && checkchatting() == 1 ){
		set @Minute,@Minute + 1;
		if( @Minute % 60 == 0 ){
				set #KAFRAPOINTS, #KAFRAPOINTS + 1;
			dispbottom "You've been Active for 60 minutes, +1 Kafra point(s) in your Balance.";
			set @Hour,@Hour + 1;
			if( @Hour % 7 == 0 ){
				set #KAFRAPOINTS, #KAFRAPOINTS + 10;
				dispbottom "You've been Actively Online for 7 Hours, +10 Kafra point(s) in your Balance.";
			}
		}
	}
	OnPCLoginEvent:
	addtimer 60000,strnpcinfo(0)+"::OnUpdate";
	end; 
}

You can use this script, i dont know how to manipulate sql XD

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  862
  • Reputation:   115
  • Joined:  05/23/12
  • Last Seen:  

This simple script works fine:

-	script	HorlyPoints	-1,{

OnInit:
	end;

OnMinute01:
	query_sql("SELECT `account_id` FROM `char` WHERE `online`='1'",.@accid);
	for(set .@i,0; .@i<getarraysize(.@accid); .@i++){
		attachrid(.@accid[.@i]);
		if(!getstatus(SC_JAILED)){
			if (!checkvending() && !checkchatting() && !checkidle()){
				dispbottom "[Hourly Point]: You've received a point.";
				getitem xxx,1;
			}
		}
		detachrid;
	}
	end;
}

Rynbef~

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  68
  • Topics Per Day:  0.02
  • Content Count:  212
  • Reputation:   5
  • Joined:  01/24/12
  • Last Seen:  

12 minutes ago, Rynbef said:

This simple script works fine:


-	script	HorlyPoints	-1,{

OnInit:
	end;

OnMinute01:
	query_sql("SELECT `account_id` FROM `char` WHERE `online`='1'",.@accid);
	for(set .@i,0; .@i<getarraysize(.@accid); .@i++){
		attachrid(.@accid[.@i]);
		if(!getstatus(SC_JAILED)){
			if (!checkvending() && !checkchatting() && !checkidle()){
				dispbottom "[Hourly Point]: You've received a point.";
				getitem xxx,1;
			}
		}
		detachrid;
	}
	end;
}

Rynbef~

Hello Rynbef~

Allows players who afk and pubbing to gain points except players who use @autotrade or Vending

if (!checkvending() && !checkchatting() && !checkidle()){  <------------------------ This line

 

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  862
  • Reputation:   115
  • Joined:  05/23/12
  • Last Seen:  

Just remove ckeckidle()

-	script	HorlyPoints	-1,{

OnInit:
	end;

OnMinute01:
	query_sql("SELECT `account_id` FROM `char` WHERE `online`='1'",.@accid);
	for(set .@i,0; .@i<getarraysize(.@accid); .@i++){
		attachrid(.@accid[.@i]);
		if(!getstatus(SC_JAILED)){
			if (!checkvending() && !checkchatting()){
				dispbottom "[Hourly Point]: You've received a point.";
				getitem xxx,1;
			}
		}
		detachrid;
	}
	end;
}

Rynbef~

Link to comment
Share on other sites

  • -1

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  2
  • Reputation:   0
  • Joined:  05/18/12
  • Last Seen:  

Hello! Do you guys know how to reset the consecutive hours if the player logs out?

Example:

The player has already accumulated 3 hrs for staying online. Then the player logs out. Then when the player relogs in. The accumulated hours is reset to 0.

 

Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...