27.02.2013, 20:35
I type in Example: /setlevel 0 3 but it sets level to 0
pawn Код:
CMD:setlevel(playerid, params[])
{
new targetid;
new level;
new string[128];
if (IsPlayerAdmin(playerid) || PlayerInfo[playerid][AdminLevel] == 5)
{
if (level > 5) return SendClientMessage(playerid,COLOR_RED,"Error:Max level is 5!");
if (level < 0) return SendClientMessage(playerid,COLOR_RED,"Error:Min level is 0!");
if (level >= 0 && level <= 5)
{
new name[MAX_PLAYER_NAME];
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(targetid, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "%s Has Given You Admin Level %d .", name, level);
SendClientMessage(targetid, 0xD8D8D8FF, string);
format(string, sizeof(string), "You Gave Admin Level %d To %s .", level, PlayerName);
SendClientMessage(playerid, 0xD8D8D8FF, string);
PlayerInfo[targetid][AdminLevel] = level;
return 1;
}
}
return 1;
}