proracer Posted February 8, 2011 Share Posted February 8, 2011 I was testing simple functions like example these ones. addEventHandler("onResourceStart", resourceRoot, blowAllPlayers, function blowAllPlayers() for i,v in iterElements("player") do if getElementHealth(v) == 0 then return false else setElementHealth(v, 0) outputChatBox("Everyone are now dead!", root, 0, 252, 255, false) end end end ) And simple one... addEventHandler("onResourceStart", resourceRoot, testFunc, function testFunc() outputChatBox("Hello World") end end ) In both says I forgot to close a bracket in first line... If it's a bug I think it should be fixed Link to comment
12p Posted February 8, 2011 Share Posted February 8, 2011 Actually, you should know that 50p isn't anymore developing Script Editor. And your codes are wrong. Errors: 1. The function MUST NOT be named when it only is attached to a specific event handler. 2. If the function may be used by more than just an event handler then you should name it and place it before the event handler, without being inside the addEventHandler function, like this: function a () --Code... end addEventHandler ("onResourceStart", getResourceRootElement(), a) Link to comment
proracer Posted February 8, 2011 Author Share Posted February 8, 2011 Ok thanks dude. 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