Hell-Mate Posted March 2, 2014 Share Posted March 2, 2014 (edited) Hello community.. As the title says " Is it possible to create an event " ? some time i search about events and i dont find it so is it possible to create an event ? like onPlayerTeamChange, onPlayerElementDateChange and so on. i think it possible by exporting ?? if yes then can some one explain me how to export ? or give me a clear TUT about exporting that i can really learn from it. really this coding thingy made me mad when i finish something and be good on it i deduce that i should learn another thing and so on finished learning MTA lua 90% then i deduced that there is mySQL and SQLite and so on . well never mind about my story lets talk about this topic's target >> is it possible to create an event ??. Thanks Edited March 2, 2014 by Guest Link to comment
WhoAmI Posted March 2, 2014 Share Posted March 2, 2014 (edited) It is. In last topic I created for you one, but I think event onElementDataChange is global event. https://wiki.multitheftauto.com/wiki/On ... DataChange Edited March 2, 2014 by Guest Link to comment
Hell-Mate Posted March 2, 2014 Author Share Posted March 2, 2014 hmm , explain .. ? how ? Link to comment
Hell-Mate Posted March 2, 2014 Author Share Posted March 2, 2014 (edited) It is. In last topic I created for you one, but I think event onElementDataChange is global event. Yea i know, but idk how you created it, thats why i made this topic. to let someone explain me how or give me a TUT Edited March 2, 2014 by Guest Link to comment
WhoAmI Posted March 2, 2014 Share Posted March 2, 2014 Well, firstly I created function which returns exactly the same think as setPlayerTeam does, and inside I triggered event that I created before. Link to comment
Hell-Mate Posted March 2, 2014 Author Share Posted March 2, 2014 hmmm i dont understand this part _setPlayerTeam = setPlayerTeam why you put _ ?? i will tell you what i think and you tell me its right or wrong .. _ExportName? = IDKThisPart after _HereIsTheExportName right ? answer this another ques : what is that part ? >> IDKThisPart Link to comment
WhoAmI Posted March 2, 2014 Share Posted March 2, 2014 I just created variable named real function. For example _setElementData = setElementData And then you return return _setElementData ( player, name, value ) Link to comment
Hell-Mate Posted March 2, 2014 Author Share Posted March 2, 2014 I just created variable named real function. For example _setElementData = setElementData And then you return return _setElementData ( player, name, value ) i think i got it 50%, let me explain what i learned : for example i want to export outputChatBox > _ExportName = outputChatBox return return _ExportName ( source ) hmm ? Link to comment
WhoAmI Posted March 2, 2014 Share Posted March 2, 2014 Well, you could do this that way, but you have to return function with real arguments return _ExportName ( message, player, r, g, b, isColored ) Link to comment
Hell-Mate Posted March 2, 2014 Author Share Posted March 2, 2014 I think now i got it 70% another example for what i learned .. lets say i will export setPlayerWantedLevel _ExportName = setPlayerWantedLevel return return _ExportName ( thePlayer, stars ) hmmmmm ? Link to comment
Hell-Mate Posted March 2, 2014 Author Share Posted March 2, 2014 Yes. use addEvent . you dont get what i mean. addEvent is using for triggering but what i mean is to create an event like onPlayerTeamChange and so on. so i can use export for this as WhoAmI said Link to comment
Anubhav Posted March 2, 2014 Share Posted March 2, 2014 Ahh realy? This function allows you to register a custom event. Custom events function exactly like the built-in events. See event system for more information on the event system. Link to comment
WhoAmI Posted March 2, 2014 Share Posted March 2, 2014 Well, but to do this event you need addEvent. For example _destroyElement = destroyElement addEvent ( "onElementDestroy", true ) function destroyElement ( element ) triggerEvent ( "onElementDestroy", root, element ) return _destroyElement ( element ) end Link to comment
Hell-Mate Posted March 2, 2014 Author Share Posted March 2, 2014 Ahh realy? This function allows you to register a custom event. Custom events function exactly like the built-in events. See event system for more information on the event system. i know i know, all what i meant is : i must create an export for the event i will add. understood ? else its using only for triggering .. .............is that right ? @WhoAmI ? Link to comment
Anubhav Posted March 2, 2014 Share Posted March 2, 2014 LOOOL. Its is to create new events. Have you seen some resources it has events. (NOT EXPORTS). I have seen one . Its something of Bank system. Link to comment
WhoAmI Posted March 2, 2014 Share Posted March 2, 2014 I don't really now, what are you talking about, but yes. Link to comment
Hell-Mate Posted March 2, 2014 Author Share Posted March 2, 2014 (edited) LOOOL. Its is to create new events. Have you seen some resources it has events. (NOT EXPORTS). I have seen one . Its something of Bank system. dude, as i learned in scripting and as i learned from WhoAmI in this topic i deduced that > addEvent is to add an event which can be triggered to another global event. it will be useless if its not triggered to another global event .. Got it ? Edited March 3, 2014 by Guest Link to comment
WhoAmI Posted March 2, 2014 Share Posted March 2, 2014 addEvent is adding an event which you can trigger. Link to comment
Hell-Mate Posted March 2, 2014 Author Share Posted March 2, 2014 addEvent is adding an event which you can trigger. Exacty what i said ^^ Link to comment
manawydan Posted March 2, 2014 Share Posted March 2, 2014 i think you can use setElementData, with team name and use onElementDataChange to make "onPlayerTeamChange" event Link to comment
Hell-Mate Posted March 3, 2014 Author Share Posted March 3, 2014 i think you can use setElementData, with team name and use onElementDataChange to make "onPlayerTeamChange" event Never mind, problem is solved and all is okay now, #Lock-Request 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