[QBCORE] Police Unlock Vehicles (Progressbar)
DarylDixon
Mit diesem kleinen Schnipsel kann das LSPD nun ganz einfach Fahrzeuge mittels Radialmenu öffnen! (+Progressbar)
Man könnte noch eine Abfrage für ein Item einbauen oder auch dem Mechaniker diese Aktion geben!
Es liegt an Euch was ihr daraus macht!
Vehiclekeys
Client Side
Code
RegisterNetEvent('vehiclekeys:client:LSPDVehcieleAction')
AddEventHandler('vehiclekeys:client:LSPDVehcieleAction', function()
local ped = PlayerPedId()
local pedcoord = GetEntityCoords(ped)
local vehicle = QBCore.Functions.GetClosestVehicle()
local vehiclepos = GetEntityCoords(vehicle)
local PlayerJob = QBCore.Functions.GetPlayerData().job
if #(pedcoord - vehiclepos) < 2.5 then
if (GetVehicleDoorLockStatus(vehicle) == 0) then QBCore.Functions.Notify("Fahrzeug bereits offen", "primary") return end
if (PlayerJob.name == 'police' and PlayerJob.onduty) then
TriggerEvent('animations:client:EmoteCommandStart', {"picklock"})
QBCore.Functions.Progressbar("policeunlock", "Fahrzeug öffnen !", 6000, false, true, {
disableMovement = true,
disableCarMovement = false,
disableMouse = false,
disableCombat = true,
}, {}, {}, {}, function( )
TriggerEvent('animations:client:EmoteCommandStart', {"c"})
Wait(600)
QBCore.Functions.Notify('Fahrzeug entriegelt.', 'success')
SetVehicleDoorsLocked(vehicle, 0)
TriggerEvent('vehiclekeys:client:SetOwner', GetVehicleNumberPlateText(vehicle))
end, function() -- cancel
QBCore.Functions.Notify("Aktion abgebrochen", "error")
TriggerEvent('animations:client:EmoteCommandStart', {"c"})
end)
elseif (not PlayerJob.name == 'police') then
QBCore.Functions.Notify("Du bist kein Cop", "error")
end
else
QBCore.Functions.Notify("Kein Fahrzeug in der Nähe", "error")
end
end)
Radialmenu
config.lua
Code
{
id = 'unlockveh',
title = 'Fahrzeug öffnen',
icon = 'user-lock',
type = 'client',
event = 'vehiclekeys:client:LSPDVehcieleAction',
shouldClose = true
},