Just a quick help with a command
#1

Hey,

So I've just been wondering where the hell did I mess up with the ban command here? It does not give me errors, however, whichever ID I ban, it always inserts ID 0's player's name. So, let's say I ban ID 8, it actually bans the correct ID, however, ID 0's name gets called in the format.

Code is below. I might be blind a bit here, but I can't see where did I mess up. Ty in advance ;-;

Код:
 CMD:ban(playerid, params[])
    {
        if(PlayerInfo[playerid][pAdmin] >= 2) {
            new Playerid;
            new reason[64]; 
            new str[128]; 
            new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; 
            GetPlayerName(playerid, Adminname, sizeof(Adminname)); 
 	  		GetPlayerName(Playerid, Playername, sizeof(Playername));
            if(sscanf(params, "us[64]", Playerid,reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid] [reason]");

            if(!IsPlayerConnected(Playerid))
                return SendClientMessage(playerid, COLOR_WHITE, "ERROR: Player is not connected!");

            format(str, sizeof(str), "[ADMIN ACTION] %s have been banned by Administrator %s [Reason: %s] ", Playername, Adminname, reason);
  		BanEx(Playerid);

        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "ERROR: You are not authorised to use this command!"); 
        }
        return 1;
    }
Reply


Messages In This Thread
Just a quick help with a command - by Thundey - 28.02.2018, 18:15
Re: Just a quick help with a command - by Daddy Yankee - 28.02.2018, 18:24
Re: Just a quick help with a command - by RogueDrifter - 28.02.2018, 18:28
Re: Just a quick help with a command - by Thundey - 28.02.2018, 18:30

Forum Jump:


Users browsing this thread: 1 Guest(s)