DakiLLa Posted August 24, 2008 Author Posted August 24, 2008 is it possible to check if gui button already clicked ?
Ace_Gambit Posted August 24, 2008 Posted August 24, 2008 is it possible to check if gui button already clicked ? Buttons are just like any other components elements in the MTA world. This means that you can set data. Meaning you have more than one options to keep track of "clicks". setElementData(button, "clicks", count) clicks = getElementData(button, "clicks")
Gamesnert Posted August 24, 2008 Posted August 24, 2008 is it possible to check if gui button already clicked ? How do you mean that? That if you press the same button again something else happens? I always use a global variable for that. ^^ if isButtonAlreadyClicked~=true then outputChatBox("You clicked the button!!!!") isButtonAlreadyPressed=true else outputChatBox("You already clicked the button fool! -.-") end Due to another post in the meantime because I'm so SLOOOOOOOOOW with typing: Or what Ace said also is a possibility.
DakiLLa Posted September 3, 2008 Author Posted September 3, 2008 (edited) how can i set visibility of button for all players not for only local player ? .... if ( source == ButtonOne ) then guiSetVisible ( ButtonOne, false ) this disable button only for one player, who clicked buttonOne, but how to disable this button for all players when anybody clicked on it? i think it's not possible or not? Edited September 3, 2008 by Guest
Gamesnert Posted September 3, 2008 Posted September 3, 2008 how can i set visibility of button for all players not for only local player ? .... if ( source == ButtonOne ) then guiSetVisible ( ButtonOne, false ) this disable button only for one player, who clicked buttonOne, but how to disable this button for all players when anybody clicked on it? i think it's not possible or not? You need to do triggerServerEvent and then something like... function letsDisableThisForAllPlayers() outputChatBox("Warning: " .. getClientName(source) .. " pushed the big button!") triggerClientEvent(getRootElement(),"disableTheBigButton",source) end addEvent("onBigButtonPressed",true) addEventHandler("onBigButtonPressed",getRootElement(),letsDisableThisForAllPlayers) Only parts you need to add: --triggerServerEvent when the button is pressed. --addEvent and addEventHandler in client-side, for "onBigButtonPressed" to work. That should work. Not tested though since I'm at school... -.- EDIT: Line 2 fixed for as far as I can see... =/
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now