SA-MP Forums Archive
OnVehicleSpawn() bug - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: OnVehicleSpawn() bug (/showthread.php?tid=233684)



OnVehicleSpawn() bug - mick88 - 02.03.2011

SetVehicleZAngle() seems to have no effect in OnVehicleSpawn().

Example code:

pawn Code:
public OnVehicleSpawn(vehicleid)
{
    if (OwnedVehicles[vehicleid])
    {
        new vid = OwnedVehicles[vehicleid];
        SetVehicleZAngle(vehicleid, vehicles[vid][cr]);
        SetVehiclePos(vehicleid, vehicles[vid][cx], vehicles[vid][cy], vehicles[vid][cz]);
    }
    else
    {
        Fuel[vehicleid] = MAX_FUEL;
    }
    return 1;
}
Vehicle angle was the same as when it was first spawned. When I'm trying to load it's position where it was last parked, the position is set correctly, but angle isn't. When using another function to load vehicle position from these variables, it works correctly.


Re: OnVehicleSpawn() bug - xxmitsu - 02.03.2011

This is an old problem as far as I know.

The solution would be destroying and creating the vehicle again on the save coords + zangle.


Re: OnVehicleSpawn() bug - Raz0r1000 - 02.03.2011

couldn't you just switch the setvehiclezangle and setvehiclepos around and it will work?


Re: OnVehicleSpawn() bug - mick88 - 02.03.2011

Quote:
Originally Posted by Raz0r1000
View Post
couldn't you just switch the setvehiclezangle and setvehiclepos around and it will work?
I tried that, didn't work.


Re: OnVehicleSpawn() bug - GaGlets(R) - 02.03.2011

SetVehicleZAngle wont work without driver in it, i have reported this while ago..


Re: OnVehicleSpawn() bug - Finn - 23.03.2011

I have noticed this bug too.