08.11.2016, 22:29
Hey guys I have a few debugging codes in my script and I'm not sure how to fix them. I would appreciate if someone could give me a website that allows me to look at the debug codes and try to figure out what's wrong with them that way but I can't find any at the moment. I don't understand what this Array index out of bounds means.
Here are my debug codes.
Here is my LoadCells function
Here is my civil command.
I'm not sure if you need anymore information just if someone could describe what these debugs mean I would greatly appreciate it.
Here are my debug codes.
Код:
[23:16:43] [debug] Run time error 4: "Array index out of bounds" [23:16:43] [debug] Attempted to read/write array element at index 30 in array of size 30 [23:16:43] [debug] AMX backtrace: [23:16:43] [debug] #0 00051830 in public LoadCells () from vR.amx [23:16:54] [debug] Run time error 4: "Array index out of bounds" [23:16:54] [debug] Attempted to read/write array element at negative index -1 [23:16:54] [debug] AMX backtrace: [23:16:54] [debug] #0 001416ec in public cmd_civil (0, 24722412) from vR.amx [23:16:54] [debug] #1 native CallLocalFunction () from samp03svr [23:16:54] [debug] #2 00000754 in public OnPlayerCommandText (0, 24722384) from vR.amx
PHP код:
public LoadCells()
{
new rows,fields;
cache_get_data(rows,fields);
for(new i = 0; i < rows; i++)
{
cellInfo[i][cellx]=cache_get_field_content_float(i, "X");
cellInfo[i][celly]=cache_get_field_content_float(i, "Y");
cellInfo[i][cellz]=cache_get_field_content_float(i, "Z");
cellInfo[i][cella]=cache_get_field_content_float(i, "A");
}
return 1;
}
PHP код:
CMD:civil(playerid)
{
new string[100],str[25];
new orgid=PlayerInfo[playerid][OrgID];
if(PlayerInfo[playerid][Rules] == 0) return SendClientMessage(playerid, COLOR_RED, "You need to accept rules using /rules!");
format(str,10,"0x%sFF",oInfo[PlayerInfo[playerid][OrgID]][Color]);
if(GetPVarInt(playerid,"Oskin") == 1 || GetPVarInt(playerid, "VIPSkin") == 1)
{
SetPlayerSkin(playerid,pedskin[playerid]);
SetPlayerColor(playerid, COLOR_PLAYER);
SendClientMessage(playerid, COLOR_YELLOW, "ACTION: You have set your state to civilian.");
SetPlayerSkin(playerid,pedskin[playerid]);
if(GetPVarInt(playerid,"Oskin") == 1)
{
if(oInfo[PlayerInfo[playerid][OrgID]][Type] == 1)
{
format(string,sizeof(string),"[LAW]:%s-%s is now off duty!",GetName(playerid),oInfo[PlayerInfo[playerid][OrgID]][Name]);
foreach(Player,i)
{
if(oInfo[PlayerInfo[i][OrgID]][Type] == 1)
{
SendClientMessage(i,oInfo[orgid][Color],string);
}
}
}
}
SetPVarInt(playerid,"VIPSkin", 0);
SetPVarInt(playerid,"Weps",0);
SetPVarInt(playerid,"Oskin", 0);
}
else
{
return SendClientMessage(playerid,COLOR_RED,"Error: You're already in your civil state");
}
return 1;
}