Jump to content

Painel ao clicar no Ped


Recommended Posts

Posted
for i = 1, #peds do 
	ped = createPed(peds[i][1], peds[i][3], peds[i][4], peds[i][5]) 
	setElementRotation(ped, 0, 0, peds[i][6]) 
	setElementData(ped, "name", peds[i][2], true)
	setElementInterior (ped, 6)
	setElementDimension (ped, 90)
	setPedAnimation ( ped, "ped", "IDLE_CHAT", 1 )
end

function clickPed(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) 
	if (clickedElement) and (getElementType(clickedElement) == "ped" ) then 
        local x, y, z = getElementPosition(getLocalPlayer()) 
        local wx, wy, wz = getElementPosition(clickedElement) 
        local jij = getLocalPlayer() 
        if (getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3) and (button == "left") and (state == "down" ) then              
			local ped = getElementData(clickedElement, "name") 
			if (ped=="John") then 
				Dx_Posto ()
			end
		end
	end
end 
addEventHandler("onClientClick", getRootElement(), clickPed, true) 

Bom eu coloquei isso, e está tudo funcional porém ao clicar no ped o painel "Dx_Posto" aparece e some no mesmo instante. Gostaria de solicitar ajuda.

  • Moderators
Posted

Painéis em DX precisam ser ativados com um evento onClientRender para se manterem visíveis na tela.

Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanksspacer.png

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...