Every time i restart server event timer will become negative
How can i avoid this from happening? That even if i restarted the server, event timer will remain as is and it will not show negative result or a negative time.
OnMinute00:
$EVT_Dice_Timer = gettimetick(2);
$EVT_Dice = 1;
if( gettime(3) % 1 != 0 ) end;
if (.EventStatus) end;
.EventOnJoin = 1;
.EventStatus = 1;
announce "Dice: We are going to have a Dice event.",0;
sleep 10000;
announce "Dice: For those who wants to join, use @dice",0;
sleep 10000;
announce "Dice: After 1 Minute Event will close.",0;
sleep 10000;
announce "Dice: So please if you want to join. use @dice",0;
initnpctimer;
end;
OnTimer46000:
announce "[ Dice ] Event Time's up.",0;
.EventOnJoin = 0;
$EVT_Dice = 0;
$EVT_Dice_Status = 0;
end;
Question
Bringer
Every time i restart server event timer will become negative
How can i avoid this from happening? That even if i restarted the server, event timer will remain as is and it will not show negative result or a negative time.
OnMinute00: $EVT_Dice_Timer = gettimetick(2); $EVT_Dice = 1; if( gettime(3) % 1 != 0 ) end; if (.EventStatus) end; .EventOnJoin = 1; .EventStatus = 1; announce "Dice: We are going to have a Dice event.",0; sleep 10000; announce "Dice: For those who wants to join, use @dice",0; sleep 10000; announce "Dice: After 1 Minute Event will close.",0; sleep 10000; announce "Dice: So please if you want to join. use @dice",0; initnpctimer; end; OnTimer46000: announce "[ Dice ] Event Time's up.",0; .EventOnJoin = 0; $EVT_Dice = 0; $EVT_Dice_Status = 0; end;
- script eventstatus -1,{ OnAtStatusEvent: .@evt_lim_time = $EVT_Dice_Timer + .RunEvery; .@evt_cur_time = gettimetick(2); .@evt_ent_t = (.@evt_lim_time - .@evt_cur_time); .@evt_h = (.@evt_ent_t / 3600); .@evt_m = (.@evt_ent_t - (.@evt_h * 3600)) / 60; .@evt_s = .@evt_ent_t - ((.@evt_h * 3600) + (.@evt_m * 60)); mes " [ Event Status ] "; if ($EVT_Dice == 0) mes " Dice Event [^FF0000"+.@evt_h+"h "+.@evt_m+"m "+.@evt_s+"s^000000]"; if ($EVT_Dice == 1) mes " Dice Event [^FF0000"+.@evt_h+"h "+.@evt_m+"m "+.@evt_s+"s^000000]"; switch(select( "Dice Event - " + ($EVT_Dice ? "^FF0000Not Available":"^00FF00Join Event!") + "^000000")) { case 1: break; } end; OnInit: bindatcmd "event",strnpcinfo(0)+"::OnAtStatusEvent"; .RunEvery = 3600; // second end; }
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.