02.03.2012, 10:08
my mistake:
u used playerid instead of id
pawn Код:
CMD:setlevel(playerid, params[])
{
if(PlayerInfo[playerid][Adminlevel] == 1 || IsPlayerAdmin(playerid))
{
new id, lvl;
if(sscanf(params, "ui", id, lvl)) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_DGREY#"/setlevel / "#COL_SGREY#"[PlayerID/PartOfName] [Level]");
else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, "Invalid ID");
else if(lvl > 1) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_ORANGE#"[ADMIN]"#COL_LRED#" Administrator level cannot be higher then 1!");
else
{
new INI:File = INI_Open(UserPath(id));
PlayerInfo[id][Adminlevel] = lvl;
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(id));
INI_WriteInt(File,"Kills",PlayerInfo[id][Kills]);
INI_WriteInt(File,"Deaths",PlayerInfo[id][Deaths]);
INI_WriteInt(File,"Adminlevel",PlayerInfo[id][Adminlevel]);
INI_Close(File);
}
}
return 1;
}