Jump to content

remove Event


Fabioxps

Recommended Posts

Posted

You want to remove the event handler from a function from another resource?

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

Yo ucan export a function that removes it, then use the exported function.

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

Posted

Put your full code here, if you can.

Please do not PM me with scripting related question nor support, use the forums instead.

Posted
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

Posted

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.

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

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.

Lua Scripter

?ucet=miki_cz

Owner of mshost.cz MTA portal.

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