to this day I'm not quite sure when to favor events over listeners or vice versa.
For example:
Syntax: Select all
from listeners import OnClientDisconnect
@OnClientDisconnect
def on_client_disconnect(index):
print(index)
Syntax: Select all
from events import Event
from players.helpers import index_from_userid
@Event('player_disconnect')
def on_player_disconnect(event):
print(index_from_userid(event['userid'])
Am I right to assume that the event 'player_disconnect' is fired after the listener 'OnClientDisconnect' has been called? Also, if my assumption is true, can we say that using an event we can declare a callback that simply expects different arguments than 'its listener' would?