Car_Nearest(playerid)
{
static
Float:fX,
Float:fY,
Float:fZ;
for (new i = 0; i != MAX_DYNAMIC_CARS; i ++) if (CarData[i][carExists]) {
GetVehiclePos(CarData[i][carVehicle], fX, fY, fZ);
if (IsPlayerInRangeOfPoint(playerid, 3.0, fX, fY, fZ)) {
return i;
}
}
return -1;
}
Car_Inside(playerid)
{
new carid;
if (IsPlayerInAnyVehicle(playerid) && (carid = Car_GetID(GetPlayerVehicleID(playerid))) != -1)
return carid;
return -1;
}
Business_NearestDeliver(playerid)
{
for (new i = 0; i != MAX_BUSINESSES; i ++) if (BusinessData[i][bizExists] && IsPlayerInRangeOfPoint(playerid, 5.0, BusinessData[i][bizDeliver][0], BusinessData[i][bizDeliver][1], BusinessData[i][bizDeliver][2])) {
return i;
}
return -1;
}
return -1 returns "true" (1), so I don't think the problem is related to the returned value. What is crashdetect outputting?
|
[debug] #0 000b8da8 in public OnPlayerExitVehicle (0x00000000, 0x0000000f) from roleplay.amx [debug] Run time error 4: "Array index out of bounds" [debug] Accessing element at negative index -1 [debug] AMX backtrace: [debug] #0 000b8da8 in public OnPlayerExitVehicle (0x00000001, 0x0000000f) from roleplay.amx [debug] Run time error 4: "Array index out of bounds" [debug] Accessing element at negative index -1 [debug] AMX backtrace: [debug] #0 000b8da8 in public OnPlayerExitVehicle (0x00000001, 0x0000000f) from roleplay.amx