toxicsmoke11 Posted July 26, 2014 Posted July 26, 2014 hi i got nametag example from wiki and trying to edit it but i got some error attempt to call local player TeamName a string value addEventHandler( "onClientRender",root, function( ) local px, py, pz, tx, ty, tz, dist px, py, pz = getCameraMatrix( ) for _, v in ipairs( getElementsByType 'player' ) do 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, false,localPlayer ) then local sx, sy, sz = getPedBonePosition( v, 5 ) local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.3 ) local x1,y1 = getScreenFromWorldPosition( sx, sy, sz + 0.35 ) local playerTeam = getPlayerTeam(localPlayer) local playerTeamName = getTeamName(playerTeam) local playerTeamColor = getTeamColor(playerTeam) local r,g,b = math.random(50,255),math.random(50,255),math.random(50,255) if x then if playerTeam then dxDrawText( getPlayerName( v ), x, y, x, y, tocolor(playerTeamColor), 0.85 + ( 15 - dist ) * 0.02, "default-bold" ) dxDrawText( playerTeamName( v ), x1, y1, x1, y1, tocolor(playerTeamColor), 0.85 + ( 15 - dist ) * 0.02, "default-bold" ) else dxDrawText( getPlayerName( v ), x, y, x, y, tocolor(r,g,b), 0.85 + ( 15 - dist ) * 0.02, "default-bold" ) dxDrawText( "Normal Player", x1, y1, x1, y1, tocolor(r,g,b), 0.85 + ( 15 - dist ) * 0.02, "default-bold" ) end end end end end end ) i dont understand the problem
Et-win Posted July 26, 2014 Posted July 26, 2014 (edited) local R, G, B = getTeamColor(playerTeam) getTeamColor returns 3 ints: Red, Green and Blue. Edited July 26, 2014 by Guest
toxicsmoke11 Posted July 26, 2014 Author Posted July 26, 2014 local R, G, B = getTeamColor(playerTeam) getTeamColor returns 3 ints: Red, Blue and Green. i dont understand how could this fix the problem with team name error?
Et-win Posted July 26, 2014 Posted July 26, 2014 Wow, I must be asleep. dxDrawText( playerTeamName, x1, y1, x1, y1, tocolor(playerTeamColor), 0.85 + ( 15 - dist ) * 0.02, "default-bold" )
toxicsmoke11 Posted July 26, 2014 Author Posted July 26, 2014 okay thanks,just one more question: why is my team drawn in black color instead of my "natural" team color? my team color is not even close to black
Et-win Posted July 26, 2014 Posted July 26, 2014 Because of what I said the first time. getTeamColor returns 3 integers. Red, Green and Blue. So, since you are only putting one variable there, it only gets red.
toxicsmoke11 Posted July 26, 2014 Author Posted July 26, 2014 i have used your 3 variables just renamed them to rr gg bb because i got r g b for random player nametag color and its still black
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