07.10.2012, 15:56
pawn Код:
CMD:makefactionleader(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
new para1,level;
if(!sscanf(params, "ui", para1, level))
{
if(level > 4 || level < 0)
{
SendClientMessage(playerid, COLOR_LIGHTRED, " Don't go below number 0 or above number 4!");
return 1;
}
if(IsPlayerConnected(para1))
{
PlayerInfo[pInfo][pLeader] = -1;
PlayerInfo[pInfo][pMember] = level;
PlayerInfo[pInfo][pRank] = 5;
new string[100];
format(string, sizeof(string), " You have been promoted to leader for %s by Admin %s.", FactionName(level), PlayerNameEx(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " You have given %s control to run %s.", PlayerNameEx(para1), FactionName(level));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
if(level == 0)
{
SendClientMessage(para1, COLOR_LIGHTBLUE, "* You are now a civilian again.");
PlayerInfo[pInfo][pMember] = 0;
PlayerInfo[pInfo][pLeader] = -1;
PlayerInfo[pInfo][pRank] = 0;
}
UpdatePlayer(para1);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, " Invalid player!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /MakeFactionLeader [playerid/PartOfName] [Faction ID]");
}
}
return 1;
}