Jump to content

HELP for button click


weedsawq

Recommended Posts

 

I want to make the script by clicking the button, the window will close, and this script click the window will close, please repair it.

 

menu = createMarker(-2385.5, -748.7, 133.1, "cylinder", 3, 255, 0, 0)

function openShop( hitElement, matchingDimension)
   triggerClientEvent( "onGreeting", resourceRoot, "Your HIT.", client )
end
addEventHandler("onMarkerHit",menu, openShop)

^server side



function onHitGreet ( message, button )
	outputChatBox ( "SHOP: "..message )
   shopmenu = guiCreateWindow ( 100, 200, 300, 300,"panel", false )
    buttonX = guiCreateButton ( 100, 200, 25, 25,"X", false, shopmenu )
   local function click( button )
	        outputChatBox ( "SHOP: you're close" )
	        guiSetVisible( shopmenu, not guiGetVisible( shopmenu ))
   end
   addEventHandler ( "onClientGUIClick", buttonX, click, true )
end
addEvent( "onGreeting", true )
addEventHandler( "onGreeting", resourceRoot, onHitGreet )

^client side

Link to comment
  • Moderators
-- client side

function openShopFunction ( message )
	outputChatBox ( "SHOP: "..message )
	
	shopmenu = guiCreateWindow ( 100, 200, 300, 300,"panel", false )
	buttonX = guiCreateButton ( 100, 200, 25, 25,"X", false, shopmenu )

	addEventHandler ( "onClientGUIClick", buttonX, function()
		outputChatBox ( "SHOP: you're close" )
		destroyElement(shopmenu)
	end )
end
addEvent("openShopOnClientSide", true)
addEventHandler("openShopOnClientSide", root, openShopFunction)
-- server side

local menu = createMarker(-2385.5, -748.7, 133.1, "cylinder", 3, 255, 0, 0)

function openShop(hitElement, matchingDimension)
   triggerClientEvent(hitElement, "openShopOnClientSide", hitElement, "Your HIT.")
end
addEventHandler("onMarkerHit", menu, openShop)

 

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