GetClosestVehicle
#1

I got this function from a guy on the sa-mp forums and now I'm experiencing problems with it.nmAllright so when I changed to sa-mp 0.3b R2 This function didn't work anymore. It previously worked but now it doesn't. Does anyone have any solution to this?

pawn Код:
public GetClosestVehicle(playerid, Float:radius)
{
    new Float:SpielerX, Float:SpielerY, Float:SpielerZ, Float:CarX, Float:CarZ, Float:CarY;
    GetPlayerPos(playerid, SpielerX, SpielerY, SpielerZ);
    for(new i = 1; i < MAX_VEHICLES; i++)
    {
        GetVehiclePos(i, CarX, CarY, CarZ);
        if((floatabs(SpielerX-CarX)<radius)&&(floatabs(SpielerY-CarY)<radius)&&(floatabs(SpielerZ-CarZ)<radius))
        {
            return i;
        }
    }
    return false;
}
Reply
#2

It just returns the first vehicle that it has found within the radius, try getting another function?

Sorry, no ideas why doesn't work now, is there any errors and have you recompiled it with newest includes? (pawno sometimes screws you with older version of it, like i'm having problems because i have about 5 (0.2.2, 0.2X, 0.3a R8, 0.3b) servers, updating usually is a pain in the a55, atleast for me. -.-

Cause in your script there are almost only math expressions, recompiling should work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)