Moving a vehicle forwards
#1

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

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

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

look like you need to record a NPC and play it
Reply
#5

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

Important Note: This function has no affect on un-occupied vehicles and does not affect trains.

https://sampwiki.blast.hk/wiki/SetVehicleVelocity
Reply
#7

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

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

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)