SA-MP Forums Archive
Need help on CreateVehicle - 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: Need help on CreateVehicle (/showthread.php?tid=163292)



Need help on CreateVehicle - DragonBlaster50 - 26.07.2010

Hey guys, i was working on a small script again, but i pretty much forgot what i learned, So heres the problem.

I wanna use CreateVehicle, but i forgot how to define it (like, new Car on top of the script, then Car = createvehicle etc etc)

but i cant get it working, can someone give me a small (very small) tutorial or something on what to do?


Re: Need help on CreateVehicle - iggy1 - 26.07.2010

https://sampwiki.blast.hk/wiki/CreateVehicle

you dont need to make new variables just use the function.


Re: Need help on CreateVehicle - willsuckformoney - 26.07.2010

copy from wiki

pawn Код:
public OnGameModeInit( )
{
    // Add a Hydra to the game with a respawn time of 60 seconds
    CreateVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, 60);
    return 1;
}



Re: Need help on CreateVehicle - DragonBlaster50 - 26.07.2010

yeah, but how am i supposed to use DestroyVehicle now?


Re: Need help on CreateVehicle - iggy1 - 26.07.2010

In that case

At top of script underneath defines
pawn Код:
new veh1;
pawn Код:
public OnGameModeInit( )
{
    // Add a Hydra to the game with a respawn time of 60 seconds
    veh1 = CreateVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, 60);
    return 1;
}
wherever u need to destroy
pawn Код:
DestroyVehicle(veh1);



Re: Need help on CreateVehicle - DragonBlaster50 - 26.07.2010

Works now! thank you.


Re: Need help on CreateVehicle - iggy1 - 26.07.2010

Dont forget if you pass the last parameter -1.
eg,
pawn Код:
CreateVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, -1);//notice -1 at the end
The vehicle wont respawn when its destroyed, might save you from using DestroyVehicle when you might not need to.

And yw m8.


Re: Need help on CreateVehicle - DragonBlaster50 - 27.07.2010

Quote:
Originally Posted by iggy1
Посмотреть сообщение
Dont forget if you pass the last parameter -1.
eg,
pawn Код:
CreateVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, -1);//notice -1 at the end
The vehicle wont respawn when its destroyed, might save you from using DestroyVehicle when you might not need to.
I must destroy it in the system since Its only for OnPlayerRequestClass background