Here's my script. My problem is the idle. Im not sure if it really works and stop the timer. and when it reach the 60 minutes player don't get any reward points. Please help me thnx
- script hourlypoints FAKE_NPC,{
OnInit:
set .point_name$,"reward points";
set .point_amt, 3; //Normal points gained.
set .dlimit, 600; //Stop points if afk greater then in seconds.
set .enable,1;
set .level,0;
bindatcmd "ht","hourlypoints::OnDoTimer",0,100; // Admin reset command
end;
OnDoTimer:
if(BaseLevel >= .level){
set .@m,#timetick % 3600 / 60;
set .@s,#timetick % 60;
set .@m$, (60-.@m)+" minute"+((.@m <= 1)?"":"s");
set .@s$, (60-.@s)+" second"+((.@s <= 1)?"":"s");
set .@time$,""+.@m$+" "+.@s$+"";
if(#idle){
dispbottom "You been idle for 10 minutes. Please relog again.";
}else{
dispbottom "You have [ "+.@time$+" ] left in able to gain a reward points.";
}
}
end;
OnPCLoginEvent:
if(BaseLevel >= .level){
set #idle,0;
while(.enable && #idle == 0){
if(checkvending() >= 1 && checkidle() >= .dlimit || checkchatting() == 1 && checkidle() >= .dlimit || checkidle() >= .dlimit) {
dispbottom "The hourly points event haulted because you were vending, chatting, or idle.";
set #idle,1;
set #acctick,gettimetick(2);
set #timetick,#timetick + (gettimetick(2) - #acctick);
end;
}else{
set #acctick,gettimetick(2);
sleep2 1000;
set #timetick,#timetick + (gettimetick(2) - #acctick);
set .@h,#timetick % 86400 / 3600 / 24;
set .@m,#timetick % 3600 / 60;
set .@s,#timetick % 60;
set .@h$, .@h+" hour"+((.@h <= 1)?"":"s");
set .@m$, .@m+" minute"+((.@m <= 1)?"":"s");
set .@s$, .@s+" second"+((.@s <= 1)?"":"s");
set .@time$,""+.@h$+" "+.@m$+" "+.@s$+"";
if(.@m >= 60){
set #RP,#RP + .point_amt;
dispbottom "Gained "+.point_amt+" "+.point_name$+". Total "+#RP+" points.";
set #timetick,0;
}else if(.@m == 15 && .@s == 0 || .@m == 30 && .@s == 0 || .@m == 45 && .@s == 0){
dispbottom "You spend a total of [ "+.@time$+" ] playing.";
}
}
}
}
end;
OnPCLogoutEvent:
if(BaseLevel >= .level){
if(.enable){
set #acctick,gettimetick(2);
set #timetick,#timetick + (gettimetick(2) - #acctick);
}
}
end;
}
I have a problem in my Hourly Points System.
Here's my script. My problem is the idle. Im not sure if it really works and stop the timer. and when it reach the 60 minutes player don't get any reward points. Please help me thnx
Share this post
Link to post
Share on other sites