Stuck with a simple admin command
#1

Its realy embarasing, i have no clue what should i try next,

pawn Код:
CMD:kick(playerid, params[])
{
    new pid, reason[64];
    if(sscanf(params, "us", pid, reason)) return SendClientMessage(playerid, 0xFF0000AA, "Command Usage: /kick [playerid] [reason]");
    if ( GetPVarInt( playerid, "Level" ) < 2 )
        return SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} You are not allowed to use this command.");
    if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, -1, "ERROR: That player is not connected.");
    new adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME], string[180];
    GetPlayerName(pid, paramname, sizeof(paramname));
    GetPlayerName(playerid, adminname, sizeof(adminname));
    format(string, sizeof(string), "Administrator %s has kicked %s. Reason: %s", adminname, paramname, reason);
    SendClientMessageToAll(-1, string);
    Kick(pid);
    return 1;
}
I doesnt wants to print the reason why the player got kicked.
I cant use params[1] because its not suitable for sscanf and it prints a string warning.
Can anyone tell me what im doing wrong please?
Thanks, regards.
Reply
#2

pawn Код:
CMD:kick(playerid, params[])
{
    new pid, reason[64];
    if(sscanf(params, "us[64]", pid, reason)) return SendClientMessage(playerid, 0xFF0000AA, "Command Usage: /kick [playerid] [reason]");
    if ( GetPVarInt( playerid, "Level" ) < 2 )
        return SendClientMessage( playerid, -1, ""COL_RED"ERROR:{FFFFFF} You are not allowed to use this command.");
    if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, -1, "ERROR: That player is not connected.");
    new adminname[MAX_PLAYER_NAME], paramname[MAX_PLAYER_NAME], string[180];
    GetPlayerName(pid, paramname, sizeof(paramname));
    GetPlayerName(playerid, adminname, sizeof(adminname));
    format(string, sizeof(string), "Administrator %s has kicked %s. Reason: %s", adminname, paramname, reason);
    SendClientMessageToAll(-1, string);
    Kick(pid);
    return 1;
}
Reply
#3

Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)