-.Paradox.- Posted October 10, 2013 Share Posted October 10, 2013 Hello im asking for some useful functions to attach a text to marker thanks for helping Link to comment
myonlake Posted October 10, 2013 Share Posted October 10, 2013 getScreenFromWorldPosition dxDrawText getElementPosition getElementInterior getElementDimension getDistanceBetweenPoints3D Link to comment
-.Paradox.- Posted October 10, 2013 Author Share Posted October 10, 2013 Thanks I made it and it work perfectly. Link to comment
-.Paradox.- Posted October 10, 2013 Author Share Posted October 10, 2013 (edited) I tried to do same thing with ped but i can't see the text here is the code local rootElement = getRootElement() local PED = createPed( 179, -1621.07922, 666.60632, -4.90625 ) local screenWidth, screenHeight = guiGetScreenSize() local maxrange = 45 function PEDnametag() local pedX,pedY,pedZ = getElementPosition(PED) local sx,sy = getScreenFromWorldPosition (pedX,pedY,pedZ) local cameraX,cameraY,cameraZ = getCameraMatrix() if sx then if getDistanceBetweenPoints3D(cameraX,cameraY,cameraZ,pedX,pedY,pedZ) <= maxrange then dxDrawText("Bob",sx,sy,screenWidth, screenHeight,tocolor ( 255, 255, 0, 255 ), 2,"sans") end end end function HandleTheRendering() addEventHandler("onClientRender",rootElement, PEDnametag) end addEventHandler("onClientResourceStart",rootElement, HandleTheRendering) Edited October 11, 2013 by Guest Link to comment
.:HyPeX:. Posted October 10, 2013 Share Posted October 10, 2013 adding to what prestege said, where are you defining from whom you are getting the camera matrix? local cameraX,cameraY,cameraZ = getCameraMatrix() if sx then if getDistanceBetweenPoints3D(cameraX,cameraY,cameraZ,pedX,pedY,pedZ) <= maxrange then Link to comment
myonlake Posted October 11, 2013 Share Posted October 11, 2013 adding to what prestege said, where are you defining from whom you are getting the camera matrix? local cameraX,cameraY,cameraZ = getCameraMatrix() if sx then if getDistanceBetweenPoints3D(cameraX,cameraY,cameraZ,pedX,pedY,pedZ) <= maxrange then It's used client-side so it checks it from the player that wants to see the text over his friend. 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