Skip to main content

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

NamePassed argumentsDescription
PlayerConnectPlayer $playerCalled when a player spawns in the server
PlayerDisconnectPlayer $playerCalled when a player leaves the server
PlayerFinishPlayer $player, int $timeInMilliseconds, string $checkpointsCommaSeparatedCalled when a player finishes or resets, then the time is 0
PlayerCheckpointPlayer $player, int $timeInMilliseconds, int $checkpointNumber, bool $isFinishCalled when a player passes a checkpoint
PlayerStartCountdownPlayer $playerCalled when the 3-2-1-countdown starts for a player
PlayerPbPlayer $player, int $timeInMillisecondsCalled when player drives a new personal best
BeginMatch-Called when the countdown/match starts
EndMatch-Called when the match ended
BeginMapMap $mapCalled when a map starts and when EvoSC boots
EndMapMap $mapCalled when a map ends
MatchSettingsLoadedstring $matchSettingsFileCalled when a match-settings is loaded
AddedTimeChangedint $addedSecondsCalled when the timelimit was in/decreased
MapPoolUpdated-Called when the maplist changed
MatchTrackerUpdatedCollection $scoresCalled when scores affecting the match changed (player finished with better time, got points, etc...)
MapQueueUpdatedCollection $mapsInQueueCalled when a map was added/removed to/from the jukebox
WarmUpStart-Called when the warmup phase starts
WarmUpEnd-Called when the warmup phase ends
AnnounceWinnerPlayer $winnerCalled on match end, when the winner is decided
ShowScoresCollection $allPlayersThatParticipatedInMatchCalled when ther end result is displayed after the match ended
GroupChangedPlayer $playerCalled when the group of a player was changed