09.11.2014, 10:05
Hello Everyone,
Today I was editing my server script. And when I finished and started it, I found a bug which shows wrong admin rank of an admin. So guyz please help me.
For example - If player1 is Admin Level 10 [Server Owner]
Then it shows - Server owner player1 has kicked player2.
And If Player2 is at admin Level 1 [Trial Admin]
Then also it shows - Server Owner player2 has kicked....
So guyz if u understand my problem then help me please...
Today I was editing my server script. And when I finished and started it, I found a bug which shows wrong admin rank of an admin. So guyz please help me.
For example - If player1 is Admin Level 10 [Server Owner]
Then it shows - Server owner player1 has kicked player2.
And If Player2 is at admin Level 1 [Trial Admin]
Then also it shows - Server Owner player2 has kicked....
So guyz if u understand my problem then help me please...
Код:
CMD:setlevel(playerid,params[]) { if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid)) { new tmp[256], tmp2[256], AdmRank[500], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); if(isnull(params)) return SendClientMessage(playerid, red, "USAGE: /setlevel [playerid] [level]"); new player1, level, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128]; player1 = strval(tmp); if(isnull(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setlevel [playerid] [level]"); level = strval(tmp2); if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) { if(PlayerInfo[player1][LoggedIn] == 1) { for(new i = 0; i < MAX_PLAYERS; i ++) switch(PlayerInfo[i][Level]) { case 1: AdmRank = "Trial Admin"; case 2: AdmRank = "Basic Admin"; case 3: AdmRank = "Master Admin"; case 4: AdmRank = "Senior Administrator"; case 5: AdmRank = "Professional Administrator"; case 6: AdmRank = "Lead Administrator"; case 7: AdmRank = "Head Administrator"; case 8: AdmRank = "Server Manager"; case 9: AdmRank = "Community Co-owner"; case 10: AdmRank = "Community Owner"; } if(level > 10 ) 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),"Administrator %s has set you to Administrator Status [level %d]",adminname, level); format(string,sizeof(string),"%s %s has promoted %s to level %d admin. ",AdmRank, adminname, playername, level); SendClientMessageToAll(C_PURPLE, string); print(string); if(level > PlayerInfo[player1][Level]) GameTextForPlayer(player1,"~g~Promoted", 2000, 3); else GameTextForPlayer(player1,"~r~Demoted", 2000, 3); format(string,sizeof(string),"You have made %s Level %d on %d/%d/%d at %d:%d:%d", playername, level, day, month, year, hour, minute, second); SendClientMessage(playerid,blue,string); format(string,sizeof(string),"Administrator %s has made %s Level %d on %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, "Player is not connected"); } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); }