Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Doesn't allow owners to exit a locked vehicle #51

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,14 @@ local function setVehicleDoorLock(vehicle, state, anim)
if state ~= nil then
lockstate = state and 2 or 1
else
lockstate = (GetVehicleDoorLockStatus(vehicle) % 2) + 1 -- (1 % 2) + 1 -> 2 (2 % 2) + 1 -> 1
local currentLockState = GetVehicleDoorLockStatus(vehicle)
local isPedInVehicle = IsPedInVehicle(cache.ped, vehicle, false)
-- Vérifier si le joueur est dans le véhicule et que l'état du verrou est 4, puis le passer à 1
if isPedInVehicle and currentLockState == 4 then
lockstate = 1
else
lockstate = isPedInVehicle and 4 or (currentLockState % 2) + 1 -- Utiliser l'état 4 si le joueur est à l'intérieur, sinon 1 ou 2
artur-michalak marked this conversation as resolved.
Show resolved Hide resolved
end
end

TriggerServerEvent('qb-vehiclekeys:server:setVehLockState', NetworkGetNetworkIdFromEntity(vehicle), lockstate)
Expand Down
Loading