sscanf is the most up to date, and efficient way for the terms you're attempting to use it in. SSCANF has a 'u' parameter that will get a player's name or ID from the parameters you enter.
Example:
pawn Код:
CMD:kick(playerid, params[])
{
new playertobekicked, reason[50];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "Nigga, you ain't an admin..."); //Obviously there are alternatives to this, but this will check if a player is logged into RCON
if(sscanf(params, "uS(No Reason)[50]", playertobekicked, reason)) return SendClientMessage(playerid, 0xFFFF00FF, "Usage: /kick [player id/name] [reason]");
new string[145];
new pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME];
GetPlayerName(playerid, aName, MAX_PLAYER_NAME);
GetPlayerName(playertobekicked, pName, MAX_PLAYER_NAME);
format(string, sizeof(string), "Player %s(%d) has been kicked by %s(%d) | Reason: %s", pName, playertobekicked, aName, playerid, reason);
SendClientMessageToAll(0xFF0000FF, string);
SetTimerEx("KickPlayer", 500, "i", playertobekicked);
return 1;
}
forward KickPlayer(playerid);
public KickPlayer(playerid)
{
Kick(playerid);
return 1;
}
Just a quick example, there are many sscanf tutorials, just search for them.