FlyingSpoon Posted April 10, 2018 Share Posted April 10, 2018 Found this script on the net for Custom Nametags, what's wrong with it since it outputs no errors and I can't see the nametags either. addEventHandler("onClientRender",getRootElement(),function() local px,py,pz,tx,ty,tz,dist px,py,pz = getCameraMatrix() for k,v in ipairs(getElementsByType("player")) do if (v==getLocalPlayer()) then tx,ty,tz = getElementPosition(v) dist = math.sqrt((px-tx)^2 + (py-ty)^2 + (pz-tz)^2) if dist > 30.0 then if isLineOfSightClear(px,py,pz,tx,ty,tz,true,false,false,true,false,false,getLocalPlayer()) then local sx,sy,sz = getPedBonePosition(v,5) local x,y = getScreenFromWorldPosition(sx,sy,sz+0.3) if x then dxDrawText(getPlayerName(v),x,y,x,y,tocolor(150,50,0),0.85+(15-dist)*0.02,"default-bold") end end end end end end) Link to comment
Dimos7 Posted April 10, 2018 Share Posted April 10, 2018 I think need setPlayerNametagShowing Link to comment
FlyingSpoon Posted April 10, 2018 Author Share Posted April 10, 2018 That's not the problem, already tried to mess around with that function. Link to comment
Dimos7 Posted April 10, 2018 Share Posted April 10, 2018 Try put the aplha on dxtext 255 inside the tocolor Link to comment
LLCoolJ Posted April 11, 2018 Share Posted April 11, 2018 addEventHandler("onClientRender",getRootElement(),function() local px,py,pz,tx,ty,tz,dist px,py,pz = getCameraMatrix() for id,player in ipairs(getElementsByType("player")) do tx,ty,tz = getElementPosition(player) dist = math.sqrt((px-tx)^2 + (py-ty)^2 + (pz-tz)^2) if dist <= 30.0 then if isLineOfSightClear(px,py,pz,tx,ty,tz,true,false,false,true,false,false,true) then local sx,sy,sz = getPedBonePosition(player,5) local x,y = getScreenFromWorldPosition(sx,sy,sz+0.3) if x then dxDrawText(getPlayerName(player),x,y,x,y,tocolor(150,50,0),0.85+(15-dist)*0.02,"default-bold","center","center") end end end end end) 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