11.04.2014, 01:10
Hey guys, I'm having an issue with my /makeadmin command:
That is the code. Now when I type /makeadmin and I've logged into Rcon, it says I haven't met the required admin level. And also, when it did work the first time I ever used it, I made myself level 99999 admin and for some reason it would again give me that message above unless I logged into Rcon. It's very odd and I'd like some help. If I need to post some other code; just tell me.
Код:
CMD:makeadmin(playerid, params[]) { if(!IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] < 99999) return SendClientMessage(playerid, -1, "You do not meet the admin level requirement to use this command!"); new targetid, level; if(sscanf(params, "ui", targetid, level)) return SendClientMessage(playerid, -1, "/makeadmin [playerid/partofname] [level]"); if(!(-1 < level < 100000)) return SendClientMessage(playerid, -1, "The max admin level is 99999!"); if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "That player is not currently online!"); new alevel[20], astr[128], sendername[MAX_PLAYER_NAME]; switch(level) { case 0: { GetPlayerName(playerid, sendername, sizeof(sendername)); format(astr, sizeof(astr), "You have been demoted by Admin %s", sendername); SendClientMessage(targetid, COLOR_RED, astr); GetPlayerName(targetid, sendername, sizeof(sendername)); format(astr, sizeof(astr), "You have demoted %s of their Admin rank.", sendername); SendClientMessage(playerid, COLOR_RED, astr); PlayerInfo[targetid][pAdmin] = level; return 1; } case 1: alevel = "Moderator"; case 2: alevel = "Junior Admin"; case 3: alevel = "General Admin"; case 4: alevel = "Senior Admin"; case 5: alevel = "Lead Admin"; case 6: alevel = "Head Admin"; case 1337: alevel = "Executive Admin"; case 9999: alevel = "Co-Owner"; case 99999: alevel = "Owner"; default: return SendClientMessage(playerid, -1, "You have entered an invalid level. (0 - 6, 1337, 9999 or 99999)"); } GetPlayerName(playerid, sendername, sizeof(sendername)); format(astr, sizeof(astr), "You have been made into a %s by Admin %s!", alevel, sendername); SendClientMessage(targetid, COLOR_RED, astr); GetPlayerName(targetid, sendername, sizeof(sendername)); format(astr, sizeof(astr), "You have made %s into a %s!", sendername, alevel); SendClientMessage(playerid, COLOR_RED, astr); PlayerInfo[targetid][pAdmin] = level; return 1; }