Tails Posted May 29, 2016 Share Posted May 29, 2016 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
Anubhav Posted May 29, 2016 Share Posted May 29, 2016 It will give that: 1. Line #1 has no such loop to do that. That you put will return a nil value unless it is defined Link to comment
Tails Posted May 30, 2016 Author Share Posted May 30, 2016 Don't worry about it anymore, I was being stupid. Instead of storing the eventHandlers, I'm now storing the dxDrawImage functions instead. 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