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

Changes to fxmanifest and config #23

Merged
merged 5 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
44 changes: 22 additions & 22 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CreateThread(function()
local plate = GetPlate(entering)

local driver = GetPedInVehicleSeat(entering, -1)
for _, veh in ipairs(Config.ImmuneVehicles) do
for _, veh in ipairs(Config.immuneVehicles) do
if GetEntityModel(entering) == joaat(veh) then
carIsImmune = true
end
Expand Down Expand Up @@ -54,7 +54,7 @@ CreateThread(function()
isTakingKeys = false
end
end
elseif Config.LockNPCDrivingCars then
elseif Config.lockNPCDrivingCars then
TriggerServerEvent('qb-vehiclekeys:server:setVehLockState', NetworkGetNetworkIdFromEntity(entering), 2)
else
TriggerServerEvent('qb-vehiclekeys:server:setVehLockState', NetworkGetNetworkIdFromEntity(entering), 1)
Expand All @@ -70,7 +70,7 @@ CreateThread(function()
end
-- Parked car logic
elseif driver == 0 and entering ~= lastPickedVehicle and not HasKeys(plate) and not isTakingKeys then
if Config.LockNPCParkedCars then
if Config.lockNPCParkedCars then
TriggerServerEvent('qb-vehiclekeys:server:setVehLockState', NetworkGetNetworkIdFromEntity(entering), 2)
else
TriggerServerEvent('qb-vehiclekeys:server:setVehLockState', NetworkGetNetworkIdFromEntity(entering), 1)
Expand All @@ -96,12 +96,12 @@ CreateThread(function()
end
end

if Config.CarJackEnable and canCarjack then
if Config.carJackEnable and canCarjack then
local aiming, target = GetEntityPlayerIsFreeAimingAt(cache.playerId)
if aiming and (target ~= nil and target ~= 0) then
if DoesEntityExist(target) and IsPedInAnyVehicle(target, false) and not IsEntityDead(target) and not IsPedAPlayer(target) then
local targetveh = GetVehiclePedIsIn(target)
for _, veh in ipairs(Config.ImmuneVehicles) do
for _, veh in ipairs(Config.immuneVehicles) do
if GetEntityModel(targetveh) == joaat(veh) then
carIsImmune = true
end
Expand All @@ -123,7 +123,7 @@ end)

function isBlacklistedVehicle(vehicle)
local isBlacklisted = false
for _,v in ipairs(Config.NoLockVehicles) do
for _,v in ipairs(Config.noLockVehicles) do
if joaat(v) == GetEntityModel(vehicle) then
isBlacklisted = true
break;
Expand Down Expand Up @@ -281,9 +281,9 @@ end
function AreKeysJobShared(veh)
local vehName = GetDisplayNameFromVehicleModel(GetEntityModel(veh))
local vehPlate = GetVehicleNumberPlateText(veh)
for job, v in pairs(Config.SharedKeys) do
for job, v in pairs(Config.sharedKeys) do
if job == QBX.PlayerData.job.name then
if Config.SharedKeys[job].requireOnduty and not QBX.PlayerData.job.onduty then return false end
if Config.sharedKeys[job].requireOnduty and not QBX.PlayerData.job.onduty then return false end
for _, vehicle in pairs(v.vehicles) do
if string.upper(vehicle) == string.upper(vehName) then
if not HasKeys(vehPlate) then
Expand Down Expand Up @@ -357,7 +357,7 @@ end
function IsBlacklistedWeapon()
local weapon = GetSelectedPedWeapon(cache.ped)
if weapon ~= nil then
for _, v in pairs(Config.NoCarjackWeapons) do
for _, v in pairs(Config.noCarjackWeapons) do
if weapon == joaat(v) then
return true
end
Expand Down Expand Up @@ -409,11 +409,11 @@ function LockpickFinishCallback(success)
end

if usingAdvanced then
if chance <= Config.RemoveLockpickAdvanced then
if chance <= Config.removeLockpickAdvanced[GetVehicleClass(vehicle)] then
TriggerServerEvent("qb-vehiclekeys:server:breakLockpick", "advancedlockpick")
end
else
if chance <= Config.RemoveLockpickNormal then
if chance <= Config.removeLockpickNormal[GetVehicleClass(vehicle)] then
TriggerServerEvent("qb-vehiclekeys:server:breakLockpick", "lockpick")
end
end
Expand Down Expand Up @@ -442,13 +442,13 @@ function Hotwire(vehicle, plate)
}
}) then
StopAnimTask(cache.ped, "anim@amb@clubhouse@tutorial@bkr_tut_ig3@", "machinic_loop_mechandplayer", 1.0)
if (math.random() <= Config.HotwireChance) then
if (math.random() <= Config.hotwireChance[GetVehicleClass(vehicle)]) then
TriggerServerEvent('qb-vehiclekeys:server:AcquireVehicleKeys', plate)
else
TriggerServerEvent('hud:server:GainStress', math.random(1, 4))
exports.qbx_core:Notify(Lang:t("notify.failed_lockedpick"), 'error')
end
Wait(Config.TimeBetweenHotwires)
Wait(Config.timeBetweenHotwires)
isHotwiring = false
else
StopAnimTask(cache.ped, "anim@amb@clubhouse@tutorial@bkr_tut_ig3@", "machinic_loop_mechandplayer", 1.0)
Expand All @@ -461,7 +461,7 @@ function Hotwire(vehicle, plate)
end

function CarjackVehicle(target)
if not Config.CarJackEnable then return end
if not Config.carJackEnable then return end
isCarjacking = true
canCarjack = false
lib.requestAnimDict('mp_am_hold_up')
Expand All @@ -487,7 +487,7 @@ function CarjackVehicle(target)
end)

if lib.progressCircle({
duration = Config.CarjackingTime,
duration = Config.carjackingTime,
label = Lang:t("progress.attempting_carjack"),
position = 'bottom',
useWhileDead = false,
Expand All @@ -499,8 +499,8 @@ function CarjackVehicle(target)
local hasWeapon, weaponHash = GetCurrentPedWeapon(cache.ped, true)
if hasWeapon and isCarjacking then
local carjackChance
if Config.CarjackChance[tostring(GetWeapontypeGroup(weaponHash))] then
carjackChance = Config.CarjackChance[tostring(GetWeapontypeGroup(weaponHash))]
if Config.carjackChance[tostring(GetWeapontypeGroup(weaponHash))] then
carjackChance = Config.carjackChance[tostring(GetWeapontypeGroup(weaponHash))]
else
carjackChance = 0.5
end
Expand All @@ -527,28 +527,28 @@ function CarjackVehicle(target)
isCarjacking = false
Wait(2000)
AttemptPoliceAlert("carjack")
Wait(Config.DelayBetweenCarjackings)
Wait(Config.delayBetweenCarjackings)
canCarjack = true
end
else
MakePedFlee(target)
isCarjacking = false
Wait(Config.DelayBetweenCarjackings)
Wait(Config.delayBetweenCarjackings)
canCarjack = true
end
end

function AttemptPoliceAlert(type)
if not alertSend then
local chance = Config.PoliceAlertChance
local chance = Config.policeAlertChance
if GetClockHours() >= 1 and GetClockHours() <= 6 then
chance = Config.PoliceNightAlertChance
chance = Config.policeNightAlertChance
end
if math.random() <= chance then
TriggerServerEvent('police:server:policeAlert', Lang:t("info.vehicle_theft") .. type)
end
alertSend = true
SetTimeout(Config.AlertCooldown, function()
SetTimeout(Config.alertCooldown, function()
alertSend = false
end)
end
Expand Down
Loading
Loading