{"hash":"0xA56135E0","ns":"CFX","name":"GET_PLAYER_FROM_STATE_BAG_NAME","slug":"GET_PLAYER_FROM_STATE_BAG_NAME","official":true,"named":true,"luaName":"GetPlayerFromStateBagName","game":"cfx","apiset":"shared","returnType":"int","params":[{"name":"bagName","type":"char*","description":"An internal state bag ID from the argument to a state bag change handler."}],"returnsDescription":"The player handle or 0 if the state bag name did not refer to a player, or the player does not exist.","summary":"On the server this will return the players source, on the client it will return the player handle.","descriptions":[{"source":"cfx","format":"md","body":"On the server this will return the players source, on the client it will return the player handle."}],"examples":[{"lang":"js","code":"AddStateBagChangeHandler(\"isDead\", null, async (bagName, key, value /* boolean */) => {\n    const ply = GetPlayerFromStateBagName(bagName);\n    // The player doesn't exist!\n    if (ply === 0) return;\n    console.log(`Player: ${GetPlayerName(ply)} ${value ? 'died!' : 'is alive!'`)\n})","source":"cfx"},{"lang":"lua","code":"AddStateBagChangeHandler(\"isDead\", nil, function(bagName, key, value) \n    local ply = GetPlayerFromStateBagName(bagName)\n    -- The player doesn't exist!\n    if ply == 0 then return end\n    print(\"Player: \" .. GetPlayerName(ply) .. value and 'died!' or 'is alive!')\nend)","source":"cfx"}],"aliases":[],"enums":[],"related":[],"sources":["cfx"],"doc":3,"url":"https://natives.borderlinerp.com/natives/CFX/GET_PLAYER_FROM_STATE_BAG_NAME","markdownUrl":"https://natives.borderlinerp.com/natives/CFX/GET_PLAYER_FROM_STATE_BAG_NAME.md","snippets":{"lua":"local retval = GetPlayerFromStateBagName(bagName)","luaInvoke":"local retval = Citizen.InvokeNative(0xa56135e0, bagName, Citizen.ResultAsInteger())","js":"const retval = GetPlayerFromStateBagName(bagName);","jsInvoke":"const retval = Citizen.invokeNative('0xa56135e0', bagName, Citizen.returnResultAnyway(), Citizen.resultAsInteger());","csharp":"int retval = Function.Call<int>((Hash)0xa56135e0, bagName);","notes":[]}}