12.02.2018, 21:10
I'm making this new feature to my server where an admin level 9 is an anonymous level so if me (a level 9 admin) makes a ban to a player it will only show, "Player A has been banned from the server. [Reason: Aimbot]", and if the admin which makes the ban level is lower than 9 their name will show like this,"Player A has been banned from the server by Admin Player B.[Reason: Aimbot]". or something along that line but the problem is i don't know how to do that or is its even possible.
PHP код:
CMD:ban(playerid, params[])
{
if (!IsPlayerAdmin(playerid) && playerData[playerid][pd_AdminRank] < 2) return SendScreenMessage(playerid, LOCALE_MESSAGE_NOTAUTHORIZEDCOMMAND);
new targetid, Reason[MAX_STRING_REASON];
if (sscanf(params, "us["#MAX_STRING_REASON"]", targetid, Reason)) return SendClientMessage(playerid, COLOR_SYNTAX, "[SYNTAX] /ban <player> <reason>");
if (targetid == playerid) return SendClientMessage(playerid, COLOR_SYNTAX, "[ERROR] You can't ban yourself");
if (!IsPlayerInGame(targetid)) return SendScreenMessage(playerid, LOCALE_MESSAGE_INVALIDPLAYER);
if (playerData[playerid][pd_AdminRank] <= playerData[targetid][pd_AdminRank]&& IsPlayerAdmin(targetid)) SendScreenMessage(playerid, LOCALE_MESSAGE_CANTUSECOMMANDONTHATPLAYER);
new y,m,d,hour,mint,sec;
getdate(y,m,d);
gettime(hour,mint,sec);
new string[256];
format(string, sizeof string, "[SERVER] %s(%i) has been banned by %s %s(%i), reason: %s", ReturnPlayerName(targetid), targetid, GetStaffClassName(playerid), ReturnPlayerName(playerid), playerid, Reason);
SendClientMessageToAll(0x7E08EDFF/*COLOR_SERVER*/, string);
new message[128];
format(message, 128, "You have been banned from ~n~"SERVER_NAME"");
ShowInfoBox(targetid, "Banned", message);
PlayerPlaySound(targetid, SOUND_NOTIFICATION, 0.0, 0.0, 0.0);
mysql_format(gGameConnection, string, sizeof string, "INSERT IGNORE INTO `closed_accounts` (`account_id`, `reason`, `ip`, `by_account_id`) VALUES (%i, '%e', '%s', %i);", playerData[targetid][pd_AccountId], Reason, GetPlayerIP(targetid), playerData[playerid][pd_AccountId]);
mysql_tquery(gGameConnection, string);
format(string, sizeof string, "UPDATE `accounts` SET `total_bans` = `total_bans` + 1 WHERE `id` = %i;", playerData[targetid][pd_AccountId]);
mysql_tquery(gGameConnection, string);
SendClientMessage(targetid, COLOR_NOTIFY, "You have been banned and kicked from "SERVER_NAME"");
SendClientMessage(targetid, COLOR_NOTIFY, "================"SERVER_NAME"==================");
format(string, sizeof(string), "Your Name: %s || Account ID: %d", ReturnPlayerName(targetid),playerData[targetid][pd_AccountId]);
SendClientMessage(targetid, -1, string);
format(string, sizeof(string), "IP Address: %s || Reason: %s", GetPlayerIP(targetid),Reason);
SendClientMessage(targetid, -1, string);
format(string, sizeof(string), "Admin Position: %s || Admin Name: %s", GetStaffClassName(playerid), ReturnPlayerName(playerid));
SendClientMessage(targetid, -1, string);
format(message, sizeof(message),"Date: %d/%d/%d || Time: %02d:%02d:%02d",d,m,y,hour,mint,sec );
SendClientMessage(targetid,-1,message);
SendClientMessage(targetid, COLOR_NOTIFY, "===============================================");
SendClientMessage(targetid, COLOR_NOTIFY, "A Screenshot(F8) of the information above will be needed to make a ban appeal.");
SendClientMessage(targetid, COLOR_HINT, "You may make a ban appeal on our forums: " SERVER_URL);
GameTextForPlayer(targetid, "~r~Banned", 3000, 0);
SetTimerEx("KickEx", TIMER_KICK, false, "i", targetid);
return 1;
}