'LinKin Posted June 9, 2014 Share Posted June 9, 2014 Hello, I've a clientside event called openGUI inside Resource1 Then, I made Resource2, and I added a clientside event with the same name (openGUI) Then, when I trigger the event from Resource2, it opens the GUI of Resource2 BUT ALSO the GUI of Resource1. How can I avoid this? Link to comment
myonlake Posted June 9, 2014 Share Posted June 9, 2014 I recall the allowRemoteTrigger parameter for addEvent was designed to avoid these type of situations. Set it to false and see if it works. If it doesn't work, the best way to avoid double-events is to name them after the resource such as Resource1:theEventName. Link to comment
Cadell Posted June 9, 2014 Share Posted June 9, 2014 Simply change the name of the event or you can export 1 fuction to other script using export tag in meta and also define type and then easily can be use in any script using syntax exports.resname:functionname Link to comment
arezu Posted June 9, 2014 Share Posted June 9, 2014 I recall the allowRemoteTrigger parameter for addEvent was designed to avoid these type of situations. Set it to false and see if it works.If it doesn't work, the best way to avoid double-events is to name them after the resource such as Resource1:theEventName. This or if possible for you, attach the event to resourceRoot instead of root and trigger using resourceRoot, then it will only trigger for the same resource. Link to comment
'LinKin Posted June 9, 2014 Author Share Posted June 9, 2014 Thanks guys. I'll use arezu's solution Link to comment
'LinKin Posted June 13, 2014 Author Share Posted June 13, 2014 * EDITED: So as final solution I got this: Client side: addEventHandler("openGUI", resourceRoot, openGUI) Server side: triggerClientEvent(thePlayer, "openGUI", resourceRoot) Thanks. Link to comment
Moderators Citizen Posted June 13, 2014 Moderators Share Posted June 13, 2014 I recall the allowRemoteTrigger parameter for addEvent was designed to avoid these type of situations. No, it's just telling if the event can be triggered from the other side. So nothing to do with resources. So as final solution I got this:Client side: addEventHandler("openGUI", resourceRoot, openGUI) Server side: triggerClientEvent(thePlayer, "openGUI", resourceRoot) Yeah exactly. You couldn't use triggerClientEvent(thePlayer, "openGUI", thePlayer) because players are not in the resource tree, but the root tree. (I saw you asked it before you edit your post ^^) Watch the schema here to get a visual idea of the element tree system: https://wiki.multitheftauto.com/wiki/Element_tree 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