Need help on CreateVehicle
#1

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?
Reply
#2

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

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

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;
}
Reply
#4

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

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);
Reply
#6

Works now! thank you.
Reply
#7

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.
Reply
#8

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
Reply


Forum Jump:


Users browsing this thread: