a little fix for the bag name

This commit is contained in:
JericoFX committed 2025-05-05 19:29:37 -03:00
1 parent f913089d36
commit dc91f98e37
1 file changed
+2 -2
+2 -2
View File
@@ -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