SA-MP Forums Archive
Problem with my kick command - ZCMD + SSCANF - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with my kick command - ZCMD + SSCANF (/showthread.php?tid=248023)



Problem with my kick command - ZCMD + SSCANF - BizzyD - 11.04.2011

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


Re: Problem with my kick command - ZCMD + SSCANF - Fj0rtizFredde - 11.04.2011

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



Re: Problem with my kick command - ZCMD + SSCANF - BizzyD - 11.04.2011

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