[Help]/kick
#3

Use sscanf for getting the player's ID and you got those errors because you declared pID as array which should be an integer.
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;
}
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).
Reply


Messages In This Thread
[Help]/kick - by nilanjay - 13.05.2014, 13:35
Re: [Help]/kick - by Aerotactics - 13.05.2014, 13:39
Re: [Help]/kick - by Konstantinos - 13.05.2014, 13:40
Re: [Help]/kick - by nilanjay - 13.05.2014, 13:47
Re: [Help]/kick - by Madd92 - 13.05.2014, 13:50
Re: [Help]/kick - by Tingesport - 13.05.2014, 14:28

Forum Jump:


Users browsing this thread: 1 Guest(s)