CMD:makeadmin(playerid, params[]) { new AdminLevel; if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected!"); if(PlayerInfo[targetid][pAdmin] >= 3 || IsPlayerAdmin(playerid)) { if(sscanf(params, "ui", targetid, AdminLevel)) return SendClientMessage(playerid, -1, "USAGE: /makeadmin [ID] [LEVEL 1-4]"); if(AdminLevel < 1 || AdminLevel > 4) return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid Admin level"); SendClientMessageEx(playerid, COLOR_LAWNGREEN, "You've just been made: %s admin level: %i", ReturnName(targetid), AdminLevel); SendClientMessageEx(targetid, COLOR_LAWNGREEN, "You've just been made admin level: %i by %s", AdminLevel, ReturnName(playerid)); PlayerInfo[targetid][pAdmin] = AdminLevel; } else return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an Admin!"); return 1; }
Which array is sized 1000?
You are accessing it with index 65535, presumibly an invalid id. |
stock ReturnName(playerid, underScore = 1) { new playersName[MAX_PLAYER_NAME + 2]; GetPlayerName(playerid, playersName, sizeof(playersName)); if(!underScore) { { for(new i = 0, j = strlen(playersName); i < j; i ++) { if(playersName[i] == '_') { playersName[i] = ' '; } } } } return playersName; } stock SendClientMessageEx(playerid, color, const str[], {Float,_}:...) { static args, start, end, string[156] ; #emit LOAD.S.pri 8 #emit STOR.pri args if (args > 12) { #emit ADDR.pri str #emit STOR.pri start for (end = start + (args - 12); end > start; end -= 4) { #emit LREF.pri end #emit PUSH.pri } #emit PUSH.S str #emit PUSH.C 156 #emit PUSH.C string #emit PUSH.C args #emit SYSREQ.C format SendClientMessage(playerid, color, string); #emit LCTRL 5 #emit SCTRL 4 #emit RETN } return SendClientMessage(playerid, color, str); }
new id, AdminLevel;
if(sscanf(params, "ui", id, AdminLevel)) return ...
if(!IsPlayerConnected(id)) return ...
if(AdminLevel < 1 || AdminLevel > 4) return ...
...
PlayerInfo[id][pAdmin] = AdminLevel;