Jump to content

staff tag


Stevenn

Recommended Posts

i tried to make a staff tag script but it doesn't work..

function staffTag() 
local maxrange = 123 
    scx,scy = getScreenFromWorldPosition (x,y,z) 
    local x, y, z = getElementPosition ( localPlayer ) 
        local camX,camY,camZ = getCameraMatrix() 
            if scx and scy and getDistanceBetweenPoints3D(camX,camY,camZ,x,y,z+5) <= maxrange then  
        dxDrawText("Staff",x, y, z,tocolor(255,255,255,255),1.0,"bankgothic","left","top",false,false,false) 
        end 
end 
addEventHandler ( "onClientRender", root, staffTag )   

what is wrong?

Link to comment
Guest Guest4401
    scx,scy = getScreenFromWorldPosition (x,y,z) 
    local x, y, z = getElementPosition ( localPlayer ) 

You are trying to get screen position before getting the player's position.

If you didn't define x,y,z anywhere else, then these will be nil and give you an error.

Link to comment

I'd rather like to know, what is right? You use x, y and z before getting the position of player, so you're passing nil values to getScreenFromWorldPosition. You also use those variables in dxDrawText, but they're coordinates in GTA world, and dxDrawText needs on-screen coordinates.

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