01.12.2014, 12:55
pawn Код:
stock GetPlayerID(const Name[])
{
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(i, pName, sizeof(pName));
if(strcmp(Name, pName, true)==0)
{
return i;
}
}
}
return -1;
}
- You shouldn't use i < MAX_PLAYERS as if MAX_PLAYERS is defined as 32, it will never get to 32, 31 would be the max.
pawn Код:
stock pnome(playerid)
{
new nomeplayer[50];
GetPlayerName(playerid, nomeplayer, sizeof(nomeplayer));
return nomeplayer;
}
pawn Код:
stock GetPlayerIP(playerid)
{
new ip[24];
GetPlayerIp(playerid, ip, sizeof ip);
return ip;
}