Jump to content

[Question] Arrow


XML

Recommended Posts

hello

i'm making an arrow that follows the front of the rectangle.

but the problem is, it's working fine to me and it follows the front of it with no problems

but the other players not seeing the arrow in the right position

they see it in another position.

 

Code:

local screenW, screenH = guiGetScreenSize ()

addEventHandler ("onClientRender", root,
    function ()
        local veh = getPedOccupiedVehicle (localPlayer)
        if (veh) then
            local hp = math.floor (getElementHealth (veh) / 10) 
            local calcule_hp = (screenW * 0.9114) + (hp / 100 * screenW * 0.0805) - (screenW - 2995 * 0.9070 / 2)
            dxDrawRectangle (screenW * 0.9114, screenH * 0.9323, hp / 100 * screenW * 0.0805, screenH * 0.0117, tocolor (7, 247, 142, 209), false)
            dxDrawText ("HP: " .. hp .. "%", screenW * 0.8638, screenH * 0.9310, screenW * 0.8997, screenH * 0.9505, tocolor (7, 247, 142, 255), 1.00, "default", "center", "top", false, false, false, false, false)
            dxDrawImage (calcule_hp, screenH * 0.9206, screenW * 0.0095, screenH * 0.0117, "Images/arrow.png", 0, 0, 0, tocolor (255, 255, 255, 255), false)
        end
    end
)

 

So any help please ?

Edited by XML
Link to comment
  • Scripting Moderators

local calcule_hp = (screenW * 0.9114) + (hp / 100 * screenW * 0.0805) - (screenW - 2995 * 0.9070 / 2)

 

Improve this. There will be problems with different resolutions.

Edited by thisdp
Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...