Problem at /kick.
#5

The code you posted should be working, I optimized it a bit though
pawn Код:
CMD:kick(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You need to be admin for use this command.");

    new PID, reason[64]; //the reason/playerid
    if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, 0xFF0000FF, "/kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
    if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, 0xFF0000FF, "Player is not connected!");

    new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
    GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
    GetPlayerName(PID, Playername, sizeof(Playername));

    new str[128];
    format(str, sizeof(str), "'%s' has been kicked by administrator '%s'. Reason: %s.", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
    SendClientMessageToAll(0xFF6C00FF, str); //send that message to all
   
    Kick(PID);
    return 1;
}
Reply


Messages In This Thread
Problem at /kick. - by GabiXx - 01.08.2015, 14:10
AW: Problem at /kick. - by Macronix - 01.08.2015, 14:12
Re: Problem at /kick. - by GabiXx - 01.08.2015, 14:53
AW: Problem at /kick. - by Macronix - 01.08.2015, 14:57
Re: Problem at /kick. - by xVIP3Rx - 01.08.2015, 14:58
Re: Problem at /kick. - by GabiXx - 01.08.2015, 15:04
Re: Problem at /kick. - by xVIP3Rx - 01.08.2015, 15:17
Re: Problem at /kick. - by GabiXx - 01.08.2015, 16:07
AW: Problem at /kick. - by Macronix - 01.08.2015, 16:10
Re: Problem at /kick. - by GabiXx - 01.08.2015, 16:24

Forum Jump:


Users browsing this thread: 2 Guest(s)