aka Blue Posted March 10, 2017 Posted March 10, 2017 Buenas, estoy realizando unos nametags y tengo un problema. Resulta que quiero hacer que se centre el texto pero no consigo hacerlo, se va a otras posiciones y si lo cambio mediante sumas o restas, el otro jugador no lo ve correctamente. ¿Cómo podría arreglarlo? Gracias de antemano: addEventHandler( "onClientRender", root, function( ) local cx, cy, cz = getCameraMatrix( ) local lx, ly, lz = getElementPosition( localPlayer ) local jugadores = getElementsByType( 'player' ) for i=1, #jugadores do local p = jugadores[i] --if players[ p ] then local x, y, z = getElementPosition( p ) local dist = getDistanceBetweenPoints3D( lx, ly, lz, x, y, z ) if dist < 15 then if isLineOfSightClear( lx, ly, lz, x, y, z, true, false, false, true, false, false, false, localPlayer ) then local name = getPlayerName( p ) local bone = { getPedBonePosition( p, 5 ) } local c = { getScreenFromWorldPosition( bone[1], bone[2], bone[3]+0.3 ) } if c[1] and c[2] then dxDrawText( name, c[1]-5, c[2]+1, 0, 0, tocolor( 0, 0, 0 ), 1, font ) dxDrawText( name, c[1]-5, c[2], 0, 0, tocolor( 255, 145, 0 ), 1, font ) end end end --end end end )
Arsilex Posted March 10, 2017 Posted March 10, 2017 (edited) addEventHandler( "onClientRender", root, function() local cx, cy, cz = getCameraMatrix() local lx, ly, lz = getElementPosition( localPlayer ) local jugadores = getElementsByType( "player" ) for i=1, #jugadores do local p = jugadores[i] --if players[ p ] then local x, y, z = getElementPosition( p ) local dist = getDistanceBetweenPoints3D( lx, ly, lz, x, y, z ) if dist < 15 then if isLineOfSightClear( lx, ly, lz, x, y, z, true, false, false, true, false, false, false, localPlayer ) then local name = getPlayerName( p ) local bone = { getPedBonePosition( p, 5 ) } local c = { getScreenFromWorldPosition( bone[1], bone[2], bone[3]+0.3 ) } if c[1] and c[2] then dxDrawText(name, c[1], c[2], c[1], c[2], tocolor( 0, 0, 0 ), 1, font, "center", "center") dxDrawText(name, c[1], c[2], c[1], c[2], tocolor( 255, 145, 0 ), 1, font, "center", "center") end end end --end end end) Y si realmente quieres recibir los valores como array te sugiero usar OOP ya que te devuelve esos valores en forma de Vector3 Edited March 10, 2017 by Arsilex
Recommended Posts