Kick problem
#1

Everything is working but only 1 thing isn't, and i dont know how to fix this. Here is my kick command:

pawn Код:
CMD:kick(playerid,params[])
{
    new id,reason[50];
    if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,COLOR_RED,"[ERROR] You've to be an level 1 admin to use this command.");
    else if(sscanf(params,"us[128]",id,reason)) return SendClientMessage(playerid,COLOR_GREY,"[SYNTAX] Usage: /kick [playerid] [Reason]");

    else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"[ERROR] That player isn't connected.");
    else
    {
    new string[124];
    new name[MAX_PLAYER_NAME];
    new nname[MAX_PLAYER_NAME];
    GetPlayerName(id,name,MAX_PLAYER_NAME);
    GetPlayerName(playerid,nname,MAX_PLAYER_NAME);
    format(string,sizeof(string),"[KICK] %s has been kicked by %s [Reason: %s]",name,nname,string);
    SendClientMessageToAll(COLOR_RED,string);
    Kick(id);
    }
    return 1;
}
If i kick someone, all the players will get the message: [KICK] %s has been kicked by %s [Reason: %s].
But it isn't showing the reason. He will give this: [KICK] test has been kicked by test [Reason: ].
Please help.
Reply
#2

Well what do you expect to happen when you input the reason as a blank string? Why not use the reason string you initialized earlier specifically for the kick reason? For example:

pawn Код:
format(string,sizeof(string),"[KICK] %s has been kicked by %s [Reason: %s]",name,nname,reason);
Doesn't that make more sense?
Reply
#3

Owhhh... Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)