Jump to content

[HELP] i have problem with positions


^_^ LOL ^_^

Recommended Posts

That's because you're using absolute coordinates for the screen position . You need to make them relative .

Since you're using DX - functions ( which can only have absolute values as coordinates ), I would do something like this :

local position_x, position_y = 0.05, 0.05  
-- set the position in relative coordinates, then convert the coordinates to absolute . 
function RelativeToabsolute( x, y ) 
    if type( x ) ~= "number" or type( y ) ~= "number" then return false end 
    local screen = { guiGetScreenSize( ) } 
    x = x * screen[1] 
    y = y * screen[2] 
    return x, y 
end 
  
function dx_draw( ) 
    local x, y = RelativeToabsolute( position_x, position_y ) 
    dxDrawText( "Hello", x, y, ... ) 
end 
addEventHandler( "onClientRender", root, dx_draw ) 

Edited by Guest
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...