Khalmee-Scoreboard_Callbacks icon

Scoreboard Callbacks

A dependency for other mods, makes modifying the scoreboard easier and fixes mod collisions.

By Khalmee
Last updated a year ago
Total downloads 7276
Total rating 3 
Categories Mods Client-side
Dependency string Khalmee-Scoreboard_Callbacks-1.0.0
Dependants 5 other packages depend on this package

README

Scoreboard Callbacks

Adds callbacks to make modifying the scoreboard easier and eliminates mod collisions. Used as a dependency.

Usage

Currenly, there's 2 functions:

First:

AddCallback_OnScoreboardPlayerUpdate( void functionref( entity, int, int, SuperiorFile ) callbackFunc ), which runs on every scoreboard update for every player on the scoreboard.

Example use:

AddCallback_OnScoreboardPlayerUpdate(testPlayerUpdate)

void function testPlayerUpdate(entity player, int index, int team, SuperiorFile file)
{
}

where player is the current player in the scoreboard, index is that player's index in the scoreboard, team is the player's team (passing that because getting the team from the player entity tends to crash the game), and file contains all data and RUIs of the scoreboard.

Second:

AddCallback_OnScoreboardUpdate( void functionref( SuperiorFile ) callbackFunc ), which runs every time the entire scoreboard gets updated.

Example use:

AddCallback_OnScoreboardUpdate(testSCUpdate)

void function testSCUpdate(SuperiorFile file)
{
}

where file contains all data and RUIs of the scoreboard.

The exact structure of SuperiorFile:

global struct SuperiorFile{
	bool hasFocus = false
	var selectedPlayer
	var prevPlayer
	var nextPlayer

	var scoreboardBg
	var scoreboard
	var background

	array<var> scoreboardOverlays
	array<var> scoreboardElems

	table header = {
		background = null
		gametypeAndMap = null
		gametypeDesc = null
		scoreHeader = null
	}

	var footer
	var pingText

	table teamElems

	table highlightColumns

	var nameEndColumn

	table playerElems

	var scoreboardRUI

	void functionref(entity,var) scoreboardUpdateCallback
}