Jump to content

HOW I CAN MAKE CHECK


Viudes

Recommended Posts

47 minutes ago, Zorgman said:

Use onMarkerHit. The element that hit the marker is the first parameter. Check if it's a player before firing up the gui.

 

function toggleGUI (localPlayer, hitElement)
	if getElementType (hitElement) == "player" then
	bool = not bool
	showCursor(bool)
	guiSetVisible(Base,bool)
end	
  end

Why that not work

 

EDIT: Give warning getElementType

Edited by Viudes
Link to comment
function toggleGUI (hitElement, dim)
	if getElementType (hitElement) == "player" then
    outputChatBox("function triggered") -- a simple check so you know it worked
	bool = not bool
	showCursor(bool)
	guiSetVisible(Base,bool)
end	
addEventHandler( "onMarkerHit", resourceRoot, toggleGUI )
  
--[[note that:
1.you will need to replace resourceRoot with your actual marker element, otherwise function will trigger for all markers
2.this need to be server-side
3.it's untested
]]
  

 

Link to comment
7 minutes ago, Zorgman said:

function toggleGUI (hitElement, dim)
	if getElementType (hitElement) == "player" then
    outputChatBox("function triggered") -- a simple check so you know it worked
	bool = not bool
	showCursor(bool)
	guiSetVisible(Base,bool)
end	
addEventHandler( "onMarkerHit", resourceRoot, toggleGUI )
  
--[[note that:
1.you will need to replace resourceRoot with your actual marker element, otherwise function will trigger for all markers
2.this need to be server-side
3.it's untested
]]
  

 

Yeah that work but is still trigger all player..

Link to comment
1 hour ago, Zorgman said:

Well, looking at it again I'm surprised you say it works, since guiSetVisible is client-sided. Okay, what you need to do is trigger an event and send it only to the hitElement, telling it to fire up the gui.


if getElementType (hitElement) == "player" then

triggerClientEvent(hitElement,"YourEventName",root)

end

Don't forget to add your event clientside and put the gui part there.

Now this work! thx!

Link to comment

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