Turbe$Z Posted April 16, 2017 Posted April 16, 2017 (edited) function text_render ( ) for i,v in pairs ( messages ) do local x, y, z = unpack ( v ) local sx, sy, _ = getScreenFromWorldPosition ( x, y, z ) if sx then dxDrawText ( i, sx+2, sy+2, sw, sh, tocolor ( 0, 0, 0, 255 ), 2.0, "default-bold" ) dxDrawText ( i, sx, sy, sw, sh, tocolor ( 0, 136, 255, 255 ), 2.0, "default-bold" ) end end end addEventHandler("onClientRender",getRootElement(),text_render) i want set max distance for this, but how? Edited April 16, 2017 by Turbo777
Moderators IIYAMA Posted April 16, 2017 Moderators Posted April 16, 2017 local cameraX, cameraY, cameraZ = getCameraMatrix () for i,v in pairs ( messages ) do local x, y, z = unpack ( v ) if getDistanceBetweenPoints3D (cameraX, cameraY, cameraZ, x, y, z ) < 100 then local sx, sy = getScreenFromWorldPosition ( x, y, z ) if sx then dxDrawText ( i, sx+2, sy+2, sw, sh, tocolor ( 0, 0, 0, 255 ), 2.0, "default-bold" ) dxDrawText ( i, sx, sy, sw, sh, tocolor ( 0, 136, 255, 255 ), 2.0, "default-bold" ) end end end If you also want to scale the text according to the REAL distance, see:
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