Jump to content

GUIs open when above marker


kewizzle

Recommended Posts

Posted (edited)
25 minutes ago, kewizzle said:

not even in the marker just above it and the GUI opens.

Like how far above, just slightly? Also what size is your marker?

Edited by Pembo
Posted

Try this one.

local markerE = createMarker(...) -- Creating the marker
addEventHandler("onClientMarkerHit", markerE, function(hitElement) -- Event
	local _, _, mZ = getElementPosition(source) -- Marker position
	local _, _, pZ = getElementPosition(hitElement) -- Player position
	if pZ <= mZ + 3 then -- Checking if the player's position is below the marker position + 3
		-- Do your code.
	end
end)

 

  • Like 1
Posted
4 hours ago, NeXuS™ said:

Try this one.


local markerE = createMarker(...) -- Creating the marker
addEventHandler("onClientMarkerHit", markerE, function(hitElement) -- Event
	local _, _, mZ = getElementPosition(source) -- Marker position
	local _, _, pZ = getElementPosition(hitElement) -- Player position
	if pZ <= mZ + 3 then -- Checking if the player's position is below the marker position + 3
		-- Do your code.
	end
end)

 

ill try this out in a little bit.

Posted
4 hours ago, NeXuS™ said:

Try this one.


local markerE = createMarker(...) -- Creating the marker
addEventHandler("onClientMarkerHit", markerE, function(hitElement) -- Event
	local _, _, mZ = getElementPosition(source) -- Marker position
	local _, _, pZ = getElementPosition(hitElement) -- Player position
	if pZ <= mZ + 3 then -- Checking if the player's position is below the marker position + 3
		-- Do your code.
	end
end)

 

doesnt open at all now

 

function OpenWindow(thePlayer)
	local _, _, mZ = getElementPosition(source) -- Marker position
	local _, _, pZ = getElementPosition(hitElement) -- Player position
    if thePlayer == getLocalPlayer() and (getElementData(localPlayer,"Level")) <= 59 then 
        outputChatBox("You must be atleast Level 60 to access the Special Weapon Shop!", 255, 0, 0)	
        else 
			if ( guiGetVisible ( specialWshop ) == false ) and thePlayer == getLocalPlayer() then         
                guiSetVisible ( specialWshop, true )
				showCursor ( true )
        end
	end 
end
addEventHandler("onClientMarkerHit", special, OpenWindow)
addEventHandler("onClientMarkerHit", specialSC, OpenWindow)

 

Posted
function OpenWindow(thePlayer)
	local _, _, mZ = getElementPosition(source) -- Marker position
	local _, _, pZ = getElementPosition(hitElement) -- Player position
	if pZ <= mZ + 3 then
		if thePlayer == getLocalPlayer() and (getElementData(localPlayer,"Level")) <= 59 then
			outputChatBox("You must be atleast Level 60 to access the Special Weapon Shop!", 255, 0, 0)	
		else 
			if ( guiGetVisible ( specialWshop ) == false ) and thePlayer == getLocalPlayer() then         
				guiSetVisible ( specialWshop, true )
				showCursor ( true )
			end
		end
	end
end
addEventHandler("onClientMarkerHit", special, OpenWindow)
addEventHandler("onClientMarkerHit", specialSC, OpenWindow)

This doesn't work at all?

  • Like 1
Posted
1 hour ago, NeXuS™ said:

function OpenWindow(thePlayer)
	local _, _, mZ = getElementPosition(source) -- Marker position
	local _, _, pZ = getElementPosition(hitElement) -- Player position
	if pZ <= mZ + 3 then
		if thePlayer == getLocalPlayer() and (getElementData(localPlayer,"Level")) <= 59 then
			outputChatBox("You must be atleast Level 60 to access the Special Weapon Shop!", 255, 0, 0)	
		else 
			if ( guiGetVisible ( specialWshop ) == false ) and thePlayer == getLocalPlayer() then         
				guiSetVisible ( specialWshop, true )
				showCursor ( true )
			end
		end
	end
end
addEventHandler("onClientMarkerHit", special, OpenWindow)
addEventHandler("onClientMarkerHit", specialSC, OpenWindow)

This doesn't work at all?

i sent you the wrong code i meant this 

function OpenWindow(thePlayer)
	local _, _, mZ = getElementPosition(source) -- Marker position
	local _, _, pZ = getElementPosition(hitElement) -- Player position
		if thePlayer == getLocalPlayer() and (getElementData(localPlayer,"Level")) <= 59 and pZ <= mZ + 3 then
			outputChatBox("You must be atleast Level 60 to access the Special Weapon Shop!", 255, 0, 0)	
		else 
			if ( guiGetVisible ( specialWshop ) == false ) and thePlayer == getLocalPlayer() then         
				guiSetVisible ( specialWshop, true )
				showCursor ( true )
			end
		end
	end
end
addEventHandler("onClientMarkerHit", special, OpenWindow)
addEventHandler("onClientMarkerHit", specialSC, OpenWindow)

 

1 hour ago, kewizzle said:

i sent you the wrong code i meant this 


function OpenWindow(thePlayer)
	local _, _, mZ = getElementPosition(source) -- Marker position
	local _, _, pZ = getElementPosition(hitElement) -- Player position
		if thePlayer == getLocalPlayer() and (getElementData(localPlayer,"Level")) <= 59 and pZ <= mZ + 3 then
			outputChatBox("You must be atleast Level 60 to access the Special Weapon Shop!", 255, 0, 0)	
		else 
			if ( guiGetVisible ( specialWshop ) == false ) and thePlayer == getLocalPlayer() then         
				guiSetVisible ( specialWshop, true )
				showCursor ( true )
			end
		end
	end
end
addEventHandler("onClientMarkerHit", special, OpenWindow)
addEventHandler("onClientMarkerHit", specialSC, OpenWindow)

 

yours works tho

Posted
function OpenWindow(thePlayer)

	if getElementType( thePlayer ) == "player" then
		local _, _, mZ = getElementPosition(source) -- Marker position
		local _, _, pZ = getElementPosition(thePlayer) -- Player position
		if thePlayer == getLocalPlayer() and (getElementData(localPlayer,"Level")) <= 59 and pZ <= mZ + 3 then
			outputChatBox("You must be atleast Level 60 to access the Special Weapon Shop!", 255, 0, 0)	
		else 
			if ( guiGetVisible ( specialWshop ) == false ) and thePlayer == getLocalPlayer() then         
				guiSetVisible ( specialWshop, true )
				showCursor ( true )
			end
		end
	end
end
addEventHandler("onClientMarkerHit", special, OpenWindow)
addEventHandler("onClientMarkerHit", specialSC, OpenWindow)

 

Posted
6 hours ago, xyzii said:

Alternatively you could create a col sphere at the marker's location and open window when you hit the col.

Why create a colSphere and use a colShape hit event when there's a marker hit event?

That just makes no sense to me.

  • Like 1

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