12.01.2019, 19:24
Quote:
if (strcmp (cmd, "/ orguninvite", true) == 0) { tmp = strtoknew (cmdtext, idx); if (! strlen (tmp)) { SendClientMessage (playerid, COLOR_GRAD2, "Usage: / orguninvite [playerid / name]"); return 1; } if (PlayerInfo [playerid] [pOrgMember] == 0) return SendClientMessage (playerid, COLOR_GREY, "You are not in any organization."); new para1 = ReturnUser (tmp); if ((IsPlayerConnected para1)) { if (para1! = INVALID_PLAYER_ID) { if (GetDistanceBetweenPlayers (playerid, para1) <= 8 ) // remove { if (para1 == playerid) { SendClientMessage (playerid, COLOR_GREY, "You can not invite yourself"); return 1; } if (gPlayerLogged [para1] == 0) { SendClientMessage (playerid, COLOR_GREY, "The player is already in an organization"); return 1; } new org = PlayerInfo [playerid] [pOrgMember]; new orgleader = PlayerInfo [playerid] [pOrgLeader]; if (! strcmp (OrgInfo [org] [OrgOwner], GetName (playerid), true)) // return SendClientMessage (playerid, COLOR_GREY, "You are not leader in any organization"); // orgowner bafrage { SCM (playerid, -1, "And yes you are the owner"); if (! IsPlayerConnected (para1)) return SendClientMessage (playerid, COLOR_GREY, "The specified player is not logged in!"); if (PlayerInfo [para1] [pOrgMember]! = org) return SendClientMessage (playerid, COLOR_GREY, "The specified player is not member of your organization."); format (string, sizeof (string), "You were dropped from% s (ID:% i) from the organization '% s'.", PlayerInfo [playerid] [name], playerid, OrgInfo [org] [OrgName]) ; Send Message Client (para1, COLOR_LIGHTBLUE, string); format (string, sizeof (string), "% s was dropped from% s by the organization.", PlayerInfo [para1] [name], PlayerInfo [playerid] [name]); Send Message organization (org, COLOR_PURPLE, string); PlayerInfo [para1] [pOrgLeader] = 0; PlayerInfo [para1] [pOrgMember] = 0; } else { if (orgleader! = org) return SCM (playerid, -1, "You are not a leader of this ORG!"); else { if (! IsPlayerConnected (para1)) return SendClientMessage (playerid, COLOR_GREY, "The specified player is not logged in!"); if (PlayerInfo [para1] [pOrgMember]! = org) return SendClientMessage (playerid, COLOR_GREY, "The specified player is not member of your organization."); if (PlayerInfo [para1] [pOrgLeader] == org) return SCM (playerid, -1, "You can not eject ORG Leader!"); format (string, sizeof (string), "You were dropped from% s (ID:% i) from the organization '% s'.", PlayerInfo [playerid] [name], playerid, OrgInfo [org] [OrgName]) ; Send Message Client (para1, COLOR_LIGHTBLUE, string); format (string, sizeof (string), "% s was dropped from% s by the organization.", PlayerInfo [para1] [name], PlayerInfo [playerid] [name]); Send Message organization (org, COLOR_PURPLE, string); PlayerInfo [para1] [pOrgLeader] = 0; PlayerInfo [para1] [pOrgMember] = 0; } } } else { SendClientMessage (playerid, COLOR_GRAD2, "The player is not nearby"); } } } return 1; } |
Error:
[20:40:25] [cmd] Tec9(1): /orguininvite 0
[20:40:25] [debug] Run time error 4: "Array index out of bounds"
[20:40:25] [debug] Attempted to read/write array element at index 10 in array of size 10
[20:40:25] [debug] AMX backtrace:
[20:40:25] [debug] #0 00101b40 in public ocmdOnPlayerCommandText (1, 6991816 in CoL.amx
[20:40:25] [debug] #1 native CallLocalFunction () in samp8888_6755
[20:40:25] [debug] #2 0000078c in public OnPlayerCommandText (1, 69918116) in CoL.amx
Could someone tell me the mistake & how is it out of bounds?
Btw: The Worth "pOrgLeader" & "pOrgMember" of the user "Tec9" are both 10
Enum
pOrgMember,
pOrgRang,