Lyra Posted October 20, 2019 Share Posted October 20, 2019 (edited) Boa noite. Estou tentando melhorar um sistema de voz de mta parecido com o FIVE M. Ele está funcionando tudo, exceto o circulo abaixo do personagem. O circulo so aparece no meu personagem, seja eu falando ou outros mas apenas eu vejo o circulo. O mesmo acontece com os outros jogadores, apenas eles veem o circulo no personagens deles quando ele ou alguém aciona o microfone. Gostaria de uma luz se possível. Quando utilizo as imagens, não tenho esse problema, cada um fica com sua imagem acionada. Apenas o circulo esta com problemas. Obrigado! Código: local g_screenX,g_screenY = guiGetScreenSize() local BONE_ID = 8 local WORLD_OFFSET = 0.4 local ICON_PATH = "voice.png" local ICON_WIDTH = 0.10*g_screenX local iconHalfWidth = ICON_WIDTH/2 local ICON_DIMENSIONS = 16 local ICON_LINE = 20 local ICON_TEXT_SHADOW = tocolor ( 0, 0, 0, 255 ) addEventHandler ( "onClientRender", root, function() local index = 0 if not bShowChatIcons then return end for player in pairs(voicePlayers) do local color = tocolor(getPlayerNametagColor ( player )) dxDrawVoiceLabel ( player, index, color ) circulo ( player, index, color ) index = index + 1 while true do if not isElementStreamedIn(player) then break end if not isElementOnScreen(player) then break end local headX,headY,headZ = getPedBonePosition(player,BONE_ID) headZ = headZ + WORLD_OFFSET local absX,absY = getScreenFromWorldPosition ( headX,headY,headZ ) if not absX or not absY then break end local camX,camY,camZ = getCameraMatrix() if not isLineOfSightClear ( camX, camY, camZ, headX, headY, headZ, true, false, false, true, false, true, false, player ) then break end dxDrawVoice ( absX, absY, color, getDistanceBetweenPoints3D(camX, camY, camZ, headX, headY, headZ) ) break end end end ) function dxDrawCircle3D( x, y, z, radius, segments, color, width ) segments = segments or 16; width = width or 1; local segAngle = 360 / segments; local fX, fY, tX, tY; for i = 1, segments do fX = x + math.cos( math.rad( segAngle * i ) ) * radius; fY = y + math.sin( math.rad( segAngle * i ) ) * radius; tX = x + math.cos( math.rad( segAngle * (i+1) ) ) * radius; tY = y + math.sin( math.rad( segAngle * (i+1) ) ) * radius; dxDrawLine3D( fX, fY, z, tX, tY, z, color, width ); end end function dxDrawVoice ( posX, posY, color, distance ) distance = 1/distance dxDrawImage ( posX - iconHalfWidth*distance, posY - iconHalfWidth*distance, ICON_WIDTH*distance, ICON_WIDTH*distance, ICON_PATH, 0, 0, 0, color, false ) end function dxDrawVoiceLabel ( player, index, color ) local sx, sy = guiGetScreenSize () local scale = sy / 800 local spacing = ( ICON_LINE * scale ) local px, py = sx - 300, sy * 0.7 + spacing * index local icon = ICON_DIMENSIONS * scale dxDrawImage ( px, py, ICON_PATH, 0, 0, 0, color, false ) px = px + spacing x, y, z = getElementPosition(getLocalPlayer()) dxDrawCircle3D( x, y, z -0.7, 0.5, 30, tocolor( 0, 186, 235 ),9) end Edited October 20, 2019 by Lyra 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