MAB Posted July 25, 2015 Posted July 25, 2015 why the script is not working?! it is client at the meta.xml sx,sy = guiGetScreenSize() x,y = (sx/1280),(sy/768) function speedometer() if isPedInVehicle(localPlayer) then local veh = getPedOccupiedVehicle (localPlayer) local sx, sy, sz = getElementVelocity ( veh ) local kphSpeed = math.ceil( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) local health = getElementHealth ( veh ) local currenthealth = math.floor( health/10 ) dxDrawRectangle(x*91, y*495, x*181, y*18, tocolor(0, 0, 0, 100), false) dxDrawRectangle(x*91, y*473, x*181, y*18, tocolor(0, 0, 0, 100), false) dxDrawRectangle(x*91, y*495, x*(181/161/0.5/2/1.5*kphSpeed), y*18, tocolor(0, 0, 255, 100), false) dxDrawRectangle(x*91, y*473, x*(currenthealth*181), y*18, tocolor(r, g, b, 100), false) if (currenthealth >= 80) then r, g, b = 0, 255, 0 elseif (currenthealth < 80 and currenthealth >= 60) then r, g, b = 150, 255, 0 elseif (currenthealth < 60 and currenthealth >= 50) then r, g, b = 255, 215, 0 elseif (currenthealth < 50 and currenthealth >= 40) then r, g, b = 255, 69, 0 elseif (currenthealth <40 and currenthealth >= 30) then r, g, b = 178, 34, 34 elseif (currenthealth < 30) then r, g, b = 50, 0, 0 end end end addEventHandler ( "onClientRender", root, speedometer )
KariiiM Posted July 25, 2015 Posted July 25, 2015 (edited) Debug errors? Edited July 25, 2015 by Guest
GTX Posted July 25, 2015 Posted July 25, 2015 sx,sy = guiGetScreenSize() x,y = (sx/1280),(sy/768) local r, g, b = 255, 255, 255 function speedometer() if isPedInVehicle(localPlayer) then local veh = getPedOccupiedVehicle (localPlayer) local sx, sy, sz = getElementVelocity ( veh ) local kphSpeed = math.ceil( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) local health = getElementHealth ( veh ) local currenthealth = math.floor( health/10 ) dxDrawRectangle(x*91, y*495, x*181, y*18, tocolor(0, 0, 0, 100), false) dxDrawRectangle(x*91, y*473, x*181, y*18, tocolor(0, 0, 0, 100), false) dxDrawRectangle(x*91, y*495, x*(181/161/0.5/2/1.5*kphSpeed), y*18, tocolor(0, 0, 255, 100), false) dxDrawRectangle(x*91, y*473, x*(currenthealth*181), y*18, tocolor(r, g, b, 100), false) if (currenthealth >= 80) then r, g, b = 0, 255, 0 elseif (currenthealth < 80 and currenthealth >= 60) then r, g, b = 150, 255, 0 elseif (currenthealth < 60 and currenthealth >= 50) then r, g, b = 255, 215, 0 elseif (currenthealth < 50 and currenthealth >= 40) then r, g, b = 255, 69, 0 elseif (currenthealth <40 and currenthealth >= 30) then r, g, b = 178, 34, 34 elseif (currenthealth < 30) then r, g, b = 50, 0, 0 end end end addEventHandler ( "onClientRender", root, speedometer )
MAB Posted July 25, 2015 Author Posted July 25, 2015 sx,sy = guiGetScreenSize() x,y = (sx/1280),(sy/768) local r, g, b = 255, 255, 255 function speedometer() if isPedInVehicle(localPlayer) then local veh = getPedOccupiedVehicle (localPlayer) local sx, sy, sz = getElementVelocity ( veh ) local kphSpeed = math.ceil( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) local health = getElementHealth ( veh ) local currenthealth = math.floor( health/10 ) dxDrawRectangle(x*91, y*495, x*181, y*18, tocolor(0, 0, 0, 100), false) dxDrawRectangle(x*91, y*473, x*181, y*18, tocolor(0, 0, 0, 100), false) dxDrawRectangle(x*91, y*495, x*(181/161/0.5/2/1.5*kphSpeed), y*18, tocolor(0, 0, 255, 100), false) dxDrawRectangle(x*91, y*473, x*(currenthealth*181), y*18, tocolor(r, g, b, 100), false) if (currenthealth >= 80) then r, g, b = 0, 255, 0 elseif (currenthealth < 80 and currenthealth >= 60) then r, g, b = 150, 255, 0 elseif (currenthealth < 60 and currenthealth >= 50) then r, g, b = 255, 215, 0 elseif (currenthealth < 50 and currenthealth >= 40) then r, g, b = 255, 69, 0 elseif (currenthealth <40 and currenthealth >= 30) then r, g, b = 178, 34, 34 elseif (currenthealth < 30) then r, g, b = 50, 0, 0 end end end addEventHandler ( "onClientRender", root, speedometer ) didn't work
GTX Posted July 25, 2015 Posted July 25, 2015 You didn't answer Kariiim his question. Are there any debug errors? Maybe it IS working but positions are messed up.
MAB Posted July 25, 2015 Author Posted July 25, 2015 You didn't answer Kariiim his question. Are there any debug errors?Maybe it IS working but positions are messed up. karim : no GTX : u gave me that x,y thing urself
KariiiM Posted July 26, 2015 Posted July 26, 2015 GTX,said he already tested it and working fine, So maybe you didn't add the client file in meta as it must be like or you added it as client and difined by server,some details like that..
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