17.02.2014, 01:40
Strings can't be compared with the '==' equal operator. You need to use strcmp (string compare)
https://sampwiki.blast.hk/wiki/Strcmp
Apart from that, the loop wouldn't work either:
Do something like this:
Use 'player' instead of 'nom', because you've stored the player id to handle in that variable.
https://sampwiki.blast.hk/wiki/Strcmp
Apart from that, the loop wouldn't work either:
Do something like this:
pawn Код:
new player = INVALID_PLAYER_ID;
foreach(new i : Player)
{
GetPlayerName(i, name, sizeof(name))
if(strcmp(name, nom, true) == 0)
{
player = i;
break;
}
}
if(player != INVALID_PLAYER_ID) //means that a player was found
{
//code
}
else //no player was found online with that name
{
//code
}