DarkLink Posted July 10, 2011 Share Posted July 10, 2011 Okay guys, I was trying to do something, but I think it doesnt work. So I have a GUI, and in 30 seconds trigger a function to see if player clicked on some button of the GUI or NOT. So I made this function on serverside, that will trigger after 30 seconds: server side: function doesntmatter () if segundos == 0 then triggerClientEvent("hadChosenTeam", getRootElement()) -- will trigger for all the clients, thats what I want. end end on client side: local clicked = false function chooseTeam(button,state) -- this is the function thats is called when any button of the gui is clicked clicked = true end addEvent("hadChosenTeam", true) function inCaseNotChose() if(clicked == false) then outputChatBox("Working.") --I would get this text on chat box if I didnt clicked on any button. end end addEvent("hadChosenTeam", getRootElement(), inCaseNotChose) So guys what is not working here? Do you know something? I guess its about local variables, I cant use them like this, right? Thanks in advance! EDIT: I figured that I can do this with setElementData, but I wanna understand why this method of variable dont work, and if there is other method beside using memory for data. Thans alot guys! Link to comment
Jaysds1 Posted July 10, 2011 Share Posted July 10, 2011 You added 2 addEvent, the last addEvent is suppose to be addEventHandler("eventname", RootElement, function) Where is the timer? and clicked local clicked ={"left","right"ETC.} if the local variable is supporting 2 thing like true or false then leave it like local clicked Link to comment
Castillo Posted July 10, 2011 Share Posted July 10, 2011 Jasd1, I don't understand what are you trying to say..... he has everything in order, and "local clicked ={"left","right"ETC.}" would be a table, not a variable. Dark, try adding debug outputs to your script, that'll help you to find out where's the error. Link to comment
DarkLink Posted July 10, 2011 Author Share Posted July 10, 2011 LOL!! Castillo this time jay was right yesterday I was a bit stoned lol, and was a bit confused lol.. dont know why but made an addEvent instead of an addEventHandler, that was suppose to x) So I changed now from addEvent("hadChosenTeam", getRootElement(), inCaseNotChose) to addEventHandler("hadChosenTeam", getRootElement(), inCaseNotChose), and its working hehe. Thanks castillo and jay Appreciated. Link to comment
Jaysds1 Posted July 10, 2011 Share Posted July 10, 2011 no problem, Always here to help. Link to comment
Castillo Posted July 10, 2011 Share Posted July 10, 2011 LOL!! Castillo this time jay was right yesterday I was a bit stoned lol, and was a bit confused lol.. dont know why but made an addEvent instead of an addEventHandler, that was suppose to x) So I changed now from addEvent("hadChosenTeam", getRootElement(), inCaseNotChose) to addEventHandler("hadChosenTeam", getRootElement(), inCaseNotChose), and its working hehe. Thanks castillo and jay Appreciated. Haha, my bad, I'd read "addEvent" as "addEventHandler" . Link to comment
DarkLink Posted July 10, 2011 Author Share Posted July 10, 2011 LOL!! Castillo this time jay was right yesterday I was a bit stoned lol, and was a bit confused lol.. dont know why but made an addEvent instead of an addEventHandler, that was suppose to x) So I changed now from addEvent("hadChosenTeam", getRootElement(), inCaseNotChose) to addEventHandler("hadChosenTeam", getRootElement(), inCaseNotChose), and its working hehe. Thanks castillo and jay Appreciated. Haha, my bad, I'd read "addEvent" as "addEventHandler" . Ye happens alot of times, with many words, when we already tired Happen to me too, when was scripting lol x) Thanks bro. 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