cedee Posted March 9, 2014 Share Posted March 9, 2014 function showClientImage1() guiCreateStaticImage( 0, 0, 2000, 25, "bg.png", false ) end addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), showClientImage1 ) function showClientImage2() guiCreateStaticImage( 8,5, 1005, 14, "bar.png", false ) end addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), showClientImage2 ) function vehicleHealth() local vehicle = getPedOccupiedVehicle( localPlayer ) if ( vehicle ) then local vehicleHealth = getElementHealth( vehicle ) local scx, scy = guiGetScreenSize() --debug test = dxDrawText( ( math.floor( vehicleHealth ) ), scx - 125,scy - 70,scx,scx,tocolor(255,255,255,255),0.9, "arial","center","top",false,false,false) --debug end Image = guiCreateStaticImage( 10, 7, math.floor( vehicleHealth ) , 10, "barprogress.png", false ) end end addEventHandler("onClientRender", root, vehicleHealth) Lagg cause, and doesn't work it.. when i restart script then refresh the healt-data and resize the "barprogress.png".. if goes down my hp then don't refresh the healt-data and resize the "barprogress.png" (sry for my bad english ) Link to comment
Saml1er Posted March 9, 2014 Share Posted March 9, 2014 Why are you using 2 same event handlers? addEventHandler("onClientRender", root, function () local vehicle = getPedOccupiedVehicle( localPlayer ) if ( vehicle ) then local vehicleHealth = getElementHealth( vehicle ) local scx, scy = guiGetScreenSize() dxDrawText( ( math.floor( vehicleHealth ) ).." %", scx - 125,scy - 70,scx,scx,tocolor(255,255,255,255),0.9, "arial","center","top",false,false,false) end end ) Link to comment
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