07.03.2014, 22:12
pawn Код:
CMD:makeadmin(playerid, params[])
{
new admlvl, id, string[128], output[48];
if (P_DATA[playerid][pAdmin] < 6) return SendClientMessage(playerid, ERRORCOL, "You need to be admin to use this command!");
if(sscanf(params, "ui", id, admlvl)) return SendClientMessage(playerid, ERRORCOL, "SYNTAX: /makeadmin [id] [adminlevel]");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, ERRORCOL, "This player is not connected");
if(admlvl > 6 || admlvl < 0) return SendClientMessage(playerid, ERRORCOL,"Admin levels reach from '0' to '6'");
{
switch(admlvl)
{
case 1: output = "a Probationary Admin";
case 2: output = "a General Admin";
case 3: output = "a Senior Admin";
case 4: output = "a Server Manager";
case 5: output = "an Executive Admin";
case 6: output = "a 'ur rank here'";
default: output = "an Undefined Admin";
}
if(P_DATA[id][pAdmin] != admlvl)
{
if(admlvl < P_DATA[id][pAdmin])
{
format(string, sizeof(string),"You have been demoted to %s by %s", output ,GetPlayerNameEx(playerid));
}
if(admlvl > P_DATA[id][pAdmin])
{
format(string, sizeof(string),"You have been promoted to %s by %s", output ,GetPlayerNameEx(playerid));
}
if(admlvl == 0)
{
format(string, sizeof(string),"You have been fired from the administration team by %s", GetPlayerNameEx(playerid));
}
P_DATA[id][pAdmin] = admlvl;
SendClientMessage(id, 0xFF0000FF, string);
}
else SendClientMessage(playerid, 0xFFFFFFFF, "User already has that admin level");
}
return 1;
}
stock GetPlayerNameEx(playerid)
{
new name[24];
GetPlayerName(playerid, name, sizeof(name));
strreplace(name, '_', ' ');
return name;
}