SA-MP Forums Archive
OnVehicleSpawn - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnVehicleSpawn (/showthread.php?tid=67883)



OnVehicleSpawn - Kinetic - 05.03.2009

Is OnVehicleSpawn called before the car is respawned or after the callback is returned?


Re: OnVehicleSpawn - hoodline - 05.03.2009

proberly after its returned

i maybe wrong


Re: OnVehicleSpawn - Kinetic - 05.03.2009

eh, I guess ill just test it :P


Re: OnVehicleSpawn - hoodline - 05.03.2009

The only reason why i think that is because if it dont return nothing
then the vehicle wont spawn because there is no vehicle id for it to spawn


Re: OnVehicleSpawn - Kinetic - 05.03.2009

well this

pawn Код:
public OnVehicleSpawn(vehicleid)                        // OnVehicleSpawn
{
    new tmpowner = CarsOwner[vehicleid];
    new Float:tmpx, Float:tmpy, Float:tmpz, Float:tmpang;
    GetVehiclePos(vehicleid, tmpx, tmpy, tmpz);
    GetVehicleZAngle(vehicleid, tmpang);
    if(PlayerCar[tmpowner][x] != tmpx && PlayerCar[tmpowner][y] != tmpy && PlayerCar[tmpowner][z] != tmpz && PlayerCar[tmpowner][ang] != tmpang)
    {
      DestroyVehicle(vehicleid);
      CreateVehicle(
            PlayerCar[tmpowner][model],
            PlayerCar[tmpowner][x],
            PlayerCar[tmpowner][y],
            PlayerCar[tmpowner][z],
            PlayerCar[tmpowner][ang],
            PlayerCar[tmpowner][color1],
            PlayerCar[tmpowner][color2],
            60000
        );
    }
    return 1;
}                                        //----------
makes the car spawn where it was parked after it is blown up, so I am happy :P