Client/no_escrow.lua
-- | # Load Script ------------------------------------------------------------------------------------
if Config.Settings['Framework'] == 'esx' or Config.Settings['Framework'] == 'old-esx' then
RegisterNetEvent('esx:playerLoaded', function()
TriggerEvent('thug-dispatch:client:load')
end)
RegisterNetEvent('esx:setJob', function(job)
TriggerEvent('thug-dispatch:client:load')
end)
elseif Config.Settings['Framework'] == 'qb' or Config.Settings['Framework'] == 'old-qb' or Config.Settings['Framework'] == 'qbox' then
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
TriggerEvent('thug-dispatch:client:load')
end)
RegisterNetEvent('QBCore:Client:OnJobUpdate', function(job)
TriggerEvent('thug-dispatch:client:load')
end)
end
-- | # Customizable Contents ------------------------------------------------------------------------------------
Get_Contents = function(Ped, Location, Vehicle, Weapon, Alert_Cfg)
local Contents = {}
for _, Content in pairs(Alert_Cfg.Contents) do
if Content == 'Location' then
Contents.Location = Location.Label
elseif Content == 'Heading' then
Contents.Heading = Get_Direction(Ped)
elseif Content == 'Weapon' then
Contents.Weapon = (Weapon and Weapon.Label or Config.Locale['Unknown']).." (Class "..(Weapon.Class or Config.Locale['Unknown'])..")"
elseif Content == 'Player_Name' then
Contents.Player_Name = Player_Info.Name
elseif Content == 'Player_Gender' then
Contents.Player_Gender = Get_Gender(Player_Info.Gender)
elseif Content == 'Vehicle' then
Contents.Vehicle = (Vehicle and Vehicle.Model or Config.Locale['Unknown']).. " ("..(Vehicle.Class or Config.Locale['Unknown'])..")"
elseif Content == 'Vehicle_Plate' then
Contents.Vehicle_Plate = Vehicle and Vehicle.Plate or Config.Locale['Unknown']
elseif Content == 'Vehicle_Color' then
Contents.Vehicle_Color = Vehicle and Vehicle.Color or Config.Locale['Unknown']
elseif Content == 'Vehicle_Doors' then
Contents.Vehicle_Doors = Vehicle and Vehicle.Doors or Config.Locale['Unknown']
end
end
return Contents
end
-- | # Default Alerts ------------------------------------------------------------------------------------
AddEventHandler('CEventGunShot', function(Witnesses, Ped)
if (Get_Allows().Its_A_Unit) or (not Config.Settings['Default_Alerts'].Shooting) or (Config.Settings['Suppressor_Function'] and IsPedCurrentWeaponSilenced(Ped)) or (Config.Settings['Whitelisted_Weapons'] and Get_Weapon(GetSelectedPedWeapon(Ped)).Whitelisted) or (cache.ped ~= Ped) then return end
if IsPedInAnyVehicle(Ped, false) then
exports['thug-dispatch']:Alert("Drive_By")
else
exports['thug-dispatch']:Alert("Shooting")
end
end)
AddEventHandler('CEventShockingSeenMeleeAction', function(Witnesses, Ped)
if (Get_Allows().Its_A_Unit) or (not Config.Settings['Default_Alerts'].Fighting) or (cache.ped ~= Ped) then return end
exports['thug-dispatch']:Alert("Fighting")
end)
AddEventHandler('CEventPedJackingMyVehicle', function(_, Ped)
if (Get_Allows().Its_A_Unit) or (cache.ped ~= Ped) then return end
if GetVehiclePedIsUsing(Ped) then
if Config.Settings['Default_Alerts'].Gov_Vehicle_Theft and Is_Gov_Vehicle() then
exports['thug-dispatch']:Alert("Gov_Vehicle_Theft")
elseif Config.Settings['Default_Alerts'].Vehicle_Theft and not Is_Gov_Vehicle() then
exports['thug-dispatch']:Alert("Vehicle_Theft")
end
end
end)
AddEventHandler('CEventShockingCarAlarm', function(_, Ped)
if (Get_Allows().Its_A_Unit) or (cache.ped ~= Ped) then return end
if GetVehiclePedIsUsing(Ped) then
if Config.Settings['Default_Alerts'].Gov_Vehicle_Theft and Is_Gov_Vehicle() then
exports['thug-dispatch']:Alert("Gov_Vehicle_Theft")
elseif Config.Settings['Default_Alerts'].Vehicle_Theft and not Is_Gov_Vehicle() then
exports['thug-dispatch']:Alert("Vehicle_Theft")
end
end
end)
Last updated