Jump to content

Triggering


Et-win

Recommended Posts

Greetings,

I had a question why this doesn't work:

--Client: 
triggerServerEvent("Test", localPlayer) 
  
--Server: 
function lol() 
   outputChatBox("OHai!", client) 
end 
  
addEvent("Test", true) 
addEventHandler("Test", resourceRoot, lol) 

I thought 'resourceRoot' would work, because the scripts are in the same resource? (Of course, 'getResourceRootElement()' doesn't work as well.)

Also question number 2:

When you use by 'addEvent' the boolean 'true' and when 'false'? I actually never understood this well :D

Link to comment
I know that, but for what you can use 'addEvent' more then?
addEvent 

Allows you to enter a custom event which work exactly the same ways that the wiki.

I know that, but for what you can use 'addEvent' more then?

I know for 'triggerClientEvent', 'triggerServerEvent' and 'triggerEvent', but are those all where you can use 'addEvent' for, or are there more?

Link to comment
  • Moderators

Question 1

-- client 
triggerServerEvent("Test",resourceRoot) -- does work. 
triggerServerEvent("Test", localPlayer) -- doesn't work. 
  
-- server 
addEvent("Test", true) 
addEventHandler("Test",  
    resourceRoot, -- element which which can execute this event. 
    lol -- function 
) 
  

-- client 
triggerServerEvent("Test",resourceRoot) -- does work. 
triggerServerEvent("Test", localPlayer) -- does work. 
  
-- server 
addEvent("Test", true) 
addEventHandler("Test",  
    root, -- element which which can execute this event. 
    lol -- function 
) 
  
  

Like you attach a single gui button to the event onClientGUIClick.

Question 2

The event will not be triggered afaik, but I never tried it because I never needed that.

See it as an enable and disable switch.

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