SA-MP Forums Archive
Playerid for ongamemodeinit - 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: Playerid for ongamemodeinit (/showthread.php?tid=215472)



Playerid for ongamemodeinit - Zack9764 - 23.01.2011

So, I have a bug that when someone joins the server, gets spammed by my acceptdeath system. I'm trying to fix that by making it so when they join the server,

Код:
 Dead[playerid] = 0
But what would I put here?

Код:
new playerid = ???
What would I define for THEIR playerid?


Re: Playerid for ongamemodeinit - admantis - 23.01.2011

You can either do this
pawn Код:
for (new i = 0; i < MAX_PLAYERS; i ++)
{
Dead[i] = 0;
}
or
pawn Код:
// under onplayerconnect
Dead[playerid] = 0;
Or don't care. Variables are automatically set to zero when player joins / game mode starts.
OnGameModeInit is called ONLY when you start the gamemode not when you connect.


Re: Playerid for ongamemodeinit - Mike Garber - 23.01.2011

Quote:
Originally Posted by admantis
Посмотреть сообщение
Variables are automatically set to zero when player joins
False. I've had problems due to forgetting to set variables back to 0 when player connects.
However when the script starts it does.


Re: Playerid for ongamemodeinit - Zack9764 - 23.01.2011

Thanks! OnPlayerConnect works. Now just gotta upload it, and hope it works.