return -1? it s ok to use it? or its better return 1/0?
#1

Hi, i found this in a gamemode and i think its causing my crashdetect say array -1 error..

PHP код:
Car_Nearest(playerid)
{
    static
        
Float:fX,
        
Float:fY,
        
Float:fZ;
    for (new 
0!= MAX_DYNAMIC_CARS++) if (CarData[i][carExists]) {
        
GetVehiclePos(CarData[i][carVehicle], fXfYfZ);
        if (
IsPlayerInRangeOfPoint(playerid3.0fXfYfZ)) {
            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 
0!= MAX_BUSINESSES++) if (BusinessData[i][bizExists] && IsPlayerInRangeOfPoint(playerid5.0BusinessData[i][bizDeliver][0], BusinessData[i][bizDeliver][1], BusinessData[i][bizDeliver][2])) {
        return 
i;
    }
    return -
1;

why is using return -1? i dont understand, why not return 1??
Reply


Messages In This Thread
return -1? it s ok to use it? or its better return 1/0? - by R3SpaWn0 - 01.08.2018, 20:50
Re: return -1? it s ok to use it? or its better return 1/0? - by GRiMMREAPER - 01.08.2018, 21:06
Re: return -1? it s ok to use it? or its better return 1/0? - by R3SpaWn0 - 01.08.2018, 21:22
Re: return -1? it s ok to use it? or its better return 1/0? - by Akeem - 02.08.2018, 02:32
Re: return -1? it s ok to use it? or its better return 1/0? - by coool - 02.08.2018, 06:45

Forum Jump:


Users browsing this thread: 3 Guest(s)