02.12.2017, 14:29
i have this
and this
and offline set level
Код:
CMD:giveladmin(playerid,params[]) { new string[128],playername[MAX_PLAYER_NAME]; if(IsPlayerAdmin(playerid)) { if(PlayerInfo[playerid][LoggedIn] == 0) return SendClientMessage(playerid,COLOR_RED,"ERROR: Player must be registered to be an admin"); CMDMessageToAdmins(playerid,"GIVELADMIN"); GetPlayerName(playerid, playername, sizeof(playername)); new year,month,day; getdate(year, month, day); format(string,128,"You have made yourself [Level 13] on %d/%d/%d", day, month, year); SendClientMessage(playerid,blue,string); format(string,128,"%s has made him/herself [Level 13] on %d/%d/%d", playername, day, month, year); SaveToFile("AdminLog",string); dUserSetINT(PlayerName2(playerid)).("level",(13)); PlayerInfo[playerid][Level] = 13; } else { SendClientMessage(playerid,COLOR_RED,"ERROR: You must be logged into rcon to use this command"); } return 1; }
Код:
CMD:setlevel(playerid,params[]) { if(PlayerInfo[playerid][LoggedIn] == 1) { if(PlayerInfo[playerid][Level] >= 13 || IsPlayerAdmin(playerid)) { new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); if(isnull(params)) return SendClientMessage(playerid, red, "{00FF40}Usage: /setlevel {FF00D9}[PlayerID][Level][0-13]"); new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128]; player1 = strval(tmp); if(isnull(tmp2)) return SendClientMessage(playerid, red, "{00FF40}USAGE: /setlevel [playerid] [level]"); level = strval(tmp2); if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) { if(PlayerInfo[player1][LoggedIn] == 1) { if(level > ServerInfo[MaxAdminLevel] ) return SendClientMessage(playerid,red,"ERROR: Incorrect Level"); if(level == PlayerInfo[player1][Level]) return SendClientMessage(playerid,red,"ERROR: Player is already this level"); CMDMessageToAdmins(playerid,"SETLEVEL"); GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname)); new year,month,day; getdate(year, month, day); new hour,minute,second; gettime(hour,minute,second); if(level > 0) format(string,sizeof(string),"{4EEE94}Administrator %s has set you to Administrator Status {0011FF}[level %d] -|",adminname, level); else format(string,sizeof(string),"{4EEE94}Administrator %s has set you to Player Status {49F505}[level %d]",adminname, level); SendClientMessage(player1,blue,string); if(level > PlayerInfo[player1][Level]) GameTextForPlayer(player1,"~y~Promoted", 5000, 5); else GameTextForPlayer(player1,"~r~DEMOTED", 5000, 5); format(string,sizeof(string),"{4EEE94}You have made %s Level %d on {66CDAA}%d/%d/%d at %d:%d:%d", playername, level, day, month, year, hour, minute, second); SendClientMessage(playerid,blue,string); format(string,sizeof(string),"{4EEE94}Administrator %s has made %s Level %d on {0011FF}%d/%d/%d at %d:%d:%d",adminname, playername, level, day, month, year, hour, minute, second); SaveToFile("AdminLog",string); dUserSetINT(PlayerName2(player1)).("level",(level)); PlayerInfo[player1][Level] = level; return PlayerPlaySound(player1,1057,0.0,0.0,0.0); } else return SendClientMessage(playerid,red,"ERROR: Player must be registered and logged in to be admin"); } else return SendClientMessage(playerid, red, "{00FF40}ERROR: {03F2FF}Player is not connected"); } else return SendClientMessage(playerid,red,"ERROR: {FF00D9}You are not a high enough {FFFFFF}level {00FF40}to use this command"); } else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands"); }
Код:
CMD:osetlevel(playerid, params[]) { if(IsPlayerAdmin(playerid)) { new string[128], tmp[128], tmp2[128], Index; tmp = strtok(params, Index), tmp2 = strtok(params, Index); if(isnull(tmp) || isnull(tmp2)) return SendClientMessage(playerid, red, "USAGE: /osetlevel [playername] [level]"); new level = strval(tmp2); if(!udb_Exists(PlayerName2(playerid))) { new file[256]; format(file, sizeof(file), "/ladmin/users/%s.ini", udb_encode(pName(playerid))); dUserSetINT(PlayerName2(playerid)).("level",(level)); //dUserSetINT(PlayerName2(player1)).("level",(level)); dUserSetINT(PlayerName2(playerid)), "Level", level); PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0); format(string, sizeof(string), "[INFO]: You have successfully set \"%s's\" level to %d", tmp, level); CMDMessageToAdmins(playerid, "OSETLEVEL"); return SendClientMessage(playerid, blue, string); } else return SendClientMessage(playerid, red, "ERROR: This player doesnt have an account"); } else return SendClientMessage(playerid, red, "ERROR: You are not a high enough level to use this command"); }