27.03.2015, 19:06
Well, I have system /odemote offline remove admin now how i can make it /odemote [playername] [admin level], I need to make it offline set admin
Код:
CMD:odemote(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] < 9999) { SendClientMessageEx(playerid, COLOR_WHITE, "{FF0000}ERROR{E3E3E3}: You have insufficient rights to use this certain command!"); return 1; } new string[128], query[512], tmpName[MAX_PLAYER_NAME]; if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /odemote [player name]"); mysql_real_escape_string(params, tmpName); SetPVarString(playerid, "OnDemoted", tmpName); format(query,sizeof(query),"UPDATE `accounts` SET `AdminLevel` = 0 WHERE `Username`= '%s' AND `AdminLevel` < 99999 AND `AdminLevel` > 0",tmpName); mysql_function_query(MainPipeline, query, false, "OnDemoted", "ii", playerid, true); format(string,sizeof(string),"Attempting to demote %s's account.",tmpName); SendClientMessageEx(playerid,COLOR_YELLOW,string); return 1; } forward OnDemoted(index); public OnDemoted(index) { new string[128], name[24]; GetPVarString(index, "OnDemoted", name, 24); if(mysql_affected_rows(MainPipeline)) { format(string, sizeof(string), "You have successfully demoted %s's account.", name); SendClientMessageEx(index, COLOR_WHITE, string); format(string, sizeof(string), "AdmCmd: %s was offline demoted by %s.", name, GetPlayerNameEx(index)); Log("logs/odemote.log", string); } else { format(string, sizeof(string), "There was an issue with demoting %s's account.", name); SendClientMessageEx(index, COLOR_WHITE, string); } DeletePVar(index, "OnDemoted"); return 1; }