Jump to content

GUI question


DakiLLa

Recommended Posts

Posted
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: xD

Or what Ace said also is a possibility.

Projects:

Slothbot | Maximap

  • 2 weeks later...
Posted (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 by Guest
Posted
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... =/

Projects:

Slothbot | Maximap

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