You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever I try to create a new class object with enew of a player element, it throws a warning to the debug log, saying that onElementDestroy event is already being handled by the function, how is this possible? MTA restricts listening to certain player events?
WARNING: classlib.lua:59: Bad usage @ 'addEventHandler' ['onElementDestroy' with this function is already handled]
I added getElementType(element) ~= 'player' to my version, but if I understand it right, we should never ignore this event as it deletes stuff from memory and if it's never deleted we have a memory leak.
Using onPlayerQuit instead of onElementDestroy did not resolve the warning.
The text was updated successfully, but these errors were encountered:
Therefore with your enew after :spawn there's an additional onElementDestroy handler attached to the element, causing the warning. I think we should change enew to avoid creating a new table entry if there's already an entry for that element.
In general I'd suggest you use registerElementClass like this: registerElementClass("player", Classes.player)
This automatically makes all player elements become a Classes.player upon first access of any property.
Whenever I try to create a new class object with
enew
of a player element, it throws a warning to the debug log, saying that onElementDestroy event is already being handled by the function, how is this possible? MTA restricts listening to certain player events?enew( getPlayerFromName( 'Socialz' ), classes.player )
WARNING: classlib.lua:59: Bad usage @ 'addEventHandler' ['onElementDestroy' with this function is already handled]
I added
getElementType(element) ~= 'player'
to my version, but if I understand it right, we should never ignore this event as it deletes stuff from memory and if it's never deleted we have a memory leak.Using onPlayerQuit instead of onElementDestroy did not resolve the warning.
The text was updated successfully, but these errors were encountered: