From 6144990abf22dccf34ac5c5b06490958a229dede Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Tue, 17 Jul 2018 21:18:56 +0200 Subject: [PATCH] You can no longer put people in vehicle if they're not handcuffed --- client/main.lua | 42 ++++++++++++++++++++++-------------------- locales/sv.lua | 1 + 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/client/main.lua b/client/main.lua index b2f40ed8..14eff184 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1468,35 +1468,37 @@ end) RegisterNetEvent('esx_policejob:putInVehicle') AddEventHandler('esx_policejob:putInVehicle', function() + local playerPed = PlayerPedId() + local coords = GetEntityCoords(playerPed) - local playerPed = PlayerPedId() - local coords = GetEntityCoords(playerPed) + if not IsHandcuffed then + return + end - if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then + if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then - local vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) + local vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) - if DoesEntityExist(vehicle) then + if DoesEntityExist(vehicle) then - local maxSeats = GetVehicleMaxNumberOfPassengers(vehicle) - local freeSeat = nil + local maxSeats = GetVehicleMaxNumberOfPassengers(vehicle) + local freeSeat = nil - for i=maxSeats - 1, 0, -1 do - if IsVehicleSeatFree(vehicle, i) then - freeSeat = i - break - end - end + for i=maxSeats - 1, 0, -1 do + if IsVehicleSeatFree(vehicle, i) then + freeSeat = i + break + end + end - if freeSeat ~= nil then - TaskWarpPedIntoVehicle(playerPed, vehicle, freeSeat) - DragStatus.IsDragged = false - end + if freeSeat ~= nil then + TaskWarpPedIntoVehicle(playerPed, vehicle, freeSeat) + DragStatus.IsDragged = false + end - end - - end + end + end end) RegisterNetEvent('esx_policejob:OutVehicle') diff --git a/locales/sv.lua b/locales/sv.lua index dc0a6fb4..e348945d 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -35,6 +35,7 @@ Locales['sv'] = { ['put_in_vehicle'] = 'sätt in i fordon', ['out_the_vehicle'] = 'dra ut ur fordon', ['fine'] = 'Ge böter', + ['unpaid_bills'] = 'se obetalda räkningar', ['license_check'] = 'se licenser', ['license_revoke'] = 'återkalla licenser', ['license_revoked'] = 'Ditt ~b~%s~s~ har blivit ~y~återkallat~s~!',