Jump to content

HOW I CAN MAKE CHECK


Viudes

Recommended Posts

Posted (edited)

i want only player who hit marker open this gui windows how i can made check?

 

function toggleGUI (localPlayer)
	bool = not bool
	showCursor(bool)
	guiSetVisible(Base,bool)
end	

 

Edited by Viudes
I NEED
Posted
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
]]
  

 

BHgi29I.png
  Dystopia alpha 0.75
DOWNLOAD

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

Posted

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.

BHgi29I.png
  Dystopia alpha 0.75
DOWNLOAD

Posted
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!

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