Rutex Posted December 21, 2014 Share Posted December 21, 2014 Hi guys. I have small problem. I need to have event listener in function. Server: function enterVehicle( theVehicle, seat, jacked) ... some code if(CurrectCarID == 437) then if(seat == 0)then triggerClientEvent( Player, "EnterBus",getRootElement() ) addEventHandler( "BusMarsh1",getRootElement( ), function () log("marsh1") end) its send on client event, that activate the gui, and return the selected button in event The problem is, in every car enter, the event is dupe. for example. 1 st. enter - its print only 1 time "marsh1". In next enter car, its print 2 times "marsh1", in 3 enter 3, and etc.... How i can do this right? or fix? Without this dupe. P.s. Log. func. function log( Msg ) outputChatBox( Msg,getRootElement( )) end Link to comment
Dealman Posted December 21, 2014 Share Posted December 21, 2014 Because every time the function enterVehicle is called, a new event handler is created for "BusMarsh1". You'll have to remove it using removeEventHandler. Link to comment
Rutex Posted December 21, 2014 Author Share Posted December 21, 2014 Yes. I know why its dupe. For me was intresing how i can " fix " it. I was think here is special event listener for this. Thank you:) 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