Moving a vehicle forwards -
Luis- - 31.07.2013
Hey! I'm creating a system, where I need a vehicle to go forwards a little, like it's stopping somewhere, there is no driver so I need it to look like someone is driving it. I know i'd use SetVehicleVelocity, i'm just no good with angles and floats.
Thanks.
Re: Moving a vehicle forwards -
S0n1COwnsYou - 31.07.2013
not perfect, but...
pawn Код:
new Float:Distance = 1.0;
new Float:Position[3];
new Float:Rotation;
GetVehiclePos(VehicleID, Position[0], Position[1], Position[2]);
GetVehicleZAngle(VehicleID, Rotation);
Position[0] += (Distance * floatsin(-Rotation, degrees));
Position[1] += (Distance * floatcos(-Rotation, degrees));
SetVehiclePos(VehicleID Position[0], Position[1], Position[2]);
Re: Moving a vehicle forwards -
Luis- - 31.07.2013
That's not really what I need to suffice the system I am making. It involves a Taxi being sent to a destination and upon arrival it actually looks like it has driven there and is slowing down to a dead stop.
Re: Moving a vehicle forwards -
S0n1COwnsYou - 31.07.2013
look like you need to record a NPC and play it
Re: Moving a vehicle forwards -
Luis- - 31.07.2013
No, I don't need an NPC, I don't want to use any player slots for an NPC that probably wont be used as much. I know it's possible.
Re: Moving a vehicle forwards -
cessil - 31.07.2013
Important Note: This function has no affect on un-occupied vehicles and does not affect trains.
https://sampwiki.blast.hk/wiki/SetVehicleVelocity
Re: Moving a vehicle forwards -
Luis- - 31.07.2013
The vehicle won't be un-occupied, probably should of noted that, there will be a passenger inside the vehicle. I'm trying to get something like, in Vice City when you fail a mission and the Taxi appears outside the Hospital, when you enter that Taxi, you end up moving forward before the black screen fades in.
Re: Moving a vehicle forwards -
[HiC]TheKiller - 31.07.2013
Then SetVehicleVelocity would be the way to go. If you're unsure on how to use the function, take a look through a load of vehicle boost scripts and you may get some idea how it works.
Re: Moving a vehicle forwards -
Luis- - 07.08.2013
I've had a look through some of the vehicle boost functions, but I cannot seem to find a way to do it. Most boost systems make the vehicle go faster, I need it to sort of slow down to a stop.
Re: Moving a vehicle forwards -
Edix - 07.08.2013
Quote:
Originally Posted by Luis-
I've had a look through some of the vehicle boost functions, but I cannot seem to find a way to do it. Most boost systems make the vehicle go faster, I need it to sort of slow down to a stop.
|
For that you will need to make some calculations like the closer you are to the point the slower the car will move.
Hope this kinda helpd you.