12.03.2014, 10:51
Код:
CMD:ban(playerid, params[]) { if(CheckGMX(playerid)) return 1; if(PlayerInfo[playerid][pAdmin] >= 2) { new string[128], giveplayerid, reason[64]; if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ban [playerid/partofname] [reason]"); if(IsPlayerConnected(giveplayerid)) { if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin]) { if(AdminDuty[playerid] == 1) { new username[MAX_PLAYER_NAME]; GetPVarString(playerid, "TempNameName", username, sizeof(username)); SetPVarInt(playerid, "TempName", 0); SetPlayerName(playerid, username); } format(string, sizeof(string), "AdmCmd: %s has been auto-banned, reason: Trying to /ban a higher admin.", PlayerInfo[playerid][pAdminName]); ABroadCast(COLOR_YELLOW,string,1); PlayerInfo[playerid][pBanned] = 1; new ip[32], cw[64], tstring[128], year, month, day, hour, minute, second; GetPlayerIp(playerid,ip,sizeof(ip)); AddBan(ip); getdate(year, month, day); gettime(hour, minute, second); format(tstring, sizeof(tstring), "Date/Time: %i/%i/%i, %i:%i:%i", day, month, year, hour, minute, second); format(cw, sizeof(cw), "Current Warnings: %i (3 for Ban)", PlayerInfo[playerid][pWarns]); SendClientMessage(playerid, COLOR_REALRED, "--------------------- Ban Report ---------------------"); SendClientMessage(playerid, COLOR_WHITE, cw); SendClientMessage(playerid, COLOR_WHITE, "Staff: Server"); SendClientMessage(playerid, COLOR_WHITE, "Reason: Tried to ban a higher admin"); SendClientMessage(playerid, COLOR_WHITE, tstring); SendClientMessage(playerid, COLOR_REALRED, "Make sure you have the Screenshot of this ban by pressing (F8)"); SendClientMessage(playerid, COLOR_REALRED, "Feel free to post a ban appeal at www.as-rp.forumtl.com. Have a nice day!"); SendClientMessage(playerid, COLOR_REALRED, "-------------------------------------------------------"); Kick(playerid); return 1; } else { new playerip[32]; GetPlayerIp(giveplayerid, playerip, sizeof(playerip)); if(AdminDuty[giveplayerid] == 1) { new username[MAX_PLAYER_NAME]; GetPVarString(giveplayerid, "TempNameName", username, sizeof(username)); SetPVarInt(giveplayerid, "TempName", 0); SetPlayerName(giveplayerid, username); format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], playerip, GetPlayerNameEx(playerid), reason); Log("logs/ban.log", string); format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", PlayerInfo[giveplayerid][pAdminName], GetPlayerNameEx(playerid), reason); } else { format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason); Log("logs/ban.log", string); format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason); } SendClientMessageToAllEx(COLOR_REALRED, string); PlayerInfo[giveplayerid][pBanned] = 1; new ip[32]; GetPlayerIp(giveplayerid,ip,sizeof(ip)); AddBan(ip); new cw[64], tstring[128], sstring[128], rstring[128], aname[MAX_PLAYER_NAME], year, month, day, hour, minute, second; GetPlayerName(playerid, aname, sizeof(aname)); getdate(year, month, day); gettime(hour, minute, second); format(tstring, sizeof(tstring), "Date/Time: %i/%i/%i, %i:%i:%i", day, month, year, hour, minute, second); format(sstring, sizeof(sstring), "Staff: %s", aname); format(rstring, sizeof(rstring), "Reason: %s", reason); format(cw, sizeof(cw), "Current Warnings: %i (3 for Ban)", PlayerInfo[giveplayerid][pWarns]); SendClientMessage(giveplayerid, COLOR_REALRED, "--------------------- Ban Report ---------------------"); SendClientMessage(giveplayerid, COLOR_WHITE, cw); SendClientMessage(giveplayerid, COLOR_WHITE, sstring); SendClientMessage(giveplayerid, COLOR_WHITE, rstring); SendClientMessage(giveplayerid, COLOR_WHITE, tstring); SendClientMessage(giveplayerid, COLOR_REALRED, "Make sure you have the Screenshot of this ban by pressing (F8)"); SendClientMessage(giveplayerid, COLOR_REALRED, "Feel free to post a ban appeal at [www.as-rp.forumtl.com]"); Kick(giveplayerid); return 1; } } else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified."); } return 1; }