Fabioxps Posted March 25, 2013 Posted March 25, 2013 how to remove an event from a script in another script
Castillo Posted March 26, 2013 Posted March 26, 2013 You want to remove the event handler from a function from another resource?
Fabioxps Posted March 26, 2013 Author Posted March 26, 2013 You want to remove the event handler from a function from another resource? yes
Castillo Posted March 26, 2013 Posted March 26, 2013 Yo ucan export a function that removes it, then use the exported function.
Fabioxps Posted March 26, 2013 Author Posted March 26, 2013 Yo ucan export a function that removes it, then use the exported function. how can I export from another script to remove an event? function drawSidebarNote(player) return exports.Side:drawSidebarNote(player) end local visible = true bindKey("F6","down", function() if visible then removeEventHandler("onClientRender",getRootElement(),drawSidebarNote) visible = false else addEventHandler("onClientRender",getRootElement(),drawSidebarNote) visible = true end end)
Fabioxps Posted March 26, 2013 Author Posted March 26, 2013 Put your full code here, if you can. I just want to remove an event from my script, "Side", the more I want to remove the event using another script
DNL291 Posted March 26, 2013 Posted March 26, 2013 Are you using the exported function drawSidebarNote right? If this function doesn't have any argument to remove which you have created, you must edit the script that this function is.
Fabioxps Posted March 26, 2013 Author Posted March 26, 2013 have any examples of how to remove an event using another script?
Fabioxps Posted March 26, 2013 Author Posted March 26, 2013 Castillo already told you how to do it. Wtf? @DNL,Castilho, have any examples of how to remove an event using another script?
MIKI785 Posted March 26, 2013 Posted March 26, 2013 I don't quite understand your code so this is just example but it should help you: 1st resource with the event: function removeMyEvent () removeEventHandler("eventName", element, function) --Put there the same arguments as in addEventHandler end meta of 1st resource: function="removeMyEvent" type="server"/> change server/client... 2nd resource where you want to remove the event: exports.Side:removeMyEvent() --I presume that Side is the name of your resource with the event If you don't understand it, post codes of both resources.
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