SA-MP Forums Archive
Playerid don't work in 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 don't work in OnGameModeInit (/showthread.php?tid=151660)



Playerid don't work in OnGameModeInit - Ihsan_Cingisiz - 31.05.2010

How can i make this?
I tried new playerid[MAX_PLAYERS]; but still not working.
It doesn't know what playerid is, who can help me?


Re: Playerid don't work in OnGameModeInit - Jeffry - 31.05.2010

Can you show the code where you want to make it?


Re: Playerid don't work in OnGameModeInit - LTomi - 31.05.2010

I think you can't use playerid in OnGameModeInit. Just think about it, there can't be any players on the server when OnGameModeInit is called.


Re: Playerid don't work in OnGameModeInit - (.Aztec); - 31.05.2010

Don't use it on OnGameModeInit, if you want to apply something to a player, apply it OnPlayerSpawn.


Re: Playerid don't work in OnGameModeInit - ihatetn931 - 31.05.2010

To add playerid on OnGameModeInit use this

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
Any place you would type playerid but a i instead


Re: Playerid don't work in OnGameModeInit - NewTorran - 31.05.2010

Quote:
Originally Posted by [SL~RP
ihatetn931 ]
To add playerid on OnGameModeInit use this

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
Any place you would type playerid but a i instead
1. That wouldnt function the same as playerid
2. playerid in OnGameModeInit is a bad idea
3. No players can be on server when server only just starts
4. If you want to apply something use OnPlayerConnect


Re: Playerid don't work in OnGameModeInit - RyDeR` - 31.05.2010

You can't use 'playerid' integer in OnGameModeInit because it has no value then.
playerid has a value which is chosen when player joins the server. If you define playerid it has a value of 0 so the code or whatever you are doing will work for ID 0.

The only solution is to use what ihatetn931 said. A loop.
pawn Код:
for(new i; i != GetMaxPlayers(); i++)
{
    // Use i istead of playerid then.
}