Jump to content

PAINEL NAO ABRE


Recommended Posts

Posted
local NpcS = {
	{-2407.79517, -594.04980, 132.64844, 90},
	{877.59118652344, -1420.6951904297, 13.478086471558, 90},
	{2153.3666992188, -1451.8227539063, 24.5390625, 0},
	{2089.4887695313, -1279.0625, 24.502468109131, 0},
	{2231.7917480469, -1280.080078125, 24.3671875, 0},
}

for i, v in ipairs(NpcS) do
	local ped = createPed(25, v[1], v[2], v[3], 0, 0, v[4])
	setElementFrozen(ped, true)
    setElementData(ped, 'ped->gangNPC', true)
end

function openGang(button, state, xx, yy, xxx, yyy, zzz, clickedElement)
	if clickedElement then
			if getElementType(clickedElement) == "ped" and getElementModel(clickedElement) == 25 and button == 'left' and state == 'down' and getElementData(localPlayer, 'character->inJobPanel') == false and getElementData(clickedElement, 'ped->gangNPC') == true then
				addEventHandler('onClientRender', root, GangPanel)
				setElementData(localPlayer, 'character->inJobPanel', true)
				showChat(false)
				Panel = 1
			end
	end
end
addEventHandler ( "onClientClick", getRootElement(), openGang)

nao sei porque nao ta abrindo meu painel

Posted

Você quer setar essa data no ped? pois você declarou ped ali não sei se você viu, se você quer que abra em jogadores declare player.

Posted

Estou tentando fazer com que o painel, abra para jogadores é claro mais ao clicar no ped

Eu consegui fazer com que ele abri-se no ped, so nao estou conseguindo colocar em todos os ped de uma tabela 

Consegui :D

function openGang (button, state, xx, yy, xxx, yyy, zzz, clickedElement)
    if button == "left" and state == "down" and clickedElement then
		if getElementType (clickedElement) == "ped" then
			addEventHandler ("onClientRender", root, gangPanel)
			setElementData (localPlayer, "character->inJobPanel", true)
			showChat (false)
			Panel = 1
		end
	end	
end
addEventHandler ("onClientClick", root, openGang)

Modo que eu usei... obrigado Jonas^ 

Posted (edited)

Resumindo: Você quer que todos os ped aí ao jogador clicar a data seja setada no jogador é isso?

Se for oque eu citei acima eu tinha testado aqui e funcionou perfeitamente.

 

function openGang (button, state, absoluteX, absoluteY, worldX, worldY, worldZ, elem)
	if button == "left" and state == "up" then
		if elem and getElementType(elem) == "ped" then
			if getElementData (localPlayer, "character->inJobPanel") then -- Se o jogador não estiver a data então:
				setElementData (localPlayer, "character->inJobPanel", true) -- Seta a data como true.
				outputChatBox ("@Data Setada")
			else -- Senão:
				outputChatBox ("@Você já esta com a data") -- Retorna informando que o jogador já tem a data.
			end	
		end
	end
end
addEventHandler ("onClientClick", root, openGang)

Depurei o código pra ficar mais simples de você entender, testei com todos os ped da table.

@LucasMTA

Edited by Jonas^
Posted (edited)

Isso é bom também, mais oque eu estava tentando dizer é que eu defini uma data para o ped 

 setElementData(ped, 'ped->gangNPC', true)

Então se no caso estiver true , o painel abra .... foi oque eu fiz no código a seguir, estou aprendendo de pouco em pouco e espero um dia nao ter muita dificuldade em data e tabelas

function openGang (button, state, xx, yy, xxx, yyy, zzz, clickedElement)
    if button == "left" and state == "down" and clickedElement and getElementData(clickedElement, 'ped->gangNPC') == true then
		if getElementType (clickedElement) == "ped" then
			addEventHandler ("onClientRender", root, gangPanel)
			setElementData (localPlayer, "character->inJobPanel", true)
			showChat (false)
			Panel = 1
		end
	end	
end
addEventHandler ("onClientClick", root, openGang)

 

Dessa forma da pra fazer em futuras atualizações um sistema onde o player fize-se as compras do painel , defini-se para false e em um determinado tempo volta-se a se tornar true 

Achei util , oque voce acha 

Edited by LucasMTA

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...