31.08.2013, 02:37
If you're not yet using sscanf by ******, then I suggest you start using it. There's a specifier for usernames or player IDs which is "u", for example:
From the example, I used ZCMD and as you can see the specifier "u" detects either the player's partial name or id.
pawn Код:
command(id, playerid, params[])
{
if(IsPlayerConnected(playerid))
{
new id;
if(sscanf(params, "u", id))
return SendClientMessage(playerid, -1, "SYNTAX: /id [playerid/PartOfName]");
if(IsPlayerConnected(id))
{
SendClientMessage(playerid, -1, "Player is online");
}
else SendClientMessage(playerid, -1, "Player is not connected!");
}
return 1;
}