How to fix scripts that only work for id 0? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to fix scripts that only work for id 0? (
/showthread.php?tid=186233)
How to fix scripts that only work for id 0? -
Haydz - 28.10.2010
So i'v made this anti spawn kill and it works fine untill it sets you back to 100 health, only id 0 gets changed back to 100 health, every other player stays at 9999 forever.
code:
Код:
forward AntKill(playerid);
label[playerid] = Create3DTextLabel("Anti Spawnkill",0x300FFAAB,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
SetPlayerHealth(playerid,9999999);
SetTimer("AntKill",15000,false);
public AntKill(playerid)
{
SetPlayerHealth(playerid,100.0);
Delete3DTextLabel(label[playerid]);
}
AW: How to fix scripts that only work for id 0? -
[Nino] - 28.10.2010
own callbacks with parameters uses settimerex and not settimer...
delete the settimer line and add:
Код:
SetTimerEx("AntKill", 15000, false, "d", playerid);
Re: How to fix scripts that only work for id 0? -
Jochemd - 28.10.2010
Actually SetTimerEx is a timer which you set for a player only. SetTimer is a global timer.
Re: How to fix scripts that only work for id 0? -
DevilG - 28.10.2010
Quote:
Originally Posted by Jochemd
Actually SetTimerEx is a timer which you set for a player only. SetTimer is a global timer.
|
And then what about putting the SetTimerEx under his OnPlayerSpawn code?
Re: How to fix scripts that only work for id 0? -
Mean - 30.10.2010
It won't work, just use SetTimerEx and thats it