NickScripter Posted August 23, 2019 Posted August 23, 2019 (edited) Hello! I made a speedometer to show some vehicle parameters. however, it is lagging players when enabled. I can not find a solution. can anybody help me? This is my Client-side local rx, ry = guiGetScreenSize ( ) function vehiclestatus ( ) if ( isPedInVehicle ( localPlayer ) == false ) then return false end local x, y, z = getElementPosition( localPlayer ) local car = getPedOccupiedVehicle ( localPlayer ) local sx, sy, sz = getElementVelocity ( car ) local kphSpeed = math.ceil( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) local mphSpeed = math.ceil( ( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) / 1.61 ) local health = getElementHealth ( car ) --local name = getVehicleName ( car ) local currenthealth = math.floor( health/10 ) getElementHealth ( vehicle ) dxDrawRectangle( ( rx-205 ), ( ry-78 ), 199, 65, tocolor(0, 0, 0, 180), true) dxDrawText ( "#1e90ffVelocidade: #FFFFFF"..tostring(kphSpeed).." Kmh / "..tostring(mphSpeed).." Mph", ( rx - 199 ), ( ry - 77 ), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1,"default-bold", "left", "top", false, false, true, true, false ) dxDrawText ( "#1e90ffDurabilidade: #FFFFFF"..tostring(currenthealth).."/100", ( rx - 199 ), ( ry - 53 ), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1,"default-bold", "left", "top", false, false, true, true, false ) dxDrawText ( "#1e90ffLocalidade: #FFFFFF" .. getZoneName(x, y, z), (rx - 199 ), ( ry - 29), 1280, 887, tocolor ( 255, 255, 255, 255 ), 1, "default-bold", "left", "top", false, false, true, true, false ) end addEventHandler ( "onClientRender", root, vehiclestatus ) Edited August 23, 2019 by Nickqq
Moderators IIYAMA Posted August 23, 2019 Moderators Posted August 23, 2019 @Nickqq Line 14, might show a warning every frame. It also has no purpose, so feel free to remove it. Can you show me the debugconsole?
NickScripter Posted August 23, 2019 Author Posted August 23, 2019 5 hours ago, IIYAMA said: @Nickqq Line 14, might show a warning every frame. It also has no purpose, so feel free to remove it. Can you show me the debugconsole? It worked! How did I not realize that ?! hahaha Thank you so much! 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now