GetPlayerFromStateBagName
Docslocal retval = GetPlayerFromStateBagName(bagName)Description
On the server this will return the players source, on the client it will return the player handle.
Parameters
| Name | Type | Description |
|---|---|---|
bagName | char* | An internal state bag ID from the argument to a state bag change handler. |
Returns
intReturns an integer value.
Examples
Official
AddStateBagChangeHandler("isDead", null, async (bagName, key, value /* boolean */) => {
const ply = GetPlayerFromStateBagName(bagName);
// The player doesn't exist!
if (ply === 0) return;
console.log(`Player: ${GetPlayerName(ply)} ${value ? 'died!' : 'is alive!'`)
})