SetPlayerState
Sets a key of a player’s bag, read by every client.
Every client has every player’s bag from its join on - KcdMp.state.player[pid][key]; the client’s own pid is
KcdMp.player_id. Gone with the player’s session.
Syntax
Section titled “Syntax”SetPlayerState(pid, key, value)| Parameter | Type | |
|---|---|---|
pid |
number | the player |
key |
string | 1-48 characters |
value |
string | number | boolean | nil | kept as a string; nil removes the key |
Returns
Section titled “Returns”boolean - false when not connected or out of bounds
Example
Section titled “Example”SetPlayerTeam(pid, 2)SetPlayerState(pid, "team", 2) -- the client scripts colour the label by itSee also
Section titled “See also”GetPlayerState · GetPlayerStates · SetGlobalState · SetPlayerData · the State bags group of the index
