structura foldere
mutat kq- folders in un singur folder [kq]
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
-- Gang and police check variables
|
||||
local heistAllowed = true
|
||||
local gangCheckDone = false
|
||||
|
||||
-- Check if the player meets requirements to participate in the heist
|
||||
function CheckHeistRequirements()
|
||||
if Config.requireGang then
|
||||
if not IsInGang() then
|
||||
ShowTooltip(L('~r~You must be in a gang to participate in this heist'))
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function AfterTruckCreated(vehicle)
|
||||
|
||||
end
|
||||
|
||||
function AfterTrailerCreated(vehicle)
|
||||
|
||||
end
|
||||
|
||||
function AfterTrailerVehicleCreated(vehicle)
|
||||
|
||||
end
|
||||
|
||||
function AfterDriverCreated(ped)
|
||||
|
||||
end
|
||||
|
||||
function AfterPassengerCreated(ped)
|
||||
|
||||
end
|
||||
|
||||
function AfterSupportVehicleCreated(vehicle)
|
||||
|
||||
end
|
||||
|
||||
function AfterSupportPedCreated(ped)
|
||||
|
||||
end
|
||||
|
||||
function OnStartOpeningTrailer()
|
||||
if not CheckHeistRequirements() then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function OnTrailerOpened()
|
||||
|
||||
end
|
||||
|
||||
function OnVehicleDetach(vehicle)
|
||||
|
||||
end
|
||||
|
||||
function DrawCustomMarker(dropCoords)
|
||||
DrawMarker(36, dropCoords.x, dropCoords.y, dropCoords.z + 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 3.0, 3.0, 210, 232, 7, 50, 0, 1, 0, 0)
|
||||
end
|
||||
|
||||
RegisterNetEvent('kq_carheist:dropOffCompleted')
|
||||
AddEventHandler('kq_carheist:dropOffCompleted', function(reward, losses, vehName)
|
||||
if losses > 0 then
|
||||
Alert(L('{vehicle} dropped off'):gsub('{vehicle}', vehName), (L('You made ~g~${reward}\n~r~${losses} deducted due to vehicle damage')):gsub('{reward}', reward):gsub('{losses}', losses), 5000)
|
||||
else
|
||||
Alert(L('{vehicle} dropped off'):gsub('{vehicle}', vehName), (L('You made ~g~${reward}')):gsub('{reward}', reward), 5000)
|
||||
end
|
||||
PlaySoundFrontend(-1, 'PROPERTY_PURCHASE', 'HUD_AWARDS', false)
|
||||
end)
|
||||
|
||||
|
||||
function SendAnnouncementMessage(message, subtitle, coords)
|
||||
BeginTextCommandThefeedPost("STRING")
|
||||
AddTextComponentSubstringPlayerName(message)
|
||||
|
||||
-- Set the notification icon, title and subtitle.
|
||||
local title = L('Martin')
|
||||
local iconType = 0
|
||||
local flash = false -- Flash doesn't seem to work no matter what.
|
||||
EndTextCommandThefeedPostMessagetext("CHAR_MARTIN", "CHAR_MARTIN", flash, iconType, title, subtitle)
|
||||
|
||||
-- Draw the notification
|
||||
local showInBrief = true
|
||||
local blink = false -- blink doesn't work when using icon notifications.
|
||||
EndTextCommandThefeedPostTicker(blink, showInBrief)
|
||||
|
||||
local blipConf = Config.announcementBlip.primary
|
||||
CreateTemporaryBlip(coords, blipConf.sprite, blipConf.color, blipConf.alpha, blipConf.scale, L('Car transport'), blipConf.shortRange, true)
|
||||
|
||||
blipConf = Config.announcementBlip.secondary
|
||||
CreateTemporaryBlip(coords, blipConf.sprite, blipConf.color, blipConf.alpha, blipConf.scale, L('Car transport'), blipConf.shortRange)
|
||||
end
|
||||
|
||||
-- This function is responsible for creating the text shown on the bottom of the screen
|
||||
function DrawMissionText(text, time)
|
||||
SetTextEntry_2("STRING")
|
||||
AddTextComponentString(text)
|
||||
DrawSubtitleTimed(time or 30000, 1)
|
||||
end
|
||||
|
||||
-- This function is responsible for all the tooltips displayed on top right of the screen, you could
|
||||
-- replace it with a custom notification etc.
|
||||
function ShowTooltip(message)
|
||||
SetTextComponentFormat("STRING")
|
||||
AddTextComponentString(message)
|
||||
EndTextCommandDisplayHelp(0, 0, 0, -1)
|
||||
end
|
||||
|
||||
-- This function is responsible for drawing all the 3d texts ('Press [E] to prepare for an engine swap' e.g)
|
||||
function Draw3DText(x, y, z, textInput, fontId, scaleX, scaleY)
|
||||
local px, py, pz = table.unpack(GetGameplayCamCoords())
|
||||
local dist = GetDistanceBetweenCoords(px, py, pz, x, y, z, true)
|
||||
local scale = (1 / dist) * 20
|
||||
local fov = (1 / GetGameplayCamFov()) * 100
|
||||
local scale = scale * fov
|
||||
SetTextScale(scaleX * scale, scaleY * scale)
|
||||
SetTextFont(fontId)
|
||||
SetTextProportional(1)
|
||||
SetTextDropshadow(1, 1, 1, 1, 255)
|
||||
SetTextEdge(2, 0, 0, 0, 150)
|
||||
SetTextDropShadow()
|
||||
SetTextOutline()
|
||||
SetTextEntry("STRING")
|
||||
SetTextCentre(1)
|
||||
AddTextComponentString(textInput)
|
||||
SetDrawOrigin(x, y, z, 0)
|
||||
DrawText(0.0, 0.0)
|
||||
ClearDrawOrigin()
|
||||
end
|
||||
@@ -0,0 +1,39 @@
|
||||
if Config.esxSettings.enabled then
|
||||
ESX = nil
|
||||
|
||||
|
||||
if Config.esxSettings.useNewESXExport then
|
||||
ESX = exports['es_extended']:getSharedObject()
|
||||
else
|
||||
Citizen.CreateThread(function()
|
||||
while ESX == nil do
|
||||
TriggerEvent('esx:getSharedObject', function(obj)
|
||||
ESX = obj
|
||||
end)
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while ESX == nil or ESX.GetPlayerData().job == nil do
|
||||
Citizen.Wait(10)
|
||||
end
|
||||
|
||||
ESX.PlayerData = ESX.GetPlayerData()
|
||||
TriggerServerEvent('kq_carheist:playerLoaded')
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:setJob')
|
||||
AddEventHandler('esx:setJob', function(job)
|
||||
ESX.PlayerData.job = job
|
||||
ClearPoliceBlips()
|
||||
end)
|
||||
|
||||
function IsPolice()
|
||||
if not ESX.PlayerData.job then
|
||||
return false
|
||||
end
|
||||
return Contains(Config.policeJobNames, ESX.PlayerData.job.name)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,135 @@
|
||||
----------------------
|
||||
-- BLIPS
|
||||
----------------------
|
||||
local policeBlips = {}
|
||||
|
||||
RegisterNetEvent('kq_carheist:refreshPoliceAlarm')
|
||||
AddEventHandler('kq_carheist:refreshPoliceAlarm', function(trailerCoords, vehiclesCoords)
|
||||
ClearPoliceBlips()
|
||||
|
||||
if trailerCoords then
|
||||
RefreshPoliceTrailerAlarm(trailerCoords)
|
||||
end
|
||||
RefreshPoliceVehiclesAlarm(vehiclesCoords, trailerCoords)
|
||||
end)
|
||||
|
||||
function RefreshPoliceTrailerAlarm(trailerCoords)
|
||||
if trailerBlip ~= nil then
|
||||
RemoveBlip(trailerBlip)
|
||||
end
|
||||
|
||||
local blipConf = Config.policeBlip.truck.primary
|
||||
local primBlip = CreatePoliceBlip(trailerCoords, blipConf.sprite, blipConf.color, blipConf.alpha, blipConf.scale, L('Car transport robbery'), blipConf.shortRange)
|
||||
SetBlipDisplay(primBlip, 8)
|
||||
table.insert(policeBlips, primBlip)
|
||||
|
||||
blipConf = Config.policeBlip.truck.secondary
|
||||
local secBlip = CreatePoliceBlip(trailerCoords, blipConf.sprite, blipConf.color, blipConf.alpha, blipConf.scale, L('Car transport robbery'), blipConf.shortRange)
|
||||
table.insert(policeBlips, secBlip)
|
||||
|
||||
end
|
||||
|
||||
|
||||
function RefreshPoliceVehiclesAlarm(vehiclesCoords, trailerCoords)
|
||||
for k, veh in pairs(vehiclesCoords) do
|
||||
if not trailerCoords or GetDistanceBetweenCoords(trailerCoords, veh.coords, false) > 25.0 then
|
||||
|
||||
local blipConf = Config.policeBlip.vehicles.primary
|
||||
|
||||
|
||||
local distance = GetDistanceBetweenCoords(GetEntityCoords(PlayerPedId()), veh.coords, true)
|
||||
|
||||
local _, z = GetGroundZFor_3dCoord(veh.coords.x, veh.coords.y, 900.0, true)
|
||||
if z == 0.0 then
|
||||
z = GetHeightmapTopZForPosition(veh.coords.x, veh.coords.y)
|
||||
end
|
||||
|
||||
z = z - 6.0
|
||||
|
||||
if Config.policeBlip.makeTunnelsLowerSignal and distance > 10.0 and (IsInsideATunnel(veh.coords) or (Config.policeBlip.unknownTunnelChecking and z > veh.coords.z)) then
|
||||
math.randomseed(math.floor((veh.coords.x / 10) + (veh.coords.y / 10)))
|
||||
local newCoords = vector3(veh.coords.x + math.random(-130, 130), veh.coords.y + math.random(-130, 130), veh.coords.z)
|
||||
veh.coords = newCoords
|
||||
math.randomseed(GetGameTimer())
|
||||
|
||||
local tunnelBlip = CreateTunnelPoliceBlip(veh.coords, blipConf.color, blipConf.alpha)
|
||||
table.insert(policeBlips, tunnelBlip)
|
||||
else
|
||||
local primBlip = CreatePoliceBlip(veh.coords, blipConf.sprite, blipConf.color, blipConf.alpha, blipConf.scale, L('Stolen vehicle: ') .. veh.name, blipConf.shortRange)
|
||||
SetBlipDisplay(primBlip, 8)
|
||||
table.insert(policeBlips, primBlip)
|
||||
end
|
||||
|
||||
blipConf = Config.policeBlip.vehicles.secondary
|
||||
local secBlip = CreatePoliceBlip(veh.coords, blipConf.sprite, blipConf.color, blipConf.alpha, blipConf.scale, L('Stolen vehicle: ') .. veh.name, blipConf.shortRange)
|
||||
table.insert(policeBlips, secBlip)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ClearPoliceBlips()
|
||||
for k, blip in pairs(policeBlips) do
|
||||
RemoveBlip(blip)
|
||||
end
|
||||
policeBlips = {}
|
||||
end
|
||||
|
||||
function RemovePoliceTrailerBlip()
|
||||
if trailerBlip then
|
||||
RemoveBlip(trailerBlip)
|
||||
end
|
||||
end
|
||||
|
||||
function CreatePoliceBlip(coords, sprite, color, alpha, scale, message, shortRange)
|
||||
local blip = AddBlipForCoord(coords)
|
||||
|
||||
SetBlipSprite(blip, sprite)
|
||||
SetBlipHighDetail(blip, true)
|
||||
SetBlipColour(blip, color)
|
||||
SetBlipAlpha(blip, alpha)
|
||||
SetBlipScale(blip, scale)
|
||||
BeginTextCommandSetBlipName('STRING')
|
||||
AddTextComponentString(message)
|
||||
EndTextCommandSetBlipName(blip)
|
||||
SetBlipAsShortRange(blip, shortRange)
|
||||
return blip
|
||||
end
|
||||
|
||||
|
||||
function CreateTunnelPoliceBlip(coords, color, alpha)
|
||||
local blip = AddBlipForRadius(coords, 300.0)
|
||||
|
||||
SetBlipHighDetail(blip, true)
|
||||
SetBlipColour(blip, color)
|
||||
SetBlipAlpha(blip, alpha)
|
||||
SetBlipAsShortRange(blip, true)
|
||||
return blip
|
||||
end
|
||||
|
||||
|
||||
----------------------
|
||||
-- DISPATCH MESSAGES
|
||||
----------------------
|
||||
|
||||
function EndPoliceAlarm()
|
||||
if trailerBlip ~= nil then
|
||||
RemovePoliceTrailerBlip()
|
||||
SendDispatchMessage(L('Our truck has arrived to its destination. Thank you for your assistance'), L('Truck arrived'))
|
||||
end
|
||||
end
|
||||
|
||||
function SendDispatchMessage(message, subtitle)
|
||||
BeginTextCommandThefeedPost("STRING")
|
||||
AddTextComponentSubstringPlayerName(message)
|
||||
|
||||
-- Set the notification icon, title and subtitle.
|
||||
local title = L('Car Transports Inc.')
|
||||
local iconType = 0
|
||||
local flash = false -- Flash doesn't seem to work no matter what.
|
||||
EndTextCommandThefeedPostMessagetext("CHAR_CARSITE", "CHAR_CARSITE", flash, iconType, title, subtitle)
|
||||
|
||||
-- Draw the notification
|
||||
local showInBrief = true
|
||||
local blink = false -- blink doesn't work when using icon notifications.
|
||||
EndTextCommandThefeedPostTicker(blink, showInBrief)
|
||||
end
|
||||
@@ -0,0 +1,40 @@
|
||||
if Config.qbSettings.enabled then
|
||||
if Config.qbSettings.useNewQBExport then
|
||||
QBCore = exports['qb-core']:GetCoreObject()
|
||||
end
|
||||
|
||||
job = QBCore.Functions.GetPlayerData().job
|
||||
gang = QBCore.Functions.GetPlayerData().gang
|
||||
|
||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded')
|
||||
AddEventHandler('QBCore:Client:OnPlayerLoaded', function()
|
||||
job = QBCore.Functions.GetPlayerData().job
|
||||
gang = QBCore.Functions.GetPlayerData().gang
|
||||
TriggerServerEvent('kq_carheist:playerLoaded')
|
||||
end)
|
||||
|
||||
|
||||
RegisterNetEvent('QBCore:Client:OnJobUpdate')
|
||||
AddEventHandler('QBCore:Client:OnJobUpdate', function(JobInfo)
|
||||
job = JobInfo
|
||||
end)
|
||||
|
||||
RegisterNetEvent('QBCore:Client:OnGangUpdate')
|
||||
AddEventHandler('QBCore:Client:OnGangUpdate', function(GangInfo)
|
||||
gang = GangInfo
|
||||
end)
|
||||
|
||||
function IsPolice()
|
||||
if not job then
|
||||
return false
|
||||
end
|
||||
return Contains(Config.policeJobNames, job.name)
|
||||
end
|
||||
|
||||
function IsInGang()
|
||||
if not gang then
|
||||
return false
|
||||
end
|
||||
return gang.name ~= nil and gang.name ~= 'none' and gang.name ~= ''
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user