// https://rathena.org/board/topic/109983-playtime-script/
prontera,155,181,5 script Sample#playtime 4_F_KAFRA1,{
doevent "playtime_main::OnTalk";
}
- script playtime_main -1,{
OnInit:
setarray .level, 255, 120;
.reward_point_required = ( 24 * 60 * 60 ); // 24 hours (seconds)
.reward_nameid = 512;
.reward_amount = 1;
end;
OnTalk:
mes "You accumulated total "+#TOTAL_PLAYTIME+" point(s)";
mes " ";
switch( select(
( @playtime ) ? "" : "Start Playtime",
( @playtime ) ? "Stop Playtime" : "",
"Claim Reward",
"Information"
)) {
case 1:
if ( BaseLevel < .level[0] || JobLevel < .level[1] ) {
mes "You need to be Level "+.level[0]+"/"+.level[1]+" to access this benefit.";
}
else {
@playtime = gettimetick(2);
mes "Playtime counting started.";
}
break;
case 2:
mes "Playtime counting stopped.";
#TOTAL_PLAYTIME = #TOTAL_PLAYTIME + ( gettimetick(2) - @playtime );
@playtime = 0;
deltimer .npc_name$+"::OnPlayTimeUpdate";
break;
case 3:
mes "Every "+.reward_point_required+" point(s), you can claim "+.reward_amount+"x "+getitemname( .reward_nameid );
if ( #TOTAL_PLAYTIME < .reward_point_required ) {
mes "You lack of "+( .reward_point_required - #TOTAL_PLAYTIME )+" point(s) to exchanged.";
}
else {
#TOTAL_PLAYTIME -= .reward_point_required;
getitem .reward_nameid, .reward_amount;
mes "Done, you left "+#TOTAL_PLAYTIME+" Point(s)";
}
break;
default:
mes "PlayTime Points timer will only start when the player decided to start their PlayTime Points using "Start PlayTime Points".";
mes "PlayTime Points timer will not count whenever the player quits, re-logs in or changes character.";
mes "The reward is not hourly, instead one apple (example) for every 24 hours with an interval of also 24 hours.";
mes "Check PlayTime Duration will check how many more hours left or how many hours he/she has reached for the player to stay online and to receive its reward.";
mes "Inactivity or the idleness of the player won't affect or stop the PlayTime Points timer.";
break;
}
close;
OnPCLogoutEvent:
if ( @playtime ) {
#TOTAL_PLAYTIME = #TOTAL_PLAYTIME + ( gettimetick(2) - @playtime );
}
end;
}
Comments
0 B
|👍
/👎