Timer isn't going according to plan. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Timer isn't going according to plan. (
/showthread.php?tid=348484)
Timer isn't going according to plan. -
cloudysky - 05.06.2012
Hey guys, i need help with a timer. Now I have tried, so any help would be much appreciated...
pawn Код:
forward DiseaseTimer(playerid);
pawn Код:
//kill timers
new KillDiseaseTimer[MAX_PLAYERS];
UnderOnPlayerDeath
pawn Код:
KillTimer(KillDiseaseTimer[playerid]);
pawn Код:
public DiseaseTimer(playerid)
{
for(new i, Float: health; i != MAX_PLAYERS; ++i) {
PlayerInfo[playerid][Disease] = 1;
GetPlayerHealth(i, health);
SetPlayerHealth(i, health - 10);
SendClientMessage(playerid, COLOUR_RED, "[WARNING] Health dropping." );
}
return 1;
}
Under the /makeill command
pawn Код:
KillDiseaseTimer[playerid] = SetTimerEx( "DiseaseTimer", 1000, true, "i", illperson);
Now the problem is that I do /makeill and instead of deducting health from the person who has got the disease, health is taken away from every player on the server. Also The '[WARNING] Health dropping' message doesn't display. Finally the timer doesn't kill so everyone just keeps dieing in a constant loop. Please help