Problem with my kick command - ZCMD + SSCANF
#1

Hello, i got a problem with my kick command. This is the first time trying to script in ZCMD + SSCANF. Well the problem is. That when i am going to kick someone. It shows the other players name. Like this:

Jimmy Kicked Jimmy. Reason:. And it doesnt say the admin name.

This is my kick command.

pawn Код:
CMD:kick(playerid,params[])
    {
        if(PlayerInfo[playerid][pAdminLevel] >=1)
        {
            new id,n[MAX_PLAYER_NAME],reason[35], on[MAX_PLAYER_NAME], string[128], string2[128];
            if(sscanf(params,"uz",id, reason)) return SendClientMessage(playerid,COLOR_RED,"SYNTAX:/kick [ID] [reason]");
            else if(playerid == INVALID_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Player not found");
            else
            {
            GetPlayerName(id,n,sizeof(n));
            GetPlayerName(id,on,sizeof(on));
            format(string,sizeof(string),"You have been kicked by Admin: %s for %s",n,reason);
            SendClientMessage(playerid,COLOR_GOLD,string);
            format(string2, sizeof(string), "Admin Action: %s has kicked %s because: %s",n,on,reason);
            SendClientMessageToAll(COLOR_GOLD,string2);
            Kick(id);
            }
        }
        else return SendClientMessage(playerid, COLOR_RED, "You are not a admin");
        return 1;
    }
Anyone know how to fix this?

Thanks,Alex
Reply
#2

I guess that
pawn Код:
GetPlayerName(id,n,sizeof(n));
should be:
pawn Код:
GetPlayerName(playerid,n,sizeof(n));
Reply
#3

thank you i really suck at zcmd first time i try it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)