Jump to content
  • 0

Hourly Script


Bringer

Question


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  748
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

This Script is made by @Haziel can anyone modfi this ?

1.Remove 5 hours per day. the timer will reset at 12 midnight.

2. Hourly Stop When Vending or @autotrade

Spoiler

-	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:
                //#CASHPOINT += 1;
                getitem 512,1;
                break;
            case 2:
                //#CASHPOINT += 2;
                getitem 512,2;
                break;
            case 3:
                //#CASHPOINT += 3;
                getitem 512,3;
                break;
            case 4:
                //#CASHPOINT += 4;
                getitem 512,4;
                break;
            case 5:
                //#CASHPOINT += 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;            
}

 

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  748
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

bump anyone can help me?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  1138
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

-	script	hourlypoints	-1,{
 
//--Start of the Script
OnPCLoginEvent:
attachnpctimer ""+strcharinfo(0)+"";
initnpctimer;
end;
   
OnTimer30000:
//Check if Vending (normal or @at)
if(checkvending() >= 1) {
    dispbottom "The hourly badge rewards has stopped because you were vending . Please relog if you wish to start again.";
    stopnpctimer;
    end;
}
 
OnTimer60000:
set @minute, @minute + 1;
//Check for 1 Minute
if(@minute == 60){
    set @minute,0;
    getitem 7859,1;
    dispbottom "You received 1 "+getitemname( 7859 )+" by staying ingame for 1 hour.";
    set @consecutive_hour, @consecutive_hour + 1;
    }
//Check for 12 hours consecutive
    if(@consecutive_hour == 5) {
    set @consecutive_hour,0;
    getitem 7859,5;
    dispbottom "You received 5 "+getitemname( 7859 )+" by staying ingame for consecutive of 5 hours.";
    }
stopnpctimer;
initnpctimer;
end;
 
}

 

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...