15.12.2012, 11:09
pawn Код:
if(GetPlayerID(inputtext) == -1) return SendClientMessage(playerid, -1, "Error, invalid name connected!");
new pID = GetPlayerID(inputtext);
pawn Код:
stock GetPlayerID(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)
{
break;
return i;
}
}
}
return -1;
}
Sorry for the bad indentation, I'm on the phone.