21.05.2016, 08:00
Well its bad idea to use Random function some of the player have more protection and some has less thats unfair system.
You don't need timer to kill it. You can just add Function name like this.
But anyway good.
Код:
forward AntiSKfunc(playerid); public AntiSKfunc(playerid) { SetPlayerHealth(playerid, 99.0); SetPlayerArmour(playerid, 99.0); SendClientMessage(playerid, -1, "* Spawn protection ended."); return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys & KEY_NO && AntiSK[playerid] == 1) { KillTimer(AntiSKt[playerid]);//if you're killing timer here AntiSKt[playerid] = SetTimerEx("AntiSKfunc", 100, false, "i", playerid);//why you using timer again here? SendClientMessage(playerid, -1, "* You have ended your spawn protection."); } return 1; }
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys & KEY_NO && AntiSK[playerid] == 1) { KillTimer(AntiSKt[playerid]);//if you're killing timer here AntiSKfunc(playerid);// this is better SendClientMessage(playerid, -1, "* You have ended your spawn protection."); } return 1; }