Hello I have here a script where npc give players a 5 minutes call to relogin in able to have an exp boost. but the problem is when the script is not activated on its time I can still receive the exp boost. I want you to check if my timer is correct. Thnx in advance.
//-------------------------------------------------------------------------------------------------
- script Free Rewards FAKE_NPC,{
OnHour11:
OnHour13:
OnHour17:
OnHour19:
goto enable;
enable:
if(.svn){
query_sql "DELETE FROM `acc_reg_num_db` WHERE `key`='#expboost'";
}else{
query_sql "DELETE FROM `global_reg_value` WHERE `str`='#expboost'";
}
set .available,1;
set .rewards$,"EXP BOOST";
announce "[ FREE "+.rewards$+" ] Re-login now! You have only 5 minutes for FREE "+.rewards$+".",0;
startnpctimer;
end;
OnTimer60000:
announce "[ FREE "+.rewards$+" ] You have 4 minutes left to relogin.",0;
end;
OnTimer120000:
announce "[ FREE "+.rewards$+" ] You have 3 minutes left to relogin.",0;
end;
OnTimer180000:
announce "[ FREE "+.rewards$+" ] You have 2 minutes left to relogin.",0;
end;
OnTimer240000:
announce "[ FREE "+.rewards$+" ] You have 1 minute left to relogin.",0;
end;
OnTimer300000:
announce "[ FREE "+.rewards$+" ] Time's Up...!",0;
stopnpctimer;
goto reset;
end;
reset:
set .available,0;
end;
OnInit:
//-------------------------------------------------------------------------------------------------
set .svn,1; // 0 - rAthena/eAthena, 1 - Hercules
set .available,0;
set .n$, "^FF0000[Free EXP BOOST]^000000";
bindatcmd "expboost","Free Rewards::OnDoEvent",80,100; // Admin reset command
//-------------------------------------------------------------------------------------------------
end;
OnDoEvent:
if ( compare( .@atcmd_parameters$, "reset" ) ) {
if(.svn){
query_sql "DELETE FROM `acc_reg_num_db` WHERE `key`='#expboost'";
}else{
query_sql "DELETE FROM `global_reg_value` WHERE `str`='#expboost'";
}
mes .n$;
mes"FREE EXP BOOST has been reset.";
close;
}else if ( compare( .@atcmd_parameters$, "on" ) ) {
mes .n$;
mes "FREE EXP BOOST is now enabled.";
close2;
set .available,1;
set .rewards$,"EXP BOOST";
announce "[ FREE "+.rewards$+" ] Re-login now! You have only 5 minutes for FREE "+.rewards$+".",0;
startnpctimer;
}
end;
OnPCLoginEvent:
if(.available){
if(!#expboost){
set #expboost,1;
sc_start SC_CASH_PLUSEXP,900000,150;
sc_start SC_CASH_RECEIVEITEM,900000,150;
end;
}
}
end;
}
Hello I have here a script where npc give players a 5 minutes call to relogin in able to have an exp boost. but the problem is when the script is not activated on its time I can still receive the exp boost. I want you to check if my timer is correct. Thnx in advance.
//------------------------------------------------------------------------------------------------- - script Free Rewards FAKE_NPC,{ OnHour11: OnHour13: OnHour17: OnHour19: goto enable; enable: if(.svn){ query_sql "DELETE FROM `acc_reg_num_db` WHERE `key`='#expboost'"; }else{ query_sql "DELETE FROM `global_reg_value` WHERE `str`='#expboost'"; } set .available,1; set .rewards$,"EXP BOOST"; announce "[ FREE "+.rewards$+" ] Re-login now! You have only 5 minutes for FREE "+.rewards$+".",0; startnpctimer; end; OnTimer60000: announce "[ FREE "+.rewards$+" ] You have 4 minutes left to relogin.",0; end; OnTimer120000: announce "[ FREE "+.rewards$+" ] You have 3 minutes left to relogin.",0; end; OnTimer180000: announce "[ FREE "+.rewards$+" ] You have 2 minutes left to relogin.",0; end; OnTimer240000: announce "[ FREE "+.rewards$+" ] You have 1 minute left to relogin.",0; end; OnTimer300000: announce "[ FREE "+.rewards$+" ] Time's Up...!",0; stopnpctimer; goto reset; end; reset: set .available,0; end; OnInit: //------------------------------------------------------------------------------------------------- set .svn,1; // 0 - rAthena/eAthena, 1 - Hercules set .available,0; set .n$, "^FF0000[Free EXP BOOST]^000000"; bindatcmd "expboost","Free Rewards::OnDoEvent",80,100; // Admin reset command //------------------------------------------------------------------------------------------------- end; OnDoEvent: if ( compare( .@atcmd_parameters$, "reset" ) ) { if(.svn){ query_sql "DELETE FROM `acc_reg_num_db` WHERE `key`='#expboost'"; }else{ query_sql "DELETE FROM `global_reg_value` WHERE `str`='#expboost'"; } mes .n$; mes"FREE EXP BOOST has been reset."; close; }else if ( compare( .@atcmd_parameters$, "on" ) ) { mes .n$; mes "FREE EXP BOOST is now enabled."; close2; set .available,1; set .rewards$,"EXP BOOST"; announce "[ FREE "+.rewards$+" ] Re-login now! You have only 5 minutes for FREE "+.rewards$+".",0; startnpctimer; } end; OnPCLoginEvent: if(.available){ if(!#expboost){ set #expboost,1; sc_start SC_CASH_PLUSEXP,900000,150; sc_start SC_CASH_RECEIVEITEM,900000,150; end; } } end; }
Edited by gmblankShare this post
Link to post
Share on other sites