Jump to content
Mebeover

Limiting a player vehicle speed

Recommended Posts

Hey I'm attempting to limit the speed of 4 vehicles driven by players to 65km/h. Quite new to scripting, so atm am using a piece of code from reddit /u/kevo916 that doesn't quite achieve the intended effect. Instead of not allowing the car to go above 65, once it hits 65 the speed locks to around 260 regardless of input. 

 

onEachFrame {
    _vel = velocity car1;
    if (vectorMagnitude _vel > 4 and {isTouchingGround car1}) then {
        _vel = _vel apply {_x * -1};
        _vel = _vel vectorMultiply 50;
        car1 addForce [_vel,[0,0,0]];
    };
};

Could someone show me the error in this script, or point me in the right direction to achieve my desired outcome?

Share this post


Link to post
Share on other sites

i wrote and tested the script in above post. Should work for you.

Share this post


Link to post
Share on other sites
6 hours ago, sarogahtyp said:

i wrote and tested the script in above post. Should work for you.


This works perfectly, thanks

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×