Vehicle velocity
#1

Greetings i have a question about the SetVehicleVelocity.

Let just said that infernus top speed in game is 123km/h

In which SetVehicleVelocity(vehicleid, x, y, z); X Y or Z that can add 1 speed to infernus to be 124km/h?

Also how can we set it to auto mod without having using OnPlayerKeyStateChange to have 1 speed added?

Example, we keep driving without having to press any key to reach 124km/h, it will automatically 124 by it self.

Any ideas?
Reply
#2

1. Velocity setting is not bound to anything except the air friction and maybe the integer variable capacity.
2. The thing you're about to do is to increase the maximum speed of a vehicle, which cannot be done from the server side.
3. But still, you can speed up the vehicle when it reaches 123 km/h, imagine we have a timer which calls the function "ProcessVehicleVelocity":
PHP код:
public ProcessVehicleVelocity(vehicleid)
{
      new 
Float:xvFloat:yvFloat:zv;
      
GetVehicleVelocity(vehicleidxvyvzv);
      new 
Float:tv sqrt(floatpower(xv2.0) + floatpower(yv2.0) + floatpower(zv2.0)); // some triangular equations
      
if (tv 120.00SetVehicleVelocity(vehicleidxv 1.0yv 1.0zv 1.0); // however this might add more than 1 km/h

Hope it helped ^^
Reply
#3

Velocity doesn't really work like that. You can only really multiply the current velocity. In your case you want the vehicle to be 1/124th (0.8%) faster, so try multiplying by 1.008 .
Reply
#4

So, it means that it give more speed than 1? If you didn't multiply?
Reply
#5

You have to multiply or divide to increase velocity!
Reply
#6

Is there an example that you can show me a bit? I need a little bit more detailed.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)