Sign in to follow this  
Freamee

Get approx. players entity.speed()

Recommended Posts

The title contains the question.

I want to create a trafipax via clientside, because i dont want to make the server tick every ms to get player speeds.

My code:

// TRAFIPAX
global.player = mp.players.local;
    if(player.getVariable("Trafipax") == true)
    {
        let mypos = player.position;
        mp.players.forEachInStreamRange((p=> {
 
            let dist = mp.game.gameplay.getDistanceBetweenCoords(mypos.xmypos.ymypos.zp.position.xp.position.yp.position.ztrue);
            if(dist < 25)
            {
                let vehicle = p.vehicle;
                let speed = vehicle.getSpeed();
                speed = Math.ceil(speed * (speed / 20) * 2);
 
                if(speed > player.getVariable("TrafipaxSeb"))
                {
                    mp.events.callRemote("trafiCatch"p.remoteId);
                }
            }
        });
    }

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.