14.05.2014, 17:24
pawn Код:
CMD:giverank(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
new targetid, level;
if(sscanf(params, "ui", targetid, level)) return SendClientMessage(playerid, -1, "/giverank [playerid/partofname] [level]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "That player is not currently online!");
if(!(-1 < level < 20 )) return SendClientMessage(playerid, -1, "The max level is 16!");
new faclevel[20], astr[128], sendername[MAX_PLAYER_NAME];
if(PlayerInfo[playerid][pAdmin] == 99999 || PlayerFacInfo[playerid][Fac] == 15)
{
switch(level)
{
case 0:
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(astr, sizeof(astr), "You have been demoted by Admin %s", sendername);
SendClientMessage(targetid, -1, astr);
GetPlayerName(targetid, sendername, sizeof(sendername));
format(astr, sizeof(astr), "You have demoted %s of their Admin rank.", sendername);
SendClientMessage(playerid, -1, astr);
PlayerFacInfo[targetid][Fac] = level;
return 1;
}
case 1: faclevel = "Cadet In Training";
case 2: faclevel = "Cadet";
case 3: faclevel = "Officer";
case 4: faclevel = "Corporal";
case 5: faclevel = "Sergeant";
case 6: faclevel = "Sergeant Grade Two";
case 7: faclevel = "Lieutenant";
case 8: faclevel = "Inspector";
case 9: faclevel = "Captain";
case 10: faclevel = "Major";
case 11: faclevel = "Major Grade Two";
case 12: faclevel = "Commander";
case 13: faclevel = "Commissioner";
case 14: faclevel = "Chief Inspector";
case 15: faclevel = "Deputy Chief";
case 16: faclevel = "Chief";
default: return SendClientMessage(playerid, -1, "You have entered an invalid level. (0 - 16)");
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(astr, sizeof(astr), "You have been made into a %s by Admin %s!", faclevel, sendername);
SendClientMessage(targetid, -1, astr);
GetPlayerName(targetid, sendername, sizeof(sendername));
format(astr, sizeof(astr), "You have made %s into a %s!", sendername, faclevel);
SendClientMessage(playerid, -1, astr);
PlayerFacInfo[targetid][Fac] = level;
PlayerFacInfo[targetid][FacType] = 1;
}
}
else
{
SendClientMessage(playerid, -1, "You do not meet the level requirement for using this command!");
}
return 1;
}