18.03.2010, 13:00
pawn Код:
CMD:setlevel(playerid, params[])
{
new tmp[128], tmp2[128], index;
tmp = strtok(params, index), tmp2 = strtok(params, index);
new giveplayerid, level;
giveplayerid = strval(tmp), level = strval(tmp2);
if(PlayerInfo[playerid][AdminLevel] > 4 || IsPlayerAdmin(playerid)) {
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /setlevel [PlayerID/PartOfName] [Level]");
if(isnull(tmp)) return SendClientMessage(playerid, COLOR_RED, "Usage: /setlevel [PlayerID/PartOfName] [Level]");
if(isnull(tmp2)) return SendClientMessage(playerid, COLOR_RED, "Usage: /setlevel [PlayerID/PartOfName] [Level]");
if(level == PlayerInfo[giveplayerid][AdminLevel]) return SendClientMessage(playerid, COLOR_RED, "Player is already this level");
if(level < 0 || level > 5) return SendClientMessage(playerid, COLOR_RED, "Invalid level");
if(IsPlayerConnected(giveplayerid)) {
new string[128], playername[MAX_PLAYER_NAME], giveplayername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof playername); GetPlayerName(giveplayerid, giveplayername, sizeof giveplayername);
format(string, sizeof string, "Administrator %s has set your admin level to %d", playername, level);
SendClientMessage(giveplayerid, COLOR_BLUE, string);
format(string, sizeof string, "You have set %s admin level to %d", giveplayername, level);
SendClientMessage(playerid, COLOR_BLUE, string);
PlayerInfo[giveplayerid][AdminLevel] = level;
}
else return SendClientMessage(playerid, COLOR_RED, "Player not Connected");
}
else return SendClientMessage(playerid, COLOR_RED, "You are not an administrator with the required level");
return 1;
}
Why?