Et-win Posted December 6, 2014 Share Posted December 6, 2014 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 Link to comment
Bonsai Posted December 6, 2014 Share Posted December 6, 2014 1. I guess players aren't children of resourceRoot but only of root. 2. allowRemoteTrigger: A boolean specifying whether this event can be called remotely using triggerClientEvent / triggerServerEvent or not. Link to comment
Et-win Posted December 6, 2014 Author Share Posted December 6, 2014 allowRemoteTrigger: A boolean specifying whether this event can be called remotely using triggerClientEvent / triggerServerEvent or not. I know that, but for what you can use 'addEvent' more then? Link to comment
Bonsai Posted December 6, 2014 Share Posted December 6, 2014 Triggering events between resources, not between Client <-> Server. I also like to use events within resources instead of calling functions directly. Looks cleaner Don't know if that might be a bit slower, probably is, but shouldn't be too bad. Link to comment
Enargy, Posted December 6, 2014 Share Posted December 6, 2014 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. Link to comment
Et-win Posted December 6, 2014 Author Share Posted December 6, 2014 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
Enargy, Posted December 6, 2014 Share Posted December 6, 2014 No need to add several times 'addEvent' when you apply a custom event. Link to comment
Et-win Posted December 6, 2014 Author Share Posted December 6, 2014 You don't understand me. Link to comment
Moderators IIYAMA Posted December 6, 2014 Moderators Share Posted December 6, 2014 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
Et-win Posted December 6, 2014 Author Share Posted December 6, 2014 Mmm will do it with these. @ everyone. Link to comment
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