26.09.2012, 18:14
pawn Код:
CMD:giverank(playerid, params[])
{
if (PlayerInfo[playerid][pLeader] >= 1)
{
new string[128], giveplayerid, rank;
if(sscanf(params, "ud", giveplayerid, rank)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /giverank [playerid] [Rank (1-6)]");
if(rank > 6 || rank < 0) { SendClientMessageEx(playerid, COLOR_GREY, " Don't go below number 0, or above number 6!"); return 1; }
if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[playerid][pLeader] != PlayerInfo[giveplayerid][pMember])
{
SendClientMessageEx(playerid, COLOR_GRAD1, " That person is not in your faction!");
return 1;
}
if(rank > PlayerInfo[giveplayerid][pRank])
{
format(string, sizeof(string), " You have been promoted to a higher rank by %s.", GetPlayerNameEx(playerid));
}
if(rank < PlayerInfo[giveplayerid][pRank])
{
format(string, sizeof(string), " You have been demoted to a lower rank by %s.", GetPlayerNameEx(playerid));
}
PlayerInfo[giveplayerid][pRank] = rank;
SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), " You have given %s rank %d.", GetPlayerNameEx(giveplayerid),rank);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command (leaders only)!");
}
return 1;
}