Jump to content

guiComboBoxSetSelected triggers onClientGUIComboBoxAccepted?


'LinKin

Recommended Posts

Posted

Hello,

I'm wondering if when we use guiComboBoxSetSelected() the event onClientGUIComboBoxAccepted is triggered.

If not, how can we force it?

Need a clanwar script? Click here!

Do you want some free scripts for your DD server? Visit my website.

Posted

Have you tried if it does or not?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

No,

I'm trying to use

triggerEvent("onClientGUIComboBoxAccepted", combobox_selectplayer, playerCount) ; where playerCount is an int

EDIT: No, the event onClientGUIComboBoxAccepted is not triggered after using guiComboBoxSetSelected

Need a clanwar script? Click here!

Do you want some free scripts for your DD server? Visit my website.

  • Moderators
Posted
No,

I'm trying to use

triggerEvent("onClientGUIComboBoxAccepted", combobox_selectplayer, playerCount) ; where playerCount is an int

EDIT: No, the event onClientGUIComboBoxAccepted is not triggered after using guiComboBoxSetSelected

You right, the event isn't triggered (just check the sources).

You can't trigger buit-in events but you can just override the guiComboBoxSetSelected function to trigger a new custom event each time you do use this function:

--Copying the original function into _guiComboBoxSetSelected 
_guiComboBoxSetSelected = guiComboBoxSetSelected 
  
--Creating our custom event: 
addEvent("onClientGUIComboBoxSelected") 
  
--overriding the original one 
function guiComboBoxSetSelected( comboBox, itemIndex ) 
    --trigger our custom event: 
    triggerEvent("onClientGUIComboBoxSelected", comboBox, comboBox) 
  
    --call the original function with the same arguments: 
    return _guiComboBoxSetSelected( comboBox, itemIndex ) 
end 
  
--Add this if you want to be triggered when the user select it too: 
addEventHandler("onClientGUIComboBoxAccepted", root, function ( comboBox ) 
    triggerEvent("onClientGUIComboBoxSelected", comboBox, comboBox) 
end) 

And use that event instead of onClientGUIComboBoxAccepted:

function onComboSelected() 
    outputChatBox("comboBox selected") 
end 
addEventHandler("onClientGUIComboBoxSelected", root, onComboSelected) 

The rEvolution is coming ...

Posted

Thanks,

I made it like I was trying to do it at the beginning

I trigger the event and send it 1 more argument,

triggerEvent("onClientGUIComboBoxAccepted", myCombobox, myCombobox, item)

And well I just do the code inside the implementation of that event.

Need a clanwar script? Click here!

Do you want some free scripts for your DD server? Visit my website.

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