21.08.2012, 13:16
Hello,
I have scripted this /setadmin command to set admins, and when for example I set an admin to level 1 as a Trial admin, it tells that I set him as a Basic which is level 2 but he is level 1. So, check this cmd for me and please if there is another way to make it please help me doing it:
Thank you!
I have scripted this /setadmin command to set admins, and when for example I set an admin to level 1 as a Trial admin, it tells that I set him as a Basic which is level 2 but he is level 1. So, check this cmd for me and please if there is another way to make it please help me doing it:
Код:
CMD:setadmin(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
new targetid, level;
new sendername[32], string[128];
if(sscanf(params, "ui", targetid, level))
{
SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /setadmin <playerid> <level>");
return 1;
}
if(level > 5 || level < 0) { SendClientMessage(playerid, COLOR_GREY, "> Don't go below 0 or higher then 5!"); return 1; }
if(IsPlayerConnected(targetid))
{
new ranktext[32];
if(PlayerInfo[targetid][pAdmin] == 1) { ranktext = "Trial Admin"; }
else if(PlayerInfo[targetid][pAdmin] == 2) { ranktext = "Basic Admin"; }
else if(PlayerInfo[targetid][pAdmin] == 3) { ranktext = "Lead Admin"; }
else if(PlayerInfo[targetid][pAdmin] == 4) { ranktext = "Head Admin"; }
else if(PlayerInfo[targetid][pAdmin] == 5) { ranktext = "Owner"; }
else
{
return 1;
}
PlayerInfo[targetid][pAdmin] = level;
SavePlayerStats(playerid);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string),"> Admin %s has promoted you to a %s", sendername, ranktext);
SendClientMessage(targetid, 0xFFFFFFFF, string);
}
}
else return SendClientMessage(playerid, 0xFFFFFFFF, "Only Admins can perform this action.");
return 1;
}

