Tokio Posted January 3, 2018 Posted January 3, 2018 this is the code: Spoiler addEventHandler( "onClientRender", root, function ( ) local x, y, z = getElementPosition( merker1 ) local Mx, My, Mz = getCameraMatrix( ) if ( getDistanceBetweenPoints3D( x, y, z, Mx, My, Mz ) <= 30 ) then local WorldPositionX, WorldPositionY = getScreenFromWorldPosition( x, y, z +1, 0.07 ) if ( WorldPositionX and WorldPositionY ) then dxDrawRectangle(WorldPositionX -100, WorldPositionY -17, 200, 35, tocolor(0, 0, 0, 175), false) dxDrawText("Pay'n'Spray", WorldPositionX, WorldPositionY, WorldPositionX, WorldPositionY, tocolor(255, 255, 255, 255), 2, "default", "center", "center", false, false, false, false, false) dxDrawImage(WorldPositionX - 100, WorldPositionY -200, 200, 200, "paynspray.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end end end ) and the problem: if i'm far away then the dx elements will be bigger, and when i'm closer.. how to fix this? My servers: Fun: Derby(DD):
Tails Posted January 3, 2018 Posted January 3, 2018 (edited) Divide the size by the distance. For example: local d = getDistanceBetweenPoints3D(x, y, z, Mx, My, Mz); dxDrawRectangle(x, y, 500/d, 250/d); dxDrawText("Pay'n'Spray", x, y, x, y, tocolor(255,0,0), 55/d); Edited January 3, 2018 by Tails Discord: its.tails
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