22.11.2011, 18:17
Quote:
Nice tutorial, however I wouldn't use sscanf for such a thing.
pawn Code:
|
pawn Code:
if(isnumeric(params))
{
id = strval(params);
}
else
{
new
szName[MAX_PLAYER_NAME];
id = INVALID_PLAYER_ID;
for(new i=0; i < MAX_PLAYERS; ++i)
{
if(!IsPlayerConnected(i))continue;
GetPlayerName(i, szName, MAX_PLAYER_NAME);
if(!strcmp(szName, params))
{
id = i;
break;
}
}
}