01.10.2014, 10:38
This is how it was earlier before I changed the make admin command and the admin rank names and it worked perfectly.
pawn Код:
COMMAND:makeadmin(playerid, params[])
{
new targetid, alevel, str[128];
if(PlayerStat[playerid][AdminLevel] < 5) return SendClientMessage(playerid, GREY, "You can't use this command.");
if(sscanf(params,"ud", targetid, alevel))return SendClientMessage(playerid, GREY, "USAGE: /makeadmin [playerid] [adminlevel]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, GREY, "Target ID not found.");
if(alevel < 0) return SendClientMessage(playerid, GREY, "Invalid admin level.");
if(PlayerStat[targetid][AdminLevel] <= alevel)
{
format(str, sizeof(str), "Admin %s has promoted %s to level %d admin.", GetOOCName(playerid), GetOOCName(targetid), alevel);
SendClientMessageToAll(RED, str);
AdminActionLog(str);
PlayerStat[targetid][AdminLevel] = alevel;
}
if(PlayerStat[targetid][AdminLevel] > alevel)
{
format(str, sizeof(str), "Admin %s has demoted %s to level %d admin.", GetOOCName(playerid), GetOOCName(targetid), alevel);
SendClientMessageToAll(RED, str);
AdminActionLog(str);
PlayerStat[targetid][AdminLevel] = alevel;
}
return 1;
}
pawn Код:
stock GetAdminRank(playerid)
{
new Rank[60];
if(PlayerStat[playerid][AdminLevel] >= 1)
{
if(PlayerStat[playerid][AdminLevel] == 1) format(Rank, sizeof(Rank), "Moderator");
if(PlayerStat[playerid][AdminLevel] == 2) format(Rank, sizeof(Rank), "Administrator");
if(PlayerStat[playerid][AdminLevel] == 3) format(Rank, sizeof(Rank), "Administrator");
if(PlayerStat[playerid][AdminLevel] == 4) format(Rank, sizeof(Rank), "Head Administrator");
if(PlayerStat[playerid][AdminLevel] == 5) format(Rank, sizeof(Rank), "Management");
if(PlayerStat[playerid][AdminLevel] == 1338) format(Rank, sizeof(Rank), "Management");
}
else
{
Rank = "None";
}
return Rank;
}