01.08.2018, 20:50
Hi, i found this in a gamemode and i think its causing my crashdetect say array -1 error..
why is using return -1? i dont understand, why not return 1??
PHP код:
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;
}
PHP код:
Car_Inside(playerid)
{
new carid;
if (IsPlayerInAnyVehicle(playerid) && (carid = Car_GetID(GetPlayerVehicleID(playerid))) != -1)
return carid;
return -1;
}
PHP код:
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;
}