kick problem..
#1

what is wrong with this command?
pawn Код:
CMD:kick(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return GameTextForPlayer(playerid, "~r~ERROR~w~:Only admins can use this command!",5000,3);
else
{
new pname[MAX_PLAYER_NAME],
giveplayerid,
string[128],
reason[50];
if(sscanf(params,"rs[50]",reason)) return GameTextForPlayer(playerid, "~r~ERROR~w~:/kick (playerid) (reason)",5000,3);
else if(!IsPlayerConnected(giveplayerid)||giveplayerid == INVALID_PLAYER_ID) return GameTextForPlayer(playerid, "~r~ERROR~w~:This Player Isn't Connected",5000,3);
else
{
format(string,sizeof(string),"ADMIN KICK: %s has been kicked from the server(Reason:%s)",pname,reason);
SendClientMessageToAll(COLOR_PINK, string);
Kick(giveplayerid);
}
}
return 1;
}
it is compiling however it doesnt show who has been kicked and the reason..and it is kicking on lan if i press /kick 1 it will kick me eventhough i am id 0 ..help
Reply
#2

Try this:

pawn Код:
CMD:kick(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return GameTextForPlayer(playerid, "~r~ERROR~w~:Only admins can use this command!",5000,3);
    else
    {
        new
            pname[MAX_PLAYER_NAME],
            giveplayerid,
            string[128],
            reason[50];

        // Your problem was that you put 2 parameters, 'rs' in there, but you only put 1 variable 'reason'. Fixed.
        if(sscanf(params,"rs[50]",giveplayerid,reason)) return GameTextForPlayer(playerid, "~r~ERROR~w~:/kick (playerid) (reason)",5000,3);
        else if(!IsPlayerConnected(giveplayerid)||giveplayerid == INVALID_PLAYER_ID) return GameTextForPlayer(playerid, "~r~ERROR~w~:This Player Isn't Connected",5000,3);
        else
        {
            format(string,sizeof(string),"ADMIN KICK: %s has been kicked from the server(Reason:%s)",pname,reason);
            SendClientMessageToAll(COLOR_PINK, string);
            Kick(giveplayerid);
        }
    }
    return 1;
}
Reply
#3

Thx [solved] i glad you helped me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)