View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0005495||Multi Theft Auto : San Andreas||Server||public||2010-07-23 21:29||2013-01-21 21:46|
|Target Version||1.3.1||Fixed in Version||1.3.1|
|Summary||0005495: event handlers prioritization|
allow to set priorities for event handlers
bool addEventHandler ( string eventName, element attachedTo, function handlerFunction, [bool getPropagated = true], [int priority=5])
I can imagine lots of cases where this could come handy
I give some special weapon to a player that should never drop
I believe this stuff cannot be done directly since the interiors resource now nothing about that other resource.
|Tags||No tags attached.|
The more clean solution to this is to make events for when resources do stuff, and make them cancellable. For example, the interiors resource's onPlayerInteriorHit (i think that's the name) is cancellable.
Event priorities have come up several times in the past however, and they would have their uses regardless.
Yes i think that is what i mean. Instead of doing directly an action send an event to 'myself', but let others process the event before 'me'.
I understand, but if by the time i cancel the event, it has already being procesed somewhere. Doesnt solve the problem. I dont see event handlers being procesed in any specific order. Or i dont understand how they are processed.
Or you mean, when the sender resource make the event cancelable. that set that resource as the last one to proccess the event with its own event handler.
What i mean is that resources such as deathpickups should add a cancellable onPlayerDeathPickupCreate so you can modify it's behaviour yourself.
But again, it doesnt invalidate the report.
This was fixed a long time ago in http://code.google.com/p/mtasa-blue/source/detail?r=3793