Just a quick help with a command
#3

Quote:
Originally Posted by Daddy Yankee
Посмотреть сообщение
Try getting the name after the params check
Not try, you're actually right he does need to get the player's name after the params check that's why for him its returning id 0's name at all times,

@OP it should look like this:
PHP код:
 CMD:ban(playeridparams[])
    {
        if(
PlayerInfo[playerid][pAdmin] >= 2) {
            new 
Playerid;
            new 
reason[64]; 
            new 
str[128]; 
            new 
Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; 
            
GetPlayerName(playeridAdminnamesizeof(Adminname)); 
            if(
sscanf(params"us[64]"Playerid,reason)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /ban [playerid] [reason]");

            if(!
IsPlayerConnected(Playerid))
                return 
SendClientMessage(playeridCOLOR_WHITE"ERROR: Player is not connected!");
            
GetPlayerName(PlayeridPlayernamesizeof(Playername));//moved
            
format(strsizeof(str), "[ADMIN ACTION] %s have been banned by Administrator %s [Reason: %s] "PlayernameAdminnamereason);
          
BanEx(Playerid);

        }
        else
        {
            
SendClientMessage(playeridCOLOR_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: 2 Guest(s)