16.12.2013, 22:06
Hello!
I got a problem,I want that when some admin would enter command /ban it would say You dont have appropriate administrator level to run this command.But for example i am level 1 and cmd /ban is for level 3 and when i type /ban it says Usage: /ban [ID] [REASON] ,I would like it to be when some admin under level 3 type /ban it would say You dont have appropriate administrator level to run this command.Not to show him usage.Here is my script,please edit it :
I got a problem,I want that when some admin would enter command /ban it would say You dont have appropriate administrator level to run this command.But for example i am level 1 and cmd /ban is for level 3 and when i type /ban it says Usage: /ban [ID] [REASON] ,I would like it to be when some admin under level 3 type /ban it would say You dont have appropriate administrator level to run this command.Not to show him usage.Here is my script,please edit it :
Код:
CMD:ban(playerid,params[]) { if(pInfo[playerid][Adminlevel] >=3 || IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command."); new targetid, R[25], string[100];//R = Reason new name[MAX_PLAYERS], name2[MAX_PLAYERS]; new Query[500]; new ip[16]; GetPlayerIp(targetid, ip, sizeof(ip)); GetPlayerName(targetid, name2, sizeof(name2)); if(sscanf(params, "ds", targetid, R)) { SendClientMessage(playerid, COLOR_YELLOW, "Usage:{FFFFFF} /ban [ID] [Reason]"); return 1; } if(!IsPlayerConnected(targetid)) { SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF} Player is not connected!"); return 1; } if(pInfo[targetid][USER_LOGGED_IN] == false) { SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF} Player has not logged in"); return 1; } if(pInfo[playerid][Adminlevel] >=3 || IsPlayerAdmin(playerid)) { GetPlayerName(playerid, name, sizeof(name)); GetPlayerName(targetid, name2, sizeof(name2)); format(string, sizeof(string), "[ADMIN]{FFFFFF} %s has been banned by %s(%d) {28f200}[reason: %s]", name2, name, playerid, R); SendClientMessageToAll(COLOR_ADMIN, string); pInfo[targetid][Banned] = 1; format(string, sizeof(string), "banip %s", ip); SendRconCommand(string); SendRconCommand("reloadbans"); format(Query, sizeof(Query), "UPDATE users SET banned = %d WHERE username = '%s'", pInfo[targetid][Banned], targetid); db_query(DatabaseAcc, Query); Kicked(targetid, 500); } else { return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF} You don't have an appropriate administration level to use this command."); } return 1; }