Flow 17 Posted February 28, 2018 okay but i need a function which repeats very fast for speedometer e.g. so this is not a performance issue then? because it would loop the getspeed and browser.execute in a very fast way? thanks so far for your feedback Share this post Link to post Share on other sites
Flow 17 Posted February 28, 2018 Mmmh when is use this function on client side: function getSpeed() { if(mp.players.local.isInAnyVehicle(true)) { let vehicle_velocity = mp.players.local.vehicle.getVelocity(); let vehicle_speed = Math.sqrt(velocity.x * velocity.x + velocity.y * velocity.y + velocity.z * velocity.z); let vehicle_speed_converter = velocity_length * 3.6; return vehicle_speed_converter; } } And this snippet to put speed in CEF div container of my overlay: setInterval(function(){ var CurrentSpeed = getSpeed(); browser.execute('document.getElementById(\'speed\').innerHTML = \'<b>' + CurrentSpeed + '</b>\';'); }, 3000); The game crashes immediately after i join.... What's wrong with that? Share this post Link to post Share on other sites
TH3RM4L 1 Posted February 28, 2018 function showSpeed() { const player = mp.players.local; if (player.isSittingInAnyVehicle(true)) { let velocity = player.vehicle.getVelocity(); let speed = Math.sqrt(velocity.x * velocity.x + velocity.y * velocity.y + velocity.z * velocity.z); speed = Math.round(speed) mp.game.graphics.drawText(`Speed: ${speed}`, [0.825, 0.875], { font: 6, color: [255, 255, 255, 255], scale: [0.9, 0.9], outline: true }); } } mp.events.add('render', () => { showSpeed(); }); 1 Share this post Link to post Share on other sites
Flow 17 Posted March 1, 2018 Thanks for that @TH3RM4L but i am looking for a solution to display the vars in cef browser in realtime. Because i also did a Menu in cef browser which should be filled (player inventory and such). Also i can't get mp.game.graphics.drawText working to justify the text on left side. Only middle seems to work for me. Param "justify" does not exist or is ignored. Regards Share this post Link to post Share on other sites
Captien 133 Posted March 1, 2018 Just use render event which is called every frame and check if the player is in the car and get its speed. Take a look on my example native speedo resource 1 Share this post Link to post Share on other sites