28.02.2018, 18:28
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:
@OP it should look like this:
PHP код:
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));
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!");
GetPlayerName(Playerid, Playername, sizeof(Playername));//moved
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;
}