04.11.2012, 16:38
Please correct if wrong.
Код:
YCMD:setlevel(playerid, params[], help) { new id; new pAdminLevel2; new string[64]; if(IsPlayerConnected(id)) { if(PlayerInfo[playerid][pAdmin] == 5) { if(!sscanf(params, "ui", id, pAdminLevel2)) { if((pAdminLevel2 >= 1 && pAdminLevel2 <= 5) || pAdminLevel2 == 0) { new name[MAX_PLAYER_NAME], PlrName[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); GetPlayerName(id, PlrName, sizeof(PlrName)); format(string, sizeof(string), "Админисратор %s дал Вам %d уровень администратора.", name, pAdminLevel2); SendClientMessage(id, COLOR_GREEN, string); format(string, sizeof(string), "Вы дали %d уровень администратора игроку %s.", pAdminLevel2, PlrName); SendClientMessage(playerid, COLOR_GREEN, string); PlayerInfo[id][pAdmin] = pAdminLevel2; GetPlayerName(playerid, PlrName, sizeof(PlrName)); format(string, sizeof(string), "Users/%s.ini", PlrName); new INI:File = INI_Open(UserPath(playerid)); //Откроет файл INI_WriteInt(File,"Admin Level",PlayerInfo[playerid][pAdmin]); INI_Close(File); return 1; } else return SendClientMessage(playerid, 0xD8D8D8FF, "Максимум уровней 5."); } else return SendClientMessage(playerid, 0xD8D8D8FF, "Используйте: /setlevel [ID игрока] [уровень]."); } else return SendClientMessage(playerid, 0xD8D8D8FF, "Вы не администратор."); } else return SendClientMessage(playerid, 0xD8D8D8FF, "Неверный ID."); }