Sign in to follow this  
EW1611

Dx abre quando esta no marker

Recommended Posts

olá, fiz um dx pequeno apenas pra mostrar infos na tela, mas qria q ele ficasse na tela enquanto o player está no marker, com esse script aki ele só "pisca" qndo passa no marker

 

marker1 = createMarker(2122.7575683594,-1784.9986572266,12.387022018433, "cylinder", 1.5)

function startRender (hitElement)
	if (getElementType (hitElement) == "player") then
		addEventHandler ("onClientRander", root, DX1)
	end
end

function DX1(player)
	if isElementWithinMarker(player, marker1) then
		dxDrawLine(395 - 1, 0 - 1, 395 - 1, 38, tocolor(255, 254, 254, 255), 1, false)
    	dxDrawLine(972, 0 - 1, 395 - 1, 0 - 1, tocolor(255, 254, 254, 255), 1, false)
    	dxDrawLine(395 - 1, 38, 972, 38, tocolor(255, 254, 254, 255), 1, false)
    	dxDrawLine(972, 38, 972, 0 - 1, tocolor(255, 254, 254, 255), 1, false)
    	dxDrawRectangle(395, 0, 577, 38, tocolor(0, 0, 0, 93), false)
    	dxDrawText("Pizzaria: Temos ... Pizzas disponíveis para entrega", 443, 5, 923, 28, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "top", false, false, false, false, false)
	end
end
addEventHandler("onClientMarkerHit", marker1, DX1)
removeEventHandler("onClientRender", root, DX1 )

Obrigado.

Share this post


Link to post
Posted (edited)
marker1 = createMarker(2122.7575683594,-1784.9986572266,12.387022018433, "cylinder", 1.5)

addEventHandler ("onClientMarkerHit", root, function (hitPlayer, matchingDimension)
	if isElementWithinMarker (hitPlayer, marker1) then
		if (getElementType (hitPlayer) == "player") then
			addEventHandler ("onClientRander", root, DX1)
		end	
	end
end)	

function DX1 ()
	dxDrawLine (395 - 1, 0 - 1, 395 - 1, 38, tocolor(255, 254, 254, 255), 1, false)
	dxDrawLine (972, 0 - 1, 395 - 1, 0 - 1, tocolor(255, 254, 254, 255), 1, false)
	dxDrawLine (395 - 1, 38, 972, 38, tocolor(255, 254, 254, 255), 1, false)
	dxDrawLine (972, 38, 972, 0 - 1, tocolor(255, 254, 254, 255), 1, false)
	dxDrawRectangle (395, 0, 577, 38, tocolor(0, 0, 0, 93), false)
	dxDrawText ("Pizzaria: Temos ... Pizzas disponíveis para entrega", 443, 5, 923, 28, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "top", false, false, false, false, false)
end

 

Edited by Jonas^
  • Thanks 1

Share this post


Link to post

Não funcionou, passo em cima do marker não acontece nada, nenhum erro tbm

Share this post


Link to post

Tente:

local marker1 = createMarker(2122.7575683594,-1784.9986572266,12.387022018433, "cylinder", 1.5)
local rendering = nil

addEventHandler ("onClientMarkerHit", resourceRoot, function (hitPlayer, matchingDimension)
	if source == marker1 then
		if not rendering then
			addEventHandler ("onClientRander", root, DX1)
			rendering = true
		end	
	end
end)

function DX1 ()
	dxDrawLine (395 - 1, 0 - 1, 395 - 1, 38, tocolor(255, 254, 254, 255), 1, false)
	dxDrawLine (972, 0 - 1, 395 - 1, 0 - 1, tocolor(255, 254, 254, 255), 1, false)
	dxDrawLine (395 - 1, 38, 972, 38, tocolor(255, 254, 254, 255), 1, false)
	dxDrawLine (972, 38, 972, 0 - 1, tocolor(255, 254, 254, 255), 1, false)
	dxDrawRectangle (395, 0, 577, 38, tocolor(0, 0, 0, 93), false)
	dxDrawText ("Pizzaria: Temos ... Pizzas disponíveis para entrega", 443, 5, 923, 28, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "top", false, false, false, false, false)
end

Digite /debugscript 3 quando testar.

Share this post


Link to post

O nome do evento tá errado, substitua "onClientRander" por "onClientRender".

  • Thanks 1

Share this post


Link to post
Posted (edited)

Agora esta funcionando, mt obrigado e desculpe o incomodo.

Na verdade, agora o dx não some '-'

Edited by EW1611

Share this post


Link to post

funcionando do jeito que eu queria, mt obrigado e desculpe o incomodo

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.