#Paper Posted June 8, 2011 Share Posted June 8, 2011 If i use this code: function onWasted() if state == "Running" or state == "PostFinish" then end end addEventHandler("onPlayerWasted", getRootElement(), onWasted) the function wont work, if i use this one: function onWasted() end addEventHandler("onPlayerWasted", getRootElement(), onWasted) The function works. The "state" variable is defined here: local state = "" function raceStat(newStateName) state = newStateName end addEvent("onRaceStateChanging", true) addEventHandler( "onRaceStateChanging", getRootElement(), raceStat) Link to comment
karlis Posted June 8, 2011 Share Posted June 8, 2011 make sure does it needs a capital letter at beginning. Link to comment
#Paper Posted June 8, 2011 Author Share Posted June 8, 2011 I saw it in the racestates_server.lua it needs Link to comment
Aibo Posted June 8, 2011 Share Posted June 8, 2011 If i use this code:The "state" variable is defined here: and where is "here"? same file? same resource, but other file? Link to comment
BinSlayer1 Posted June 8, 2011 Share Posted June 8, 2011 this might look dumb but i've had many problems with IF's when I wasn't using paranthesis so you might wanna try the following: if (state == "Running") or (state == "PostFinish") then Link to comment
Aibo Posted June 8, 2011 Share Posted June 8, 2011 ok then, how do you know your function works if your function does nothing? Link to comment
#Paper Posted June 8, 2011 Author Share Posted June 8, 2011 cuz the outputChatBox doesn't happen Link to comment
Aibo Posted June 8, 2011 Share Posted June 8, 2011 well there's no outputChatBox in the code you've posted. Link to comment
#Paper Posted June 8, 2011 Author Share Posted June 8, 2011 Ye, i deleted the code and i posted just a part... Link to comment
Aibo Posted June 8, 2011 Share Posted June 8, 2011 and what makes you so sure the error is in the lines you've posted, and not in the deleted ones? Link to comment
#Paper Posted June 9, 2011 Author Share Posted June 9, 2011 the error is in the code that i've posted, cuz if i use the first one code i've posted the fuction wont work, instead if i use the second one it works.. so... Link to comment
karlis Posted June 9, 2011 Share Posted June 9, 2011 just put all the code, will be easier for both helpers and you, and will save misleadings. 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