Jump to content

Is it possible to create an event ?


Recommended Posts

Posted (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 :shock: . well never mind about my story lets talk about this topic's target >> is it possible to create an event ??. Thanks

Edited by Guest
Posted (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 by Guest
Posted

Well, firstly I created function which returns exactly the same think as setPlayerTeam does, and inside I triggered event that I created before.

Posted

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

Posted

I just created variable named real function. For example

_setElementData = setElementData 

And then you return

return _setElementData ( player, name, value )  

Posted
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 ? :D

Posted

Well, you could do this that way, but you have to return function with real arguments

return _ExportName ( message, player, r, g, b, isColored )  

Posted

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 ? :D

Posted
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 :)

Posted

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.

Posted

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 

Posted
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 ?

Posted

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.

Posted (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 by Guest
Posted
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...