Server Hooks

Server scripts run on the game server. These hooks handle authoritative game logic and player management.

Lifecycle

start

Runs when the game starts

Signature: action()

public action start() {
    # TODO: Implement
}

update

Runs every game tick

Signature: action(num)

Parameters:

NameTypeDescription
deltanumTime elapsed since last tick
public action update(num delta) {
    # TODO: Implement
}

Player Events

onPlayerSpawn

Player spawns in

Signature: action(str)

Parameters:

NameTypeDescription
idstrPlayer ID
public action onPlayerSpawn(str id) {
    # TODO: Implement
}

onPlayerDeath

Player died

Signature: action(str, str)

Parameters:

NameTypeDescription
idstrPlayer ID
killerIDstrID of the player who killed
public action onPlayerDeath(str id, str killerID) {
    # TODO: Implement
}

onPlayerDamage

Player got damaged

Signature: action(str, str, num)

Parameters:

NameTypeDescription
idstrPlayer ID
doerIDstrNo description available
amountnumAmount value
public action onPlayerDamage(str id, str doerID, num amount) {
    # TODO: Implement
}

onPlayerUpdate

Player update

Signature: action(str, num, obj)

Parameters:

NameTypeDescription
idstrPlayer ID
deltanumTime elapsed since last tick
inputsobjInput data object
public action onPlayerUpdate(str id, num delta, obj inputs) {
    # TODO: Implement
}

onPlayerLeave

When a player leaves the server

Signature: action(str)

Parameters:

NameTypeDescription
playerIDstrNo description available
public action onPlayerLeave(str playerID) {
    # TODO: Implement
}

Network Events

onNetworkMessage

Server receives network message

Signature: action(str, obj, str)

Parameters:

NameTypeDescription
idstrPlayer ID
dataobjNo description available
playerIDstrNo description available
public action onNetworkMessage(str id, obj data, str playerID) {
    # TODO: Implement
}

onChatMessage

Server receives chat message

Signature: action(str, str)

Parameters:

NameTypeDescription
msgstrMessage content
playerIDstrNo description available
public action onChatMessage(str msg, str playerID) {
    # TODO: Implement
}

Game Events

onCustomTrigger

Called from Custom Trigger Action

Signature: action(str, str, num)

Parameters:

NameTypeDescription
playerIDstrNo description available
customParamstrNo description available
valuenumNo description available
public action onCustomTrigger(str playerID, str customParam, num value) {
    # TODO: Implement
}

onGameEnd

Runs when the round ends

Signature: action()

public action onGameEnd() {
    # TODO: Implement
}

onAdFinished

When a player finished a video

Signature: action(str, bool)

Parameters:

NameTypeDescription
playerIDstrNo description available
successboolNo description available
public action onAdFinished(str playerID, bool success) {
    # TODO: Implement
}

onServerClosed

Runs when the server closes

Signature: action()

public action onServerClosed() {
    # TODO: Implement
}

onDepositBoxChange

When a deposit box is changed

Signature: action(str, str, num, num)

Parameters:

NameTypeDescription
objectIDstrNo description available
playerIDstrNo description available
amountnumAmount value
finalAmountnumNo description available
public action onDepositBoxChange(str objectID, str playerID, num amount, num finalAmount) {
    # TODO: Implement
}

Other

shouldTrigger

Should trigger a trigger? Return true or false

Signature: bool action(str, str, str)

Parameters:

NameTypeDescription
playerIDstrNo description available
triggerIDstrNo description available
customParamstrNo description available
public action shouldTrigger(str playerID, str triggerID, str customParam) {
return true;
}