Skip to content
This repository was archived by the owner on Apr 28, 2026. It is now read-only.

fix/client: fix for the new canSteal state to Allow if player is police or canSteal#35

Merged
antond15 merged 2 commits into
CommunityOx:mainfrom
Devexity-fivem:main
Aug 5, 2025
Merged

fix/client: fix for the new canSteal state to Allow if player is police or canSteal#35
antond15 merged 2 commits into
CommunityOx:mainfrom
Devexity-fivem:main

Conversation

@Devexity-fivem

Copy link
Copy Markdown

this fix handles the /steal command only working for police, with this pull request it will work as intended for both police and players that have canSteal = true

fix for the new canSteal state to Allow if player is police or canSteal

@unitysync unitysync left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your logic on client is fine, however this will not work as-is, since the server purely checks the canSteal state without regard for police group status.

ox_inventory/server.lua

Lines 289 to 297 in 29b32e0

lib.callback.register('ox_inventory:openInventory', function(source, invType, data)
if invType == 'player' and source ~= data then
local serverId = type(data) == 'table' and data.id or data
if source == serverId or type(serverId) ~= 'number' or not Player(serverId).state.canSteal then return end
end
return openInventory(source, invType, data)
end)

Please update the server to also check whether the user has the police group.

@Devexity-fivem

Copy link
Copy Markdown
Author

ahh okay could i just do this with the server.hasGroup? like how its done for evidence?

update callback for cansteal and job group police
@ESK0

ESK0 commented Aug 4, 2025

Copy link
Copy Markdown
Member

Whats the need? Police can handcuff the person and search him aftewards. I see no point in bypassing the canSteal state

@Devexity-fivem

Copy link
Copy Markdown
Author

if not targetCoords or #(targetCoords - GetEntityCoords(playerPed)) > 1.8 or not (client.hasGroup(shared.police) or not Player(serverId).state.canSteal) then

the issue me and other ppl seem to be having was with this line even if your police u cannot open inventory and the cansteal was never working as indented you would always get cannot open this inventory even tho the canopentarget reqs were true

@antond15 antond15 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@antond15 antond15 merged commit 2163cf5 into CommunityOx:main Aug 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants