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:
| Name | Type | Description |
|---|---|---|
delta | num | Time elapsed since last tick |
public action update(num delta) {
# TODO: Implement
}
Player Events
onPlayerSpawn
Player spawns in
Signature: action(str)
Parameters:
| Name | Type | Description |
|---|---|---|
id | str | Player ID |
public action onPlayerSpawn(str id) {
# TODO: Implement
}
onPlayerDeath
Player died
Signature: action(str, str)
Parameters:
| Name | Type | Description |
|---|---|---|
id | str | Player ID |
killerID | str | ID of the player who killed |
public action onPlayerDeath(str id, str killerID) {
# TODO: Implement
}
onPlayerDamage
Player got damaged
Signature: action(str, str, num)
Parameters:
| Name | Type | Description |
|---|---|---|
id | str | Player ID |
doerID | str | No description available |
amount | num | Amount value |
public action onPlayerDamage(str id, str doerID, num amount) {
# TODO: Implement
}
onPlayerUpdate
Player update
Signature: action(str, num, obj)
Parameters:
| Name | Type | Description |
|---|---|---|
id | str | Player ID |
delta | num | Time elapsed since last tick |
inputs | obj | Input data object |
public action onPlayerUpdate(str id, num delta, obj inputs) {
# TODO: Implement
}
onPlayerLeave
When a player leaves the server
Signature: action(str)
Parameters:
| Name | Type | Description |
|---|---|---|
playerID | str | No description available |
public action onPlayerLeave(str playerID) {
# TODO: Implement
}
Network Events
onNetworkMessage
Server receives network message
Signature: action(str, obj, str)
Parameters:
| Name | Type | Description |
|---|---|---|
id | str | Player ID |
data | obj | No description available |
playerID | str | No description available |
public action onNetworkMessage(str id, obj data, str playerID) {
# TODO: Implement
}
onChatMessage
Server receives chat message
Signature: action(str, str)
Parameters:
| Name | Type | Description |
|---|---|---|
msg | str | Message content |
playerID | str | No 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:
| Name | Type | Description |
|---|---|---|
playerID | str | No description available |
customParam | str | No description available |
value | num | No 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:
| Name | Type | Description |
|---|---|---|
playerID | str | No description available |
success | bool | No 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:
| Name | Type | Description |
|---|---|---|
objectID | str | No description available |
playerID | str | No description available |
amount | num | Amount value |
finalAmount | num | No 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:
| Name | Type | Description |
|---|---|---|
playerID | str | No description available |
triggerID | str | No description available |
customParam | str | No description available |
public action shouldTrigger(str playerID, str triggerID, str customParam) {
return true;
}