Events/Hooks
The server communicates with the controller through callbacks/events. Some of the more important events are preprocessed by EvoSC to make them easier to use. All those events called "Hooks" will be listed below.
Registering a Hook
To bind a method to an EvoSC-Hook or TM-Event, you simply call Hook::add('NameOfHookOrEvent', [FullyQualifiedClassName, 'methodName')
inside the start method of the module.
You can always create a hook for the methods listed in https://github.com/maniaplanet/script-xmlrpc/blob/master/XmlRpcListing.md#callbacks
Hooks
Name | Passed arguments | Description |
PlayerConnect | Player $player | Called when a player spawns in the server |
PlayerDisconnect | Player $player | Called when a player leaves the server |
PlayerFinish | Player $player, int $timeInMilliseconds, string $checkpointsCommaSeparated | Called when a player finishes or resets, then the time is 0 |
PlayerCheckpoint | Player $player, int $timeInMilliseconds, int $checkpointNumber, bool $isFinish | Called when a player passes a checkpoint |
PlayerStartCountdown | Player $player | Called when the 3-2-1-countdown starts for a player |
PlayerPb | Player $player, int $timeInMilliseconds | Called when player drives a new personal best |
BeginMatch | - | Called when the countdown/match starts |
EndMatch | - | Called when the match ended |
BeginMap | Map $map | Called when a map starts and when EvoSC boots |
EndMap | Map $map | Called when a map ends |
MatchSettingsLoaded | string $matchSettingsFile | Called when a match-settings is loaded |
AddedTimeChanged | int $addedSeconds | Called when the timelimit was in/decreased |
MapPoolUpdated | - | Called when the maplist changed |
MatchTrackerUpdated | Collection $scores | Called when scores affecting the match changed (player finished with better time, got points, etc...) |
MapQueueUpdated | Collection $mapsInQueue | Called when a map was added/removed to/from the jukebox |
WarmUpStart | - | Called when the warmup phase starts |
WarmUpEnd | - | Called when the warmup phase ends |
AnnounceWinner | Player $winner | Called on match end, when the winner is decided |
ShowScores | Collection $allPlayersThatParticipatedInMatch | Called when ther end result is displayed after the match ended |
GroupChanged | Player $player | Called when the group of a player was changed |