YCMD:setadmin(playerid, params[], help) {
if(PlayerInfo[playerid][pAdmin] <6) return SendClientMessage(playerid, COLOR_WHITE, AdminOnly);
new id,adminlevel,string[200], reason[64], escape[200];
if(sscanf(params, "uds[64]", id, adminlevel, reason)) return SCM(playerid, COLOR_GREY, "USAGE: {FFFFFF}/setadmin [playerid/name] [level] [reason]");
if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Acel player nu este conectat.");
if(adminlevel < 0 || adminlevel > 7) return SCM(playerid, COLOR_GREY, "Invalid admin level! (0-7)");
if(PlayerInfo[id][pAdmin] > PlayerInfo[playerid][pAdmin]) return SCM(playerid, COLOR_GREY, "Nu poti executa aceasta comanda pe acel player!");
format(string, sizeof(string), "Ai fost promovat la admin %d de %s, motiv: %s.", adminlevel, GetName(playerid), reason);
SendClientMessage(id, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "I-ai setat lui %s admin %d, motiv: %s.", GetName(id),adminlevel,reason);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "AdmCmd: %s i-a setat lui %s admin %d, motiv: %s.", GetName(playerid),GetName(id),adminlevel,reason);
if(GetPVarInt(playerid, "Cover") == 0) SendAdminMessage(COLOR_LOGS, string,4);
mysql_real_escape_string(string, escape);
if(adminlevel == 0) {
PlayerInfo[id][pAW] = 0;
UpdateVar(id, "AW", 0);
SpecFaction[id] = 0;
StopFly(playerid);
UsedFly[playerid] = 0;
SetPlayerHealthEx(playerid, 99);
SendClientMessage(playerid, 0xFFADADFF, "Fly mode off.");
}
else finishAchievement(id, 27);
PlayerInfo[id][pAdmin] = adminlevel;
new query[180];
if(adminlevel >= 1) format(query,sizeof(query),"UPDATE users SET `Admin`='%d', `Security`='%s',`HelpedPlayers`='0' WHERE `ID`='%d'",PlayerInfo[id][pAdmin], MD5_Hash(DEFAULT_PASSWORD), PlayerInfo[id][pSQLID]);
else format(query,sizeof(query),"UPDATE users SET `Admin`='%d' WHERE `ID`='%d'",PlayerInfo[id][pAdmin],PlayerInfo[id][pSQLID]);
mysql_query(SQL,query);
mysql_format(SQL, query, sizeof(query), "INSERT INTO staff_logs (`text`) VALUES ('%s')", escape);
mysql_tquery(SQL,query,"","");
SetPVarInt(id, "SecurityPlayer", 0);
return 1;
YCMD:sethelper(playerid, params[], help) {
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_WHITE, AdminOnly);
new id, string[180], lvl, reason[64], escape[200];
if(sscanf(params, "uds[64]", id, lvl, reason)) return SCM(playerid, COLOR_GREY, "USAGE: {FFFFFF}/sethelper [playerid/name] [level] [reason]");
if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Acel player nu este conectat.");
if(lvl < 0 || lvl > 3) return SCM(playerid, COLOR_GREY, "Invalid helper level! (0-3)");
PlayerInfo[id][pHelper] = lvl;
if(lvl > 0) {
format(string, sizeof(string), "Ai fost promovat ca helper level %d de %s, Motiv: %s", lvl, GetName(playerid), reason);
SendClientMessage(id, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "I-ai setat lui %s helper %d", GetName(id));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
finishAchievement(id, 26);
}
else {
HelperDuty[playerid] = 0, HaveHelp[playerid] = -1;
format(string, sizeof(string), "Ai fost scos din functia de helper de %s pe motiv: %s", GetName(playerid), reason);
SendClientMessage(id, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "L-ai scos pe %s din functia de helper pe motiv: %s", GetName(id),reason);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
PlayerInfo[id][pHW] = 0;
UpdateVar(id, "HW", 0);
NewbieChat[playerid] = 0;
}
format(string, sizeof(string), "AdmCmd: %s i-a setat lui %s helper %d pe motiv: %s", GetName(playerid),GetName(id),lvl,reason);
if(GetPVarInt(playerid, "Cover") == 0) SendAdminMessage(COLOR_LOGS, string,4);
mysql_real_escape_string(string, escape);
new query[128];
format(query,sizeof(query),"UPDATE users SET `Helper`='%d',`HelpedPlayers`='0' WHERE `ID`='%d'",lvl,PlayerInfo[id][pSQLID]);
mysql_query(SQL,query);
mysql_format(SQL, query, sizeof(query), "INSERT INTO staff_logs (`text`) VALUES ('%s')", escape);
mysql_tquery(SQL,query,"","");
return 1;
}
}}