13.05.2014, 13:40
Use sscanf for getting the player's ID and you got those errors because you declared pID as array which should be an integer.
If you want the player who will be kicked to see the message, then use a timer (example can be found here (at the bottom of the page): https://sampwiki.blast.hk/wiki/Kick).
pawn Код:
CMD:kick(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]:You need to an admin!");
new pID, reason[80];
if (sscanf(params, "rs[80]", pID, reason)) return SendClientMessage(playerid, COLOR_RED, "Usage: /kick <ID/Part Of Name> <Reason>");
if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[ERROR]:Invalid player id!");
new string[128], PlayerName[MAX_PLAYER_NAME], AdminName[MAX_PLAYER_NAME];
GetPlayerName(pID, PlayerName, sizeof(PlayerName));
GetPlayerName(playerid, AdminName, sizeof(AdminName));
format(string, sizeof(string), "[SERVER]: %s has been kicked by %s. Reason: %s", PlayerName, AdminName, reason);
SendClientMessageToAll(COLOR_RED, string);
Kick(pID);
return 1;
}