#Paper Posted June 8, 2011 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)
karlis Posted June 8, 2011 Posted June 8, 2011 make sure does it needs a capital letter at beginning.
Aibo Posted June 8, 2011 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?
BinSlayer1 Posted June 8, 2011 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
Aibo Posted June 8, 2011 Posted June 8, 2011 ok then, how do you know your function works if your function does nothing?
Aibo Posted June 8, 2011 Posted June 8, 2011 well there's no outputChatBox in the code you've posted.
#Paper Posted June 8, 2011 Author Posted June 8, 2011 Ye, i deleted the code and i posted just a part...
Aibo Posted June 8, 2011 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?
#Paper Posted June 9, 2011 Author 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...
karlis Posted June 9, 2011 Posted June 9, 2011 just put all the code, will be easier for both helpers and you, and will save misleadings.
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