SA-MP Forums Archive
Solved - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Solved (/showthread.php?tid=354238)



Solved - ReneG - 26.06.2012

Solved


Re: Solved - JaTochNietDan - 26.06.2012

It's complaining about that because you actually do have a return value in certain cases, but not in all cases. It's complaining because you should have a return value in all cases if you're going to have any at all.

So consider adding:

pawn Код:
return -1;
To the end. You could use it to specify when there are no empty passenger slots, for example:

pawn Код:
new slot = GetNextEmptyDoorSlot();

if(slot != -1) PutPlayerInVehicle(playerid, vehicleid, slot);
I hope that makes sense.


Re: Solved - dowster - 26.06.2012

Код:
At the top: #define INVALID_DOOR -1

stock GetNextEmptyDoorSlot()
{
    for(new i=0; i<MAX_DOORS; i++)
    {
        if(DoorInfo[i][dTaken] == 0)
        {
            return i;
        }
    }
    return INVALID_DOOR;
}
Edit: Grr, beat by mere seconds.