Jump to content

Removing multiple eventHandlers


Tails

Recommended Posts

Hello MTA scripters,

I currently have a script where I need to render multiple images or rows based on the clients input.

This is working fine but for some reason I can't seem to remove them, it keeps giving me: 'Expected function at argument 3 got boolean'.

This is the first time I'm trying to store eventHandlers in a table. Maybe I'm missing something.

Here's the code, the problem is on line 9. 'Expected function at argument 3 got boolean'.

sr.item.render[i] = addEventHandler("onClientRender",root, 
    function() 
        dxDrawImage(182, 331+sr.item.height[i], 24, 25, "images/image.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) 
    end 
) 
  
function clearResults() 
    for i in pairs(sr.item.render) do 
        removeEventHandler("onClientRender",root,sr.item.render[i]) 
        sr.item.render[i] = nil 
    end 
end 
addCommandHandler("clear",clearResults) 

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