From dc91f98e37d17519e7b84397281d4fe735b734b4 Mon Sep 17 00:00:00 2001 From: JericoFX Date: Mon, 5 May 2025 19:29:37 -0300 Subject: [PATCH] a little fix for the bag name --- lib/statebags/client/client.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/statebags/client/client.lua b/lib/statebags/client/client.lua index 0668718..2c2c364 100644 --- a/lib/statebags/client/client.lua +++ b/lib/statebags/client/client.lua @@ -33,10 +33,10 @@ end ---@param callback function The callback function to handle changes (function(playerId, key, value, lastValue, replicated)) ---@return number handler The handler ID function ClientStateBag.AddPlayerChangeHandler(keyName, filter, callback) - return AddStateBagChangeHandler(keyName, filter and GetPlayerServerId(PlayerId()) or nil, + return AddStateBagChangeHandler(keyName, filter and ("player:%s"):format(GetPlayerServerId(PlayerId())) or nil, function(bagName, key, value, lastValue, replicated) local actualPlayerId = getPlayerFromStateBagName(bagName) - if DoesEntityExist(actualPlayerId) and (not actualPlayerId == PlayerPedId()) then -- you cant have a statebag value if you are not the player + if DoesEntityExist(actualPlayerId) and (actualPlayerId ~= PlayerPedId()) then -- you cant have a statebag value if you are not the player return false end if actualPlayerId and actualPlayerId ~= 0 then