Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // https://rathena.org/board/topic/110719-hourly-vending-timer-stop/#comment-324042
- - script hourly_point_main -1,{
- OnInit:
- .duration = 3600;
- .vip_multi = 2;
- .npc_name$ = strnpcinfo(3);
- .delay = 1000; //Delay for idle re-check check. ( Default: 1000 [ = 1 Second ] )
- .idle = 60*1; //Player is idle after not moving for this many seconds. ( Default: 60*5 [ = 5 Minutes ] )
- set .2cpoint_amt, 20; //Points gained for consecutive time online.
- set .3cpoint_amt, 30; //Points gained for consecutive time online.
- set .4cpoint_amt, 40; //Points gained for consecutive time online.
- set .5cpoint_amt, 50; //Points gained for consecutive time online.
- set .6cpoint_amt, 60; //Points gained for consecutive time online.
- set .7cpoint_amt, 70; //Points gained for consecutive time online.
- set .8cpoint_amt, 80; //Points gained for consecutive time online.
- set .point_amt, 10; //Normal points gained.
- bindatcmd "reward", .npc_name$ + "::OnCheck";
- end;
- OnUpdate:
- //Check for idle.
- if (@hourly_point_stopped || checkvending() >= 1 || checkchatting() == 1 || checkidle() >= .idle) {
- @hourly_point_stopped = 1;
- dispbottom "The hourly points event stopped because you were vending, chatting, or idle!";
- end;
- }
- set #HourlyPoints, #HourlyPoints + .point_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
- dispbottom "You received "+.point_amt+" Reward Hourly Points by staying ingame for 1 hour";
- dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
- set @consecutive_hour, @consecutive_hour + 1;
- //Check for 2 hours consecutive
- if(@consecutive_hour == 2) {
- set #HourlyPoints, #HourlyPoints + .2cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
- dispbottom "You received "+.2cpoint_amt+" Reward Hourly Points due to playing for 2 consecutive hours";
- dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
- }
- //Check for 3 hours consecutive
- else if(@consecutive_hour == 3) {
- set #HourlyPoints, #HourlyPoints + .3cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
- dispbottom "You received "+.3cpoint_amt+" Reward Hourly Points due to playing for 3 consecutive hours";
- dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
- }
- //Check for 4 hours consecutive
- else if(@consecutive_hour == 4) {
- set #HourlyPoints, #HourlyPoints + .4cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
- dispbottom "You received "+.4cpoint_amt+" Reward Hourly Points due to playing for 4 consecutive hours";
- dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
- }
- //Check for 5 hours consecutive
- else if(@consecutive_hour == 5) {
- set #HourlyPoints, #HourlyPoints + .5cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
- dispbottom "You received "+.5cpoint_amt+" Reward Hourly Points due to playing for 5 consecutive hours";
- dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
- }
- //Check for 6 hours consecutive
- else if(@consecutive_hour == 6) {
- set #HourlyPoints, #HourlyPoints + .6cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
- dispbottom "You received "+.6cpoint_amt+" Reward Hourly Points due to playing for 6 consecutive hours";
- dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
- }
- //Check for 7 hours consecutive
- else if(@consecutive_hour == 7) {
- set #HourlyPoints, #HourlyPoints + .7cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
- dispbottom "You received "+.7cpoint_amt+" Reward Hourly Points due to playing for 7 consecutive hours";
- dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
- }
- //Check for 8 hours consecutive
- else if(@consecutive_hour == 8) {
- set @consecutive_hour,0;
- set #HourlyPoints, #HourlyPoints + .8cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
- dispbottom "You received "+.8cpoint_amt+" Reward Hourly Points due to playing for 8 consecutive hours";
- dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
- }
- @timer = gettimetick(2) + .duration;
- addtimer ( .duration * 1000 ), .npc_name$+"::OnUpdate";
- end;
- OnPCLoginEvent:
- atcommand "@refresh "+strcharinfo(0);
- @timer = gettimetick(2) + .duration;
- addtimer ( .duration * 1000 ), .npc_name$+"::OnUpdate";
- dispbottom "Hourly Rewards have been started for this character.";
- end;
- OnCheck:
- .@min = (@timer - gettimetick(2))/60;
- .@sec = (@timer - gettimetick(2))%60;
- dispbottom "War Server",0x9ae2d7;
- dispbottom "Total Hours Online " +@consecutive_hour+ "",0x9ae2d7;
- dispbottom "Reward Hourly Points : ^FF0000[ "+#HourlyPoints+" ]^000000",0x9ae2d7;
- if ( @hourly_point_stopped ) {
- dispbottom "The hourly points event stopped because you were previously vending, chatting, or idle!";
- }
- else {
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment