Playerid don't work in OnGameModeInit
#1

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?
Reply
#2

Can you show the code where you want to make it?
Reply
#3

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.
Reply
#4

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

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
Reply
#6

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
Reply
#7

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.
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)