SetPlayerData
Associates a custom key with a value for a given player.
Syntax
SetPlayerData @player "key" value_to_set
Arguments
| Name | Required | Type | Description |
|---|---|---|---|
player | Yes | Player value e.g. @player, with EXACTLY 1 player. | |
key | Yes | Any text e.g. "Hello, World!" | |
value to set | Yes | Any value |
Details
This method ties a specific value to a specific player, allowing you to e.g. keep track of how many seconds each player was on surface zone, as you're tying the amount of time to a specific player, independently of other players. For this, you would create a key e.g. 'surfaceTime', and under that key you can start saving the value. It's basically a dictionary/hashmap attached to a player.
Validated examples using this method
On a running server
Use serhelp SetPlayerData to inspect the reference generated by your installed SER version.