16.08.2018, 02:31
Hello guys, i need help... i compile perfectly with pawn, but crashdetect report this error. why??
PHP код:
[debug] Run time error 4: "Array index out of bounds"
[debug] Attempted to read/write array element at negative index -1
[debug] AMX backtrace:
[debug] #0 003c795c in public OnPlayerUpdate (playerid=2) at C:\Users\1320703\Desktop\GTA3\Server2\gamemodes\KoN.pwn:22859
PHP код:
if (ud == KEY_UP)
{
if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
new slot = -1;
new Float:x, Float:y, Float:z;
for(new i = 0; i < MAX_OBJ; i++)
if(dGunData[i][ObjData][0] > 0 && IsValidObject(dGunData[i][ObjData][0]))
{
GetObjectPos(dGunData[i][ObjData][0], x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z))
{
slot = i;
break;
}
}
DestroyObject(dGunData[slot][ObjData][0]); // <--------------- 22859 Line Error
GivePlayerWeapon(playerid, dGunData[slot][ObjData][1], dGunData[slot][ObjData][2]);
dGunData[slot][ObjData][0] = 0;
new buffer[50];
format(buffer, sizeof(buffer), "%s", GunNames[dGunData[slot][ObjData][1]]);
}