Jump to content

Attach a text to a marker


-.Paradox.-

Recommended Posts

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 by Guest
Link to comment
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

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...