HG Snuuk Posted September 4, 2019 Posted September 4, 2019 opa tudo bom ? , eu queria saber pq esta aparecendo o nome sendo que era pra aparecer o id do jogador que esta falando script do < voice > local g_screenX,g_screenY = guiGetScreenSize() local BONE_ID = 8 local WORLD_OFFSET = 0.4 local ICON_PATH = "images/voice.png" local ICON_WIDTH = 0.35*g_screenX -- local ICON_HEIGHT = 0.213333333333*g_screenY -- local iconHalfWidth = ICON_WIDTH/2 -- local iconHalfHeight = ICON_HEIGHT/2 local ICON_DIMENSIONS = 16 local ICON_LINE = 20 local ICON_TEXT_SHADOW = tocolor ( 0, 0, 0, 255 ) --Draw the voice image addEventHandler ( "onClientRender", root, function() local index = 0 if not bShowChatIcons then return end for player in pairs(voicePlayers) do local color = tocolor(255, 255, 255) dxDrawVoiceLabel ( player, index, color ) index = index + 1 while true do --is he streamed in? if not isElementStreamedIn(player) then break end --is he on screen? if not isElementOnScreen(player) then break end local headX,headY,headZ = getPedBonePosition(player,BONE_ID) headZ = headZ + WORLD_OFFSET --is the head position on screen? local absX,absY = getScreenFromWorldPosition ( headX,headY,headZ ) if not absX or not absY then break end local camX,camY,camZ = getCameraMatrix() --is there anything obstructing the icon? if not isLineOfSightClear ( camX, camY, camZ, headX, headY, headZ, true, false, false, true, false, true, false, player ) then break end dxDrawVoice ( absX, absY - 2, color, getDistanceBetweenPoints3D(camX, camY, camZ, headX, headY, headZ) ) break end 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, tocolor(255, 255, 255, 195), false ) end function dxDrawVoiceLabel ( player, index, color ) local sx, sy = guiGetScreenSize () local scale = sy / 800 local spacing = ( ICON_LINE * scale ) local px, py = sx - 200, sy * 0.7 + spacing * index local icon = ICON_DIMENSIONS * scale dxDrawImage ( px, py, icon, icon, ICON_PATH, 0, 0, 0, tocolor(255, 255, 255, 195), false ) px = px + spacing -- text local ID = getElementData(player, "ID") or "N/A" local w = dxGetTextWidth(ID, 0.1, "default-bold") local h = dxGetFontHeight(1, "default-bold") dxDrawText ( getPlayerName ( player ), px, py, px, py, tocolor(255, 255, 255, 195), 1.00, "default-bold", "left", "top", false, false, false, true, false) end
Moderators Lord Henry Posted September 4, 2019 Moderators Posted September 4, 2019 Linha 73. Troque o getPlayerName (player) por ID. 1 Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment Discord Oficial do MTA: https://mtasa.com/discord Blacklist e Whitelist de Scripters: Planilha Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.
HG Snuuk Posted September 4, 2019 Author Posted September 4, 2019 (edited) 16 minutes ago, Lord Henry said: Linha 73. Troque o getPlayerName (player) por ID. -- text local ID = getElementData(player, "ID") or "N/A" local w = dxGetTextWidth(ID, 0.1, "default-bold") local h = dxGetFontHeight(1, "default-bold") dxDrawText ( ID ), px, py, px, py, tocolor(255, 255, 255, 195), 1.00, "default-bold", "left", "top", false, false, false, true, false) end troquei aki porem não aparece mais nem o nome e nem o id do jogador debugscript esta assim , : ERROR: Loading script falied: s-voice\cDrawIcon.Lua:73:unexpected Symbol near ',' Edited September 4, 2019 by HG Snuuk
tommy2223 Posted September 4, 2019 Posted September 4, 2019 31 minutes ago, HG Snuuk said: -- text local ID = getElementData(player, "ID") or "N/A" local w = dxGetTextWidth(ID, 0.1, "default-bold") local h = dxGetFontHeight(1, "default-bold") dxDrawText ( ID ), px, py, px, py, tocolor(255, 255, 255, 195), 1.00, "default-bold", "left", "top", false, false, false, true, false) end troquei aki porem não aparece mais nem o nome e nem o id do jogador debugscript esta assim , : ERROR: Loading script falied: s-voice\cDrawIcon.Lua:73:unexpected Symbol near ',' "..ID.." 1 Eu te ajudei? deixe seu Thanks
DNL291 Posted September 4, 2019 Posted September 4, 2019 dxDrawText ( ID ), px, py, px, py, tocolor(255, 255, 255, 195), 1.00, "default-bold", "left", "top", false, false, false, true, false) Remova o parentese depois de "ID". 1 Please do not PM me with scripting related question nor support, use the forums instead.
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