Jump to content

Help Pleas


Lachuks

Recommended Posts

Posted

I am scripting beginer and dont know why its dont work.

local screenX, screenY = guiGetScreenSize () 
function leaderText(marker) 
    local xm,ym,zm = getElementPosition(marker) 
    local x,y = getScreenFromWorldPosition(xm,ym,zm+0.2) 
    local camX,camY,camZ = getCameraMatrix() 
        if (x and y and getDistanceBetweenPoints3D(camX, camY, camZ, xm,ym,zm) <= 20) then 
           dxDrawText ("Hello", x,y,x,y, tocolor (255,0, 0, 255) , ( screenX / 1440 ) * 2 , "default-bold" , "center" , "center" , false , true , false ) 
    end 
end 
addCommandHandler ("Hello", leaderText) 

Posted

Simply because marker it's not defined in your code.

this how you can fix it .

  
local screenX, screenY = guiGetScreenSize () 
local marker = createMarker ( x, y, z, "cylinder", 1.5, 255, 255, 0, 170 ) 
  
function leaderText() 
    local xm,ym,zm = getElementPosition(marker) 
    local x,y = getScreenFromWorldPosition(xm,ym,zm+0.2) 
    local camX,camY,camZ = getCameraMatrix() 
        if (x and y and getDistanceBetweenPoints3D(camX, camY, camZ, xm,ym,zm) <= 20) then 
           dxDrawText ("Hello", x,y,x,y, tocolor (255,0, 0, 255) , ( screenX / 1440 ) * 2 , "default-bold" , "center" , "center" , false , true , false ) 
    end 
end 
addEventHandler ("onClientPreRender", root,leaderText) 

Posted
I put it in and dont work :(

75slspbwsp5xfxgb3jy0.png

lol you need to add the marker coordination x , y , z

local marker = createMarker ( x, y, z, "cylinder", 1.5, 255, 255, 0, 170 ) 

Posted

I want for marker be up player head and text under it... I make like duty script where you say aduty and you ahve godmode...

its like say aduty and on head marker and text Admin OnDuty... (sorry for bad english)

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