From b9c7f0aaafa5605ed56cc495dfd842cfa76a78bb Mon Sep 17 00:00:00 2001 From: Mees van der Wijk Date: Sun, 10 Aug 2025 16:45:42 +0200 Subject: [PATCH] Updated scoreboard --- ModuleServerAPIGameLibScoreboard.md | 133 ++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) diff --git a/ModuleServerAPIGameLibScoreboard.md b/ModuleServerAPIGameLibScoreboard.md index 5ede0f2..5283c9c 100644 --- a/ModuleServerAPIGameLibScoreboard.md +++ b/ModuleServerAPIGameLibScoreboard.md @@ -1,3 +1,136 @@ # ModuleClientApi - GameLib Scoreboard Class representing a Scoreboard of a GameLib Game inside the ModuleServerAPI. + +## Methods + +### clear + +Clear all scores. + +```javascript +Scoreboard.clear(); +``` + +### setScore + +Set the score of a player. + +```javascript +Scoreboard.setScore(player, score); +``` + +| Argument | Type | Description | +| -------- | ------------------------------------------------ | -------------------------------- | +| player | [GamePlayer](./ModuleServerAPIGameLibGamePlayer) | The player to set the score for. | +| score | number | The score to set. | + +### getScore + +Get the score of a player. + +```javascript +Scoreboard.getScore(player); +``` + +| Argument | Type | Description | +| -------- | ------------------------------------------------ | -------------------------------- | +| player | [GamePlayer](./ModuleServerAPIGameLibGamePlayer) | The player to get the score for. | + +**Return** number _The player score._ + +### hasScore + +Check if a player has a score. + +```javascript +Scoreboard.hetScore(player); +``` + +| Argument | Type | Description | +| -------- | ------------------------------------------------ | ---------------------------------- | +| player | [GamePlayer](./ModuleServerAPIGameLibGamePlayer) | The player to check the score for. | + +**Return** boolean _Player has a score._ + +### increaseScore + +Increase the score of a player. + +```javascript +Scoreboard.increaseScore(player, amount); +``` + +| Argument | Type | Description | +| -------- | ------------------------------------------------ | -------------------------------------- | +| player | [GamePlayer](./ModuleServerAPIGameLibGamePlayer) | The player to increase the score for. | +| amount | number | The amount to increase the score with. | + +### decreaseScore + +Decrease the score of a player. + +```javascript +Scoreboard.decreaseScore(player, amount); +``` + +| Argument | Type | Description | +| -------- | ------------------------------------------------ | -------------------------------------- | +| player | [GamePlayer](./ModuleServerAPIGameLibGamePlayer) | The player to decrease the score for. | +| amount | number | The amount to decrease the score with. | + +### updateUnderCondition + +Update the score of a player under a condition. + +```javascript +Scoreboard.updateUnderCondition(condition, player, value); +``` + +| Argument | Type | Description | +| --------- | ------------------------------------------------ | ----------------------------------- | +| condition | "VALUE_IS_LOWER" / "VALUE_IS_HIGHER" | The condition to check. | +| player | [GamePlayer](./ModuleServerAPIGameLibGamePlayer) | The player to update the score for. | +| value | number | The new value of the score. | + +## Constants + +### **READONLY** id + +The id of the scoreboard. + +```javascript +Scoreboard.id; +``` + +### **READONLY** name + +The name of the scoreboard. + +```javascript +Scoreboard.name; +``` + +### **READONLY** formatting + +The formatting of the scoreboard. + +```javascript +Scoreboard.formatting; +``` + +### **READONLY** sorting + +The sorting of the scoreboard. + +```javascript +Scoreboard.sorting; +``` + +### **READONLY** showCount + +The amount of entries to show on the scoreboard. + +```javascript +Scoreboard.showCount; +```