[06:42:25] [debug] Run time error 4: "Array index out of bounds"
[06:42:25] [debug] Accessing element at negative index -1
[06:42:25] [debug] AMX backtrace:
[06:42:25] [debug] #0 003e4ac0 in public Streamer_OnPlayerEditObject (0x00000000, 0x00000001, 0x000001cf, 0x00000000, 0x44b6eca0, 0xc4d6562e, 0x4158c006, 0x00000000, 0x00000000, 0x00000000) from script.amx
[06:42:25] [debug] #1 000007e4 in public OnPlayerEditObject (0x00000000, 0x00000001, 0x000001cf, 0x00000000, 0x44b6eca0, 0xc4d6562e, 0x4158c006, 0x00000000, 0x00000000, 0x00000000) from script.amx
public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
{
if(oEdit[playerid] == 1)
{
idx = oEditID[playerid];
if(response == EDIT_RESPONSE_UPDATE)
{
SetDynamicObjectPos(objectid, x, y, z);
SetDynamicObjectRot(objectid, rx, ry, rz);
}
else if(response == EDIT_RESPONSE_CANCEL)
{
SetDynamicObjectPos(objectid, oPos[playerid][0], oPos[playerid][1], oPos[playerid][2]);
SetDynamicObjectRot(objectid, oRot[playerid][0], oRot[playerid][1], oRot[playerid][2]);
oPos[playerid][0] = 0; oPos[playerid][1] = 0; oPos[playerid][2] = 0;
oRot[playerid][0] = 0; oRot[playerid][1] = 0; oRot[playerid][2] = 0;
oEdit[playerid] = 0;
oEditID[playerid] = 0;
format(string, sizeof(string), " Cancelled Edit Object ID %d.", idx);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(response == EDIT_RESPONSE_FINAL)
{
SetDynamicObjectPos(objectid, x, y, z);
SetDynamicObjectRot(objectid, rx, ry, rz);
if(oEdit[playerid] == 1)
{
ObjectInfo[idx][oX] = x;
ObjectInfo[idx][oY] = y;
ObjectInfo[idx][oZ] = z;
ObjectInfo[idx][oRX] = rx;
ObjectInfo[idx][oRY] = ry;
ObjectInfo[idx][oRZ] = rz;
oEdit[playerid] = 0;
oEditID[playerid] = 0;
format(string, sizeof(string), "Finished Edit Object ID %d.", idx);
SendClientMessage(playerid, COLOR_WHITE, string);
SaveObj();
}
}
}
return 1;
}
forward OnPlayerEditObject( playerid, playerobject, objectid, response,
Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ );
forward OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz);
public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) { printf("Debug: playerid: %i, objectid: %i, response: %i, X: %f, Y: %f, Z: %f, rX: %f, rY: %f, rZ: %f", playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz); if(oEdit[playerid] == 1) { idx = oEditID[playerid]; if(response == EDIT_RESPONSE_UPDATE) { SetDynamicObjectPos(objectid, x, y, z); SetDynamicObjectRot(objectid, rx, ry, rz); } else if(response == EDIT_RESPONSE_CANCEL) { SetDynamicObjectPos(objectid, oPos[playerid][0], oPos[playerid][1], oPos[playerid][2]); SetDynamicObjectRot(objectid, oRot[playerid][0], oRot[playerid][1], oRot[playerid][2]); oPos[playerid][0] = 0; oPos[playerid][1] = 0; oPos[playerid][2] = 0; oRot[playerid][0] = 0; oRot[playerid][1] = 0; oRot[playerid][2] = 0; oEdit[playerid] = 0; oEditID[playerid] = 0; format(string, sizeof(string), " Cancelled Edit Object ID %d.", idx); SendClientMessage(playerid, COLOR_WHITE, string); } else if(response == EDIT_RESPONSE_FINAL) { SetDynamicObjectPos(objectid, x, y, z); SetDynamicObjectRot(objectid, rx, ry, rz); if(oEdit[playerid] == 1) { ObjectInfo[idx][oX] = x; ObjectInfo[idx][oY] = y; ObjectInfo[idx][oZ] = z; ObjectInfo[idx][oRX] = rx; ObjectInfo[idx][oRY] = ry; ObjectInfo[idx][oRZ] = rz; oEdit[playerid] = 0; oEditID[playerid] = 0; format(string, sizeof(string), "Finished Edit Object ID %d.", idx); SendClientMessage(playerid, COLOR_WHITE, string); SaveObj(); } } } return 1; }
The difference is in the array playerobject , which is not in Streamer.
|