SidneiJR Posted June 13, 2018 Posted June 13, 2018 Estou desenvolvendo um script de dominação de territórios, nele gostaria de adicionar um texto contendo quem dominou aquele território. Exemplo: Imagem Sei que tenho que utilizar (setElementData, getElementData e setTimer), porém não achei uma forma de encaixar o getElementData no dxDrawText para mostrar o nick do jogador.
Moderators Lord Henry Posted June 13, 2018 Moderators Posted June 13, 2018 (edited) dxDrawText ("Área dominada por: "..tostring (getElementData (theMarker, "theData"))) Edited June 13, 2018 by Lord Henry 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.
SidneiJR Posted June 13, 2018 Author Posted June 13, 2018 O marker se encontra do lado Server, qual a melhor forma de fazer essa verificação? Ou seria melhor passar o script para o lado Client?
Moderators Lord Henry Posted June 13, 2018 Moderators Posted June 13, 2018 Tem 2 jeitos, ou vc passa o elemento do marker por um triggerClientEvent. Ou vc apenas seta a coordenada do texto no client, sem ser anexado ao marker. 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.
SidneiJR Posted June 13, 2018 Author Posted June 13, 2018 Tentei da primeira forma, mas não obtive exito. O texto é independente do marker: function texto() if ( getDistanceBetweenPoints3D ( 2454.69, -913.07, 115.17, getElementPosition ( localPlayer ) ) ) < 20 then local coords = { getScreenFromWorldPosition ( 2454.69, -913.07, 115.17 ) } if coords[1] and coords[2] then dxDrawText("Area dominada por: N/A", coords[1], coords[2], coords[1], coords[2], tocolor(255, 255, 255, 255), x*1.20, "default-bold", "center", "center", false, false, false, true, false) end end end addEventHandler("onClientRender", root, texto)
Moderators Lord Henry Posted June 13, 2018 Moderators Posted June 13, 2018 1 hour ago, SidneiJR said: O texto é independente do marker: Então faça da segunda forma. 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.
SidneiJR Posted June 20, 2018 Author Posted June 20, 2018 Tentei as 2 maneiras, o @DNL291 me ajudou na segunda forma, mas não obtive sucesso. Decidi por deixar essa ideia de lado, obrigado @Lord Henry pela ajuda.
androksi Posted June 20, 2018 Posted June 20, 2018 Desculpe reviver este tópico, mas o que você precisa pra fazer isso é bem simples. - Quando o jogador dominar aquele território, use: setElementData para salvar o nickname do jogador. Exemplo: setElementData(marker, "playerName", tostring(getPlayerName(player))) - Já no client-side, você deve fazer isto: function test() for _, marker in pairs(getElementsByType("marker")) do local playerName = getElementData(marker, "playerName") if (playerName) then local mx, my, mz = getElementPosition(marker) if (getDistanceBetweenPoints3D(mx, my, mz, getElementPosition (localPlayer))) < 20 then local coords = {getScreenFromWorldPosition(mx, my, mz)} if coords[1] and coords[2] then dxDrawText("Area dominada por: "..playerName, coords[1], coords[2], coords[1], coords[2], tocolor(255, 255, 255, 255), x*1.20, "default-bold", "center", "center", false, false, false, true, false) end end end end end addEventHandler("onClientPreRender", root, test) 1 Hello, world. Tutorial sobre interação de BOTs do Discord com o seu servidor - Visitar (Brazilian Portuguese) Tutorial sobre tabelas - Visitar (Brazilian Portuguese) Tutorial sobre banco de dados - Visitar (Brazilian Portuguese)
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