mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 17:58:54 +00:00
Complete vehicle job system re write
This commit is contained in:
+362
-149
@@ -25,6 +25,7 @@ local blipsCops = {}
|
||||
local isDead = false
|
||||
local CurrentTask = {}
|
||||
local playerInService = false
|
||||
local spawnedVehicles, isInShopMenu = {}, false
|
||||
|
||||
ESX = nil
|
||||
|
||||
@@ -41,18 +42,6 @@ Citizen.CreateThread(function()
|
||||
PlayerData = ESX.GetPlayerData()
|
||||
end)
|
||||
|
||||
function SetVehicleMaxMods(vehicle)
|
||||
local props = {
|
||||
modEngine = 2,
|
||||
modBrakes = 2,
|
||||
modTransmission = 2,
|
||||
modSuspension = 3,
|
||||
modTurbo = true
|
||||
}
|
||||
|
||||
ESX.Game.SetVehicleProperties(vehicle, props)
|
||||
end
|
||||
|
||||
function cleanPlayer(playerPed)
|
||||
SetPedArmour(playerPed, 0)
|
||||
ClearPedBloodDamage(playerPed)
|
||||
@@ -303,112 +292,205 @@ function OpenArmoryMenu(station)
|
||||
end)
|
||||
end
|
||||
|
||||
function OpenVehicleSpawnerMenu(station, partNum)
|
||||
function OpenVehicleSpawnerMenu(type, station, part, partNum)
|
||||
local playerCoords = GetEntityCoords(PlayerPedId())
|
||||
PlayerData = ESX.GetPlayerData()
|
||||
local elements = {
|
||||
{label = _U('garage_storeditem'), action = 'garage'},
|
||||
{label = _U('garage_storeitem'), action = 'store_garage'},
|
||||
{label = _U('garage_buyitem'), action = 'buy_vehicle'}
|
||||
}
|
||||
|
||||
ESX.UI.Menu.CloseAll()
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle', {
|
||||
title = _U('garage_title'),
|
||||
align = 'top-left',
|
||||
elements = elements
|
||||
}, function(data, menu)
|
||||
|
||||
if Config.EnableSocietyOwnedVehicles then
|
||||
if data.current.action == 'buy_vehicle' then
|
||||
local shopElements, shopCoords = {}
|
||||
|
||||
local elements = {}
|
||||
if type == 'car' then
|
||||
shopCoords = Config.PoliceStations[station].Vehicles[partNum].InsideShop
|
||||
local authorizedVehicles = Config.AuthorizedVehicles[PlayerData.job.grade_name]
|
||||
|
||||
ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(garageVehicles)
|
||||
if #Config.AuthorizedVehicles['Shared'] > 0 then
|
||||
for k,vehicle in ipairs(Config.AuthorizedVehicles['Shared']) do
|
||||
table.insert(shopElements, {
|
||||
label = ('%s - <span style="color:green;">%s</span>'):format(vehicle.label, _U('shop_item', ESX.Math.GroupDigits(vehicle.price))),
|
||||
name = vehicle.label,
|
||||
model = vehicle.model,
|
||||
price = vehicle.price,
|
||||
type = 'car'
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, #garageVehicles, 1 do
|
||||
table.insert(elements, {
|
||||
label = GetDisplayNameFromVehicleModel(garageVehicles[i].model) .. ' [' .. garageVehicles[i].plate .. ']',
|
||||
value = garageVehicles[i]
|
||||
})
|
||||
if #authorizedVehicles > 0 then
|
||||
for k,vehicle in ipairs(authorizedVehicles) do
|
||||
table.insert(shopElements, {
|
||||
label = ('%s - <span style="color:green;">%s</span>'):format(vehicle.label, _U('shop_item', ESX.Math.GroupDigits(vehicle.price))),
|
||||
name = vehicle.label,
|
||||
model = vehicle.model,
|
||||
price = vehicle.price,
|
||||
type = 'car'
|
||||
})
|
||||
end
|
||||
else
|
||||
if #Config.AuthorizedVehicles['Shared'] == 0 then
|
||||
return
|
||||
end
|
||||
end
|
||||
elseif type == 'helicopter' then
|
||||
shopCoords = Config.PoliceStations[station].Helicopters[partNum].InsideShop
|
||||
local authorizedHelicopters = Config.AuthorizedHelicopters[PlayerData.job.grade_name]
|
||||
|
||||
if #authorizedHelicopters > 0 then
|
||||
for k,vehicle in ipairs(authorizedHelicopters) do
|
||||
table.insert(shopElements, {
|
||||
label = ('%s - <span style="color:green;">%s</span>'):format(vehicle.label, _U('shop_item', ESX.Math.GroupDigits(vehicle.price))),
|
||||
name = vehicle.label,
|
||||
model = vehicle.model,
|
||||
price = vehicle.price,
|
||||
livery = vehicle.livery or nil,
|
||||
type = 'helicopter'
|
||||
})
|
||||
end
|
||||
else
|
||||
ESX.ShowNotification(_U('helicopter_notauthorized'))
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_spawner',
|
||||
{
|
||||
title = _U('vehicle_menu'),
|
||||
align = 'top-left',
|
||||
elements = elements
|
||||
}, function(data, menu)
|
||||
menu.close()
|
||||
OpenShopMenu(shopElements, playerCoords, shopCoords)
|
||||
elseif data.current.action == 'garage' then
|
||||
local garage = {}
|
||||
|
||||
local vehicleProps = data.current.value
|
||||
local foundSpawnPoint, spawnPoint = GetAvailableVehicleSpawnPoint(station, partNum)
|
||||
ESX.TriggerServerCallback('esx_vehicleshop:retrieveJobVehicles', function(jobVehicles)
|
||||
if #jobVehicles > 0 then
|
||||
for k,v in ipairs(jobVehicles) do
|
||||
local props = json.decode(v.vehicle)
|
||||
local vehicleName = GetLabelText(GetDisplayNameFromVehicleModel(props.model))
|
||||
local label = ('%s - <span style="color:darkgoldenrod;">%s</span>: '):format(vehicleName, props.plate)
|
||||
|
||||
if foundSpawnPoint then
|
||||
ESX.Game.SpawnVehicle(vehicleProps.model, spawnPoint, spawnPoint.heading, function(vehicle)
|
||||
ESX.Game.SetVehicleProperties(vehicle, vehicleProps)
|
||||
TaskWarpPedIntoVehicle(PlayerPedId(), vehicle, -1)
|
||||
end)
|
||||
|
||||
TriggerServerEvent('esx_society:removeVehicleFromGarage', 'police', vehicleProps)
|
||||
end
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
|
||||
CurrentAction = 'menu_vehicle_spawner'
|
||||
CurrentActionMsg = _U('vehicle_spawner')
|
||||
CurrentActionData = {station = station, partNum = partNum}
|
||||
end)
|
||||
|
||||
end, 'police')
|
||||
|
||||
else
|
||||
|
||||
local elements = {}
|
||||
|
||||
local sharedVehicles = Config.AuthorizedVehicles.Shared
|
||||
for i=1, #sharedVehicles, 1 do
|
||||
table.insert(elements, { label = sharedVehicles[i].label, model = sharedVehicles[i].model})
|
||||
end
|
||||
|
||||
local authorizedVehicles = Config.AuthorizedVehicles[PlayerData.job.grade_name]
|
||||
for i=1, #authorizedVehicles, 1 do
|
||||
table.insert(elements, { label = authorizedVehicles[i].label, model = authorizedVehicles[i].model})
|
||||
end
|
||||
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_spawner',
|
||||
{
|
||||
title = _U('vehicle_menu'),
|
||||
align = 'top-left',
|
||||
elements = elements
|
||||
}, function(data, menu)
|
||||
menu.close()
|
||||
|
||||
local foundSpawnPoint, spawnPoint = GetAvailableVehicleSpawnPoint(station, partNum)
|
||||
|
||||
if foundSpawnPoint then
|
||||
if Config.MaxInService == -1 then
|
||||
ESX.Game.SpawnVehicle(data.current.model, spawnPoint, spawnPoint.heading, function(vehicle)
|
||||
TaskWarpPedIntoVehicle(PlayerPedId(), vehicle, -1)
|
||||
SetVehicleMaxMods(vehicle)
|
||||
end)
|
||||
else
|
||||
|
||||
ESX.TriggerServerCallback('esx_service:isInService', function(isInService)
|
||||
|
||||
if isInService then
|
||||
ESX.Game.SpawnVehicle(data.current.model, spawnPoint, spawnPoint.heading, function(vehicle)
|
||||
TaskWarpPedIntoVehicle(PlayerPedId(), vehicle, -1)
|
||||
SetVehicleMaxMods(vehicle)
|
||||
end)
|
||||
if v.stored then
|
||||
label = label .. ('<span style="color:green;">%s</span>'):format(_U('garage_stored'))
|
||||
else
|
||||
ESX.ShowNotification(_U('service_not'))
|
||||
label = label .. ('<span style="color:darkred;">%s</span>'):format(_U('garage_notstored'))
|
||||
end
|
||||
|
||||
end, 'police')
|
||||
table.insert(garage, {
|
||||
label = label,
|
||||
stored = v.stored,
|
||||
model = props.model,
|
||||
vehicleProps = props
|
||||
})
|
||||
end
|
||||
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_garage', {
|
||||
title = _U('garage_title'),
|
||||
align = 'top-left',
|
||||
elements = garage
|
||||
}, function(data2, menu2)
|
||||
if data2.current.stored then
|
||||
local foundSpawn, spawnPoint = GetAvailableVehicleSpawnPoint(station, part, partNum)
|
||||
|
||||
if foundSpawn then
|
||||
menu2.close()
|
||||
|
||||
ESX.Game.SpawnVehicle(data2.current.model, spawnPoint.coords, spawnPoint.heading, function(vehicle)
|
||||
ESX.Game.SetVehicleProperties(vehicle, data2.current.vehicleProps)
|
||||
|
||||
TriggerServerEvent('esx_vehicleshop:setJobVehicleState', data2.current.vehicleProps.plate, false)
|
||||
ESX.ShowNotification(_U('garage_released'))
|
||||
end)
|
||||
end
|
||||
else
|
||||
ESX.ShowNotification(_U('garage_notavailable'))
|
||||
end
|
||||
end, function(data2, menu2)
|
||||
menu2.close()
|
||||
end)
|
||||
|
||||
else
|
||||
ESX.ShowNotification(_U('garage_empty'))
|
||||
end
|
||||
end, type)
|
||||
|
||||
elseif data.current.action == 'store_garage' then
|
||||
StoreNearbyVehicle(playerCoords)
|
||||
end
|
||||
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
function StoreNearbyVehicle(playerCoords)
|
||||
local vehicles, vehiclePlates = ESX.Game.GetVehiclesInArea(playerCoords, 30.0), {}
|
||||
|
||||
if #vehicles > 0 then
|
||||
for k,v in ipairs(vehicles) do
|
||||
|
||||
-- Make sure the vehicle we're saving is empty, or else it wont be deleted
|
||||
if GetVehicleNumberOfPassengers(v) == 0 and IsVehicleSeatFree(v, -1) then
|
||||
table.insert(vehiclePlates, {
|
||||
vehicle = v,
|
||||
plate = ESX.Math.Trim(GetVehicleNumberPlateText(v))
|
||||
})
|
||||
end
|
||||
end
|
||||
else
|
||||
ESX.ShowNotification(_U('garage_store_nearby'))
|
||||
return
|
||||
end
|
||||
|
||||
ESX.TriggerServerCallback('esx_policejob:storeNearbyVehicle', function(storeSuccess, foundNum)
|
||||
if storeSuccess then
|
||||
local vehicleId = vehiclePlates[foundNum]
|
||||
local attempts = 0
|
||||
ESX.Game.DeleteVehicle(vehicleId.vehicle)
|
||||
IsBusy = true
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while IsBusy do
|
||||
Citizen.Wait(0)
|
||||
drawLoadingText(_U('garage_storing'), 255, 255, 255, 255)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Workaround for vehicle not deleting when other players are near it.
|
||||
while DoesEntityExist(vehicleId.vehicle) do
|
||||
Citizen.Wait(500)
|
||||
attempts = attempts + 1
|
||||
|
||||
-- Give up
|
||||
if attempts > 30 then
|
||||
break
|
||||
end
|
||||
|
||||
vehicles = ESX.Game.GetVehiclesInArea(playerCoords, 30.0)
|
||||
if #vehicles > 0 then
|
||||
for k,v in ipairs(vehicles) do
|
||||
if ESX.Math.Trim(GetVehicleNumberPlateText(v)) == vehicleId.plate then
|
||||
ESX.Game.DeleteVehicle(v)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
|
||||
CurrentAction = 'menu_vehicle_spawner'
|
||||
CurrentActionMsg = _U('vehicle_spawner')
|
||||
CurrentActionData = {station = station, partNum = partNum}
|
||||
end)
|
||||
|
||||
end
|
||||
IsBusy = false
|
||||
ESX.ShowNotification(_U('garage_has_stored'))
|
||||
else
|
||||
ESX.ShowNotification(_U('garage_has_notstored'))
|
||||
end
|
||||
end, vehiclePlates)
|
||||
end
|
||||
|
||||
function GetAvailableVehicleSpawnPoint(station, partNum)
|
||||
local spawnPoints = Config.PoliceStations[station].Vehicles[partNum].SpawnPoints
|
||||
function GetAvailableVehicleSpawnPoint(station, part, partNum)
|
||||
local spawnPoints = Config.PoliceStations[station][part][partNum].SpawnPoints
|
||||
local found, foundSpawnPoint = false, nil
|
||||
|
||||
for i=1, #spawnPoints, 1 do
|
||||
@@ -426,6 +508,153 @@ function GetAvailableVehicleSpawnPoint(station, partNum)
|
||||
end
|
||||
end
|
||||
|
||||
function OpenShopMenu(elements, restoreCoords, shopCoords)
|
||||
local playerPed = PlayerPedId()
|
||||
isInShopMenu = true
|
||||
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_shop', {
|
||||
title = _U('vehicleshop_title'),
|
||||
align = 'top-left',
|
||||
elements = elements
|
||||
}, function(data, menu)
|
||||
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_shop_confirm',
|
||||
{
|
||||
title = _U('vehicleshop_confirm', data.current.name, data.current.price),
|
||||
align = 'top-left',
|
||||
elements = {
|
||||
{ label = _U('confirm_no'), value = 'no' },
|
||||
{ label = _U('confirm_yes'), value = 'yes' }
|
||||
}
|
||||
}, function(data2, menu2)
|
||||
|
||||
if data2.current.value == 'yes' then
|
||||
local newPlate = exports['esx_vehicleshop']:GeneratePlate()
|
||||
local vehicle = GetVehiclePedIsIn(playerPed, false)
|
||||
local props = ESX.Game.GetVehicleProperties(vehicle)
|
||||
props.plate = newPlate
|
||||
|
||||
ESX.TriggerServerCallback('esx_policejob:buyJobVehicle', function (bought)
|
||||
if bought then
|
||||
ESX.ShowNotification(_U('vehicleshop_bought', data.current.name, ESX.Math.GroupDigits(data.current.price)))
|
||||
|
||||
isInShopMenu = false
|
||||
ESX.UI.Menu.CloseAll()
|
||||
|
||||
DeleteSpawnedVehicles()
|
||||
FreezeEntityPosition(playerPed, false)
|
||||
SetEntityVisible(playerPed, true)
|
||||
|
||||
ESX.Game.Teleport(playerPed, restoreCoords)
|
||||
else
|
||||
ESX.ShowNotification(_U('vehicleshop_money'))
|
||||
menu2.close()
|
||||
end
|
||||
end, props, data.current.type)
|
||||
else
|
||||
menu2.close()
|
||||
end
|
||||
|
||||
end, function(data2, menu2)
|
||||
menu2.close()
|
||||
end)
|
||||
|
||||
end, function(data, menu)
|
||||
isInShopMenu = false
|
||||
ESX.UI.Menu.CloseAll()
|
||||
|
||||
DeleteSpawnedVehicles()
|
||||
FreezeEntityPosition(playerPed, false)
|
||||
SetEntityVisible(playerPed, true)
|
||||
|
||||
ESX.Game.Teleport(playerPed, restoreCoords)
|
||||
end, function(data, menu)
|
||||
DeleteSpawnedVehicles()
|
||||
|
||||
WaitForVehicleToLoad(data.current.model)
|
||||
ESX.Game.SpawnLocalVehicle(data.current.model, shopCoords, 0.0, function(vehicle)
|
||||
table.insert(spawnedVehicles, vehicle)
|
||||
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
|
||||
FreezeEntityPosition(vehicle, true)
|
||||
|
||||
if data.current.livery then
|
||||
SetVehicleModKit(vehicle, 0)
|
||||
SetVehicleLivery(vehicle, data.current.livery)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
WaitForVehicleToLoad(elements[1].model)
|
||||
ESX.Game.SpawnLocalVehicle(elements[1].model, shopCoords, 0.0, function(vehicle)
|
||||
table.insert(spawnedVehicles, vehicle)
|
||||
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
|
||||
FreezeEntityPosition(vehicle, true)
|
||||
|
||||
if elements[1].livery then
|
||||
SetVehicleModKit(vehicle, 0)
|
||||
SetVehicleLivery(vehicle,elements[1].livery)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
|
||||
if isInShopMenu then
|
||||
DisableControlAction(0, 75, true) -- Disable exit vehicle
|
||||
DisableControlAction(27, 75, true) -- Disable exit vehicle
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
function DeleteSpawnedVehicles()
|
||||
while #spawnedVehicles > 0 do
|
||||
local vehicle = spawnedVehicles[1]
|
||||
ESX.Game.DeleteVehicle(vehicle)
|
||||
table.remove(spawnedVehicles, 1)
|
||||
end
|
||||
end
|
||||
|
||||
function WaitForVehicleToLoad(modelHash)
|
||||
modelHash = (type(modelHash) == 'number' and modelHash or GetHashKey(modelHash))
|
||||
|
||||
if not HasModelLoaded(modelHash) then
|
||||
RequestModel(modelHash)
|
||||
|
||||
while not HasModelLoaded(modelHash) do
|
||||
Citizen.Wait(0)
|
||||
|
||||
DisableControlAction(0, Keys['TOP'], true)
|
||||
DisableControlAction(0, Keys['DOWN'], true)
|
||||
DisableControlAction(0, Keys['LEFT'], true)
|
||||
DisableControlAction(0, Keys['RIGHT'], true)
|
||||
DisableControlAction(0, 176, true) -- ENTER key
|
||||
DisableControlAction(0, Keys['BACKSPACE'], true)
|
||||
|
||||
drawLoadingText(_U('vehicleshop_awaiting_model'), 255, 255, 255, 255)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function drawLoadingText(text, red, green, blue, alpha)
|
||||
SetTextFont(4)
|
||||
SetTextProportional(0)
|
||||
SetTextScale(0.0, 0.5)
|
||||
SetTextColour(red, green, blue, alpha)
|
||||
SetTextDropShadow(0, 0, 0, 0, 255)
|
||||
SetTextEdge(1, 0, 0, 0, 255)
|
||||
SetTextDropShadow()
|
||||
SetTextOutline()
|
||||
SetTextCentre(true)
|
||||
|
||||
BeginTextCommandDisplayText("STRING")
|
||||
AddTextComponentSubstringPlayerName(text)
|
||||
EndTextCommandDisplayText(0.5, 0.5)
|
||||
end
|
||||
|
||||
function OpenPoliceActionsMenu()
|
||||
ESX.UI.Menu.CloseAll()
|
||||
|
||||
@@ -1308,36 +1537,14 @@ AddEventHandler('esx_policejob:hasEnteredMarker', function(station, part, partNu
|
||||
elseif part == 'VehicleSpawner' then
|
||||
|
||||
CurrentAction = 'menu_vehicle_spawner'
|
||||
CurrentActionMsg = _U('vehicle_spawner')
|
||||
CurrentActionData = {station = station, partNum = partNum}
|
||||
CurrentActionMsg = _U('garage_prompt')
|
||||
CurrentActionData = {station = station, part = part, partNum = partNum}
|
||||
|
||||
elseif part == 'HelicopterSpawner' then
|
||||
elseif part == 'Helicopters' then
|
||||
|
||||
local helicopters = Config.PoliceStations[station].Helicopters
|
||||
|
||||
if not IsAnyVehicleNearPoint(helicopters[partNum].SpawnPoint, 3.0) then
|
||||
ESX.Game.SpawnVehicle('polmav', helicopters[partNum].SpawnPoint, helicopters[partNum].Heading, function(vehicle)
|
||||
SetVehicleModKit(vehicle, 0)
|
||||
SetVehicleLivery(vehicle, 0)
|
||||
end)
|
||||
end
|
||||
|
||||
elseif part == 'VehicleDeleter' then
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
|
||||
if IsPedInAnyVehicle(playerPed, false) then
|
||||
|
||||
local vehicle = GetVehiclePedIsIn(playerPed, false)
|
||||
|
||||
if DoesEntityExist(vehicle) then
|
||||
CurrentAction = 'delete_vehicle'
|
||||
CurrentActionMsg = _U('store_vehicle')
|
||||
CurrentActionData = {vehicle = vehicle}
|
||||
end
|
||||
|
||||
end
|
||||
CurrentAction = 'Helicopters'
|
||||
CurrentActionMsg = _U('helicopter_prompt')
|
||||
CurrentActionData = {station = station, part = part, partNum = partNum}
|
||||
|
||||
elseif part == 'BossActions' then
|
||||
|
||||
@@ -1350,7 +1557,10 @@ AddEventHandler('esx_policejob:hasEnteredMarker', function(station, part, partNu
|
||||
end)
|
||||
|
||||
AddEventHandler('esx_policejob:hasExitedMarker', function(station, part, partNum)
|
||||
ESX.UI.Menu.CloseAll()
|
||||
if not isInShopMenu then
|
||||
ESX.UI.Menu.CloseAll()
|
||||
end
|
||||
|
||||
CurrentAction = nil
|
||||
end)
|
||||
|
||||
@@ -1604,7 +1814,7 @@ end)
|
||||
Citizen.CreateThread(function()
|
||||
|
||||
for k,v in pairs(Config.PoliceStations) do
|
||||
local blip = AddBlipForCoord(v.Blip.Pos)
|
||||
local blip = AddBlipForCoord(v.Blip.Coords)
|
||||
|
||||
SetBlipSprite (blip, v.Blip.Sprite)
|
||||
SetBlipDisplay(blip, v.Blip.Display)
|
||||
@@ -1638,7 +1848,7 @@ Citizen.CreateThread(function()
|
||||
local distance = GetDistanceBetweenCoords(coords, v.Cloakrooms[i], true)
|
||||
|
||||
if distance < Config.DrawDistance then
|
||||
DrawMarker(20, v.Cloakrooms[i] + 1, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 1.0, 1.0, 1.0, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, true, false, false, false)
|
||||
DrawMarker(20, v.Cloakrooms[i], 0.0, 0.0, 0.0, 0, 0.0, 0.0, 1.0, 1.0, 1.0, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, true, false, false, false)
|
||||
end
|
||||
|
||||
if distance < Config.MarkerSize.x then
|
||||
@@ -1650,7 +1860,7 @@ Citizen.CreateThread(function()
|
||||
local distance = GetDistanceBetweenCoords(coords, v.Armories[i], true)
|
||||
|
||||
if distance < Config.DrawDistance then
|
||||
DrawMarker(21, v.Armories[i] + 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.5, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, true, false, false, false)
|
||||
DrawMarker(21, v.Armories[i], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.5, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, true, false, false, false)
|
||||
end
|
||||
|
||||
if distance < Config.MarkerSize.x then
|
||||
@@ -1662,7 +1872,7 @@ Citizen.CreateThread(function()
|
||||
local distance = GetDistanceBetweenCoords(coords, v.Vehicles[i].Spawner, true)
|
||||
|
||||
if distance < Config.DrawDistance then
|
||||
DrawMarker(36, v.Vehicles[i].Spawner + 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, true, false, false, false)
|
||||
DrawMarker(36, v.Vehicles[i].Spawner, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, true, false, false, false)
|
||||
end
|
||||
|
||||
if distance < Config.MarkerSize.x then
|
||||
@@ -1673,20 +1883,12 @@ Citizen.CreateThread(function()
|
||||
for i=1, #v.Helicopters, 1 do
|
||||
local distance = GetDistanceBetweenCoords(coords, v.Helicopters[i].Spawner, true)
|
||||
|
||||
if distance < Config.MarkerSize.x then
|
||||
isInMarker, currentStation, currentPart, currentPartNum = true, k, 'HelicopterSpawner', i
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, #v.VehicleDeleters, 1 do
|
||||
local distance = GetDistanceBetweenCoords(coords, v.VehicleDeleters[i], true)
|
||||
|
||||
if distance < Config.DrawDistance then
|
||||
DrawMarker(Config.MarkerType, v.VehicleDeleters[i], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false)
|
||||
DrawMarker(34, v.Helicopters[i].Spawner, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, true, false, false, false)
|
||||
end
|
||||
|
||||
if distance < Config.MarkerSize.x then
|
||||
isInMarker, currentStation, currentPart, currentPartNum = true, k, 'VehicleDeleter', i
|
||||
isInMarker, currentStation, currentPart, currentPartNum = true, k, 'Helicopters', i
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1805,17 +2007,28 @@ Citizen.CreateThread(function()
|
||||
ESX.ShowNotification(_U('service_not'))
|
||||
end
|
||||
elseif CurrentAction == 'menu_vehicle_spawner' then
|
||||
OpenVehicleSpawnerMenu(CurrentActionData.station, CurrentActionData.partNum)
|
||||
elseif CurrentAction == 'delete_vehicle' then
|
||||
if Config.EnableSocietyOwnedVehicles then
|
||||
local vehicleProps = ESX.Game.GetVehicleProperties(CurrentActionData.vehicle)
|
||||
TriggerServerEvent('esx_society:putVehicleInGarage', 'police', vehicleProps)
|
||||
if Config.MaxInService == -1 then
|
||||
OpenVehicleSpawnerMenu('car', CurrentActionData.station, CurrentActionData.part, CurrentActionData.partNum)
|
||||
elseif playerInService then
|
||||
OpenVehicleSpawnerMenu('car', CurrentActionData.station, CurrentActionData.part, CurrentActionData.partNum)
|
||||
else
|
||||
ESX.ShowNotification(_U('service_not'))
|
||||
end
|
||||
elseif CurrentAction == 'Helicopters' then
|
||||
if Config.MaxInService == -1 then
|
||||
OpenVehicleSpawnerMenu('helicopter', CurrentActionData.station, CurrentActionData.part, CurrentActionData.partNum)
|
||||
elseif playerInService then
|
||||
OpenVehicleSpawnerMenu('helicopter', CurrentActionData.station, CurrentActionData.part, CurrentActionData.partNum)
|
||||
else
|
||||
ESX.ShowNotification(_U('service_not'))
|
||||
end
|
||||
elseif CurrentAction == 'delete_vehicle' then
|
||||
ESX.Game.DeleteVehicle(CurrentActionData.vehicle)
|
||||
elseif CurrentAction == 'menu_boss_actions' then
|
||||
ESX.UI.Menu.CloseAll()
|
||||
TriggerEvent('esx_society:openBossMenu', 'police', function(data, menu)
|
||||
menu.close()
|
||||
|
||||
CurrentAction = 'menu_boss_actions'
|
||||
CurrentActionMsg = _U('open_bossmenu')
|
||||
CurrentActionData = {}
|
||||
|
||||
+61
-22
@@ -32,16 +32,17 @@ Config.PoliceStations = {
|
||||
},
|
||||
|
||||
Cloakrooms = {
|
||||
vector3(452.6, -992.8, 29.7)
|
||||
vector3(452.6, -992.8, 30.6)
|
||||
},
|
||||
|
||||
Armories = {
|
||||
vector3(451.0, -980.7, 29.6)
|
||||
vector3(451.7, -980.1, 30.6)
|
||||
},
|
||||
|
||||
Vehicles = {
|
||||
{
|
||||
Spawner = vector3(454.6, -1017.4, 27.4),
|
||||
Spawner = vector3(454.6, -1017.4, 28.4),
|
||||
InsideShop = vector3(228.5, -993.5, -99.5),
|
||||
SpawnPoints = {
|
||||
{ coords = vector3(438.4, -1018.3, 27.7), heading = 90.0, radius = 6.0 },
|
||||
{ coords = vector3(441.0, -1024.2, 28.3), heading = 90.0, radius = 6.0 },
|
||||
@@ -52,6 +53,7 @@ Config.PoliceStations = {
|
||||
|
||||
{
|
||||
Spawner = vector3(473.3, -1018.4, 27.0),
|
||||
InsideShop = vector3(228.5, -993.5, -99.0),
|
||||
SpawnPoints = {
|
||||
{ coords = vector3(475.9, -1021.6, 28.0), heading = 276.1, radius = 6.0 },
|
||||
{ coords = vector3(484.1, -1023.1, 27.5), heading = 302.5, radius = 6.0 }
|
||||
@@ -61,20 +63,16 @@ Config.PoliceStations = {
|
||||
|
||||
Helicopters = {
|
||||
{
|
||||
Spawner = vector3(466.4, -982.8, 42.6),
|
||||
SpawnPoint = vector3(450.0, -981.1, 42.6),
|
||||
Heading = 0.0
|
||||
Spawner = vector3(461.1, -981.5, 43.6),
|
||||
InsideShop = vector3(477.0, -1106.4, 43.0),
|
||||
SpawnPoints = {
|
||||
{ coords = vector3(449.5, -981.2, 43.6), heading = 92.6, radius = 10.0 }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
VehicleDeleters = {
|
||||
vector3(462.7, -1014.4, 27.0),
|
||||
vector3(462.4, -1019.7, 27.1),
|
||||
vector3(469.1, -1024.5, 27.2)
|
||||
},
|
||||
|
||||
BossActions = {
|
||||
vector3(448.4, -973.2, 29.6)
|
||||
vector3(448.4, -973.2, 30.6)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -143,17 +141,17 @@ Config.AuthorizedWeapons = {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-- https://wiki.rage.mp/index.php?title=Vehicles
|
||||
Config.AuthorizedVehicles = {
|
||||
Shared = {
|
||||
{
|
||||
model = 'police',
|
||||
label = 'Police Cruiser'
|
||||
label = 'Police Cruiser',
|
||||
price = 10000
|
||||
},
|
||||
{
|
||||
model = 'pbus',
|
||||
label = 'Police Prison Bus'
|
||||
label = 'Police Prison Bus',
|
||||
price = 5000
|
||||
}
|
||||
},
|
||||
|
||||
@@ -164,18 +162,21 @@ Config.AuthorizedVehicles = {
|
||||
officer = {
|
||||
{
|
||||
model = 'police3',
|
||||
label = 'Police Interceptor'
|
||||
label = 'Police Interceptor',
|
||||
price = 20000
|
||||
}
|
||||
},
|
||||
|
||||
sergeant = {
|
||||
{
|
||||
model = 'policet',
|
||||
label = 'Police Transporter'
|
||||
label = 'Police Transporter',
|
||||
price = 18500
|
||||
},
|
||||
{
|
||||
model = 'policeb',
|
||||
label = 'Police Bike'
|
||||
label = 'Police Bike',
|
||||
price = 30500
|
||||
}
|
||||
},
|
||||
|
||||
@@ -186,11 +187,13 @@ Config.AuthorizedVehicles = {
|
||||
lieutenant = {
|
||||
{
|
||||
model = 'riot',
|
||||
label = 'Police Riot'
|
||||
label = 'Police Riot',
|
||||
price = 70000
|
||||
},
|
||||
{
|
||||
model = 'fbi2',
|
||||
label = 'FIB SUV'
|
||||
label = 'FIB SUV',
|
||||
price = 60000
|
||||
}
|
||||
},
|
||||
|
||||
@@ -203,6 +206,42 @@ Config.AuthorizedVehicles = {
|
||||
}
|
||||
}
|
||||
|
||||
Config.AuthorizedHelicopters = {
|
||||
recruit = {},
|
||||
|
||||
officer = {},
|
||||
|
||||
sergeant = {},
|
||||
|
||||
intendent = {},
|
||||
|
||||
lieutenant = {
|
||||
{
|
||||
model = 'polmav',
|
||||
label = 'Police Maverick',
|
||||
livery = 0,
|
||||
price = 200000
|
||||
}
|
||||
},
|
||||
|
||||
chef = {
|
||||
{
|
||||
model = 'polmav',
|
||||
label = 'Police Maverick',
|
||||
livery = 0,
|
||||
price = 150000
|
||||
}
|
||||
},
|
||||
|
||||
boss = {
|
||||
{
|
||||
model = 'polmav',
|
||||
label = 'Police Maverick',
|
||||
livery = 0,
|
||||
price = 100000
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- CHECK SKINCHANGER CLIENT MAIN.LUA for matching elements
|
||||
|
||||
|
||||
+27
-4
@@ -26,10 +26,33 @@ Locales['br'] = {
|
||||
['get_weapon_menu'] = 'armory - Withdraw Weapon',
|
||||
['put_weapon_menu'] = 'armory - Store Weapon',
|
||||
-- Vehicles
|
||||
['vehicle_menu'] = 'Veículo',
|
||||
['vehicle_blocked'] = 'Já existe um carro fora da garagem',
|
||||
['vehicle_spawner'] = 'Pressione ~INPUT_CONTEXT~ para escolher um veículo',
|
||||
['store_vehicle'] = 'Pressione ~INPUT_CONTEXT~ para guardar o veículo',
|
||||
['vehicle_menu'] = 'vehicle',
|
||||
['vehicle_blocked'] = 'all available spawn points are currently blocked!',
|
||||
['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.',
|
||||
['garage_title'] = 'vehicle Actions',
|
||||
['garage_stored'] = 'stored',
|
||||
['garage_notstored'] = 'not in garage',
|
||||
['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.',
|
||||
['garage_has_stored'] = 'the vehicle has been stored in your garage',
|
||||
['garage_has_notstored'] = 'no nearby owned vehicles were found',
|
||||
['garage_notavailable'] = 'your vehicle is not stored in the garage.',
|
||||
['garage_blocked'] = 'there\'s no available spawn points!',
|
||||
['garage_empty'] = 'you dont have any vehicles in your garage.',
|
||||
['garage_released'] = 'your vehicle has been released from the garage.',
|
||||
['garage_store_nearby'] = 'there is no nearby vehicles.',
|
||||
['garage_storeditem'] = 'open garage',
|
||||
['garage_storeitem'] = 'store vehicle in garage',
|
||||
['garage_buyitem'] = 'vehicle shop',
|
||||
['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.',
|
||||
['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.',
|
||||
['shop_item'] = '$%s',
|
||||
['vehicleshop_title'] = 'vehicle Shop',
|
||||
['vehicleshop_confirm'] = 'do you want to buy this vehicle?',
|
||||
['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~',
|
||||
['vehicleshop_money'] = 'you cannot afford that vehicle',
|
||||
['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait',
|
||||
['confirm_no'] = 'no',
|
||||
['confirm_yes'] = 'yes',
|
||||
-- Service
|
||||
['service_max'] = 'you cannot enter service, max officers in service: %s/%s',
|
||||
['service_not'] = 'you have not entered service! You\'ll have to get changed first.',
|
||||
|
||||
+27
-4
@@ -26,10 +26,33 @@ Locales['de'] = {
|
||||
['get_weapon_menu'] = 'armory - Withdraw Weapon',
|
||||
['put_weapon_menu'] = 'armory - Store Weapon',
|
||||
-- Vehicles
|
||||
['vehicle_menu'] = 'Fahrzeug',
|
||||
['vehicle_blocked'] = 'es ist bereits ein Fahrzeug draussen',
|
||||
['vehicle_spawner'] = 'Drücke ~INPUT_CONTEXT~ um ein Fahrzeug zu holen',
|
||||
['store_vehicle'] = 'Drücke ~INPUT_CONTEXT~ um das Fahrzeug zu parken',
|
||||
['vehicle_menu'] = 'vehicle',
|
||||
['vehicle_blocked'] = 'all available spawn points are currently blocked!',
|
||||
['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.',
|
||||
['garage_title'] = 'vehicle Actions',
|
||||
['garage_stored'] = 'stored',
|
||||
['garage_notstored'] = 'not in garage',
|
||||
['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.',
|
||||
['garage_has_stored'] = 'the vehicle has been stored in your garage',
|
||||
['garage_has_notstored'] = 'no nearby owned vehicles were found',
|
||||
['garage_notavailable'] = 'your vehicle is not stored in the garage.',
|
||||
['garage_blocked'] = 'there\'s no available spawn points!',
|
||||
['garage_empty'] = 'you dont have any vehicles in your garage.',
|
||||
['garage_released'] = 'your vehicle has been released from the garage.',
|
||||
['garage_store_nearby'] = 'there is no nearby vehicles.',
|
||||
['garage_storeditem'] = 'open garage',
|
||||
['garage_storeitem'] = 'store vehicle in garage',
|
||||
['garage_buyitem'] = 'vehicle shop',
|
||||
['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.',
|
||||
['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.',
|
||||
['shop_item'] = '$%s',
|
||||
['vehicleshop_title'] = 'vehicle Shop',
|
||||
['vehicleshop_confirm'] = 'do you want to buy this vehicle?',
|
||||
['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~',
|
||||
['vehicleshop_money'] = 'you cannot afford that vehicle',
|
||||
['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait',
|
||||
['confirm_no'] = 'no',
|
||||
['confirm_yes'] = 'yes',
|
||||
-- Service
|
||||
['service_max'] = 'you cannot enter service, max officers in service: %s/%s',
|
||||
['service_not'] = 'you have not entered service! You\'ll have to get changed first.',
|
||||
|
||||
+25
-2
@@ -28,8 +28,31 @@ Locales['en'] = {
|
||||
-- Vehicles
|
||||
['vehicle_menu'] = 'vehicle',
|
||||
['vehicle_blocked'] = 'all available spawn points are currently blocked!',
|
||||
['vehicle_spawner'] = 'press ~INPUT_CONTEXT~ to take out a vehicle',
|
||||
['store_vehicle'] = 'press ~INPUT_CONTEXT~ to store the vehicle',
|
||||
['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.',
|
||||
['garage_title'] = 'vehicle Actions',
|
||||
['garage_stored'] = 'stored',
|
||||
['garage_notstored'] = 'not in garage',
|
||||
['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.',
|
||||
['garage_has_stored'] = 'the vehicle has been stored in your garage',
|
||||
['garage_has_notstored'] = 'no nearby owned vehicles were found',
|
||||
['garage_notavailable'] = 'your vehicle is not stored in the garage.',
|
||||
['garage_blocked'] = 'there\'s no available spawn points!',
|
||||
['garage_empty'] = 'you dont have any vehicles in your garage.',
|
||||
['garage_released'] = 'your vehicle has been released from the garage.',
|
||||
['garage_store_nearby'] = 'there is no nearby vehicles.',
|
||||
['garage_storeditem'] = 'open garage',
|
||||
['garage_storeitem'] = 'store vehicle in garage',
|
||||
['garage_buyitem'] = 'vehicle shop',
|
||||
['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.',
|
||||
['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.',
|
||||
['shop_item'] = '$%s',
|
||||
['vehicleshop_title'] = 'vehicle Shop',
|
||||
['vehicleshop_confirm'] = 'do you want to buy this vehicle?',
|
||||
['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~',
|
||||
['vehicleshop_money'] = 'you cannot afford that vehicle',
|
||||
['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait',
|
||||
['confirm_no'] = 'no',
|
||||
['confirm_yes'] = 'yes',
|
||||
-- Service
|
||||
['service_max'] = 'you cannot enter service, max officers in service: %s/%s',
|
||||
['service_not'] = 'you have not entered service! You\'ll have to get changed first.',
|
||||
|
||||
+27
-4
@@ -26,10 +26,33 @@ Locales['es'] = {
|
||||
['get_weapon_menu'] = 'armory - Withdraw Weapon',
|
||||
['put_weapon_menu'] = 'armory - Store Weapon',
|
||||
-- Vehicles
|
||||
['vehicle_menu'] = 'Vehículo',
|
||||
['vehicle_blocked'] = 'Ya tienes un vehículo fuera',
|
||||
['vehicle_spawner'] = 'Presionar ~INPUT_CONTEXT~ para sacar un vehículo',
|
||||
['store_vehicle'] = 'Presionar ~INPUT_CONTEXT~ para guardar un vehículo',
|
||||
['vehicle_menu'] = 'vehicle',
|
||||
['vehicle_blocked'] = 'all available spawn points are currently blocked!',
|
||||
['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.',
|
||||
['garage_title'] = 'vehicle Actions',
|
||||
['garage_stored'] = 'stored',
|
||||
['garage_notstored'] = 'not in garage',
|
||||
['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.',
|
||||
['garage_has_stored'] = 'the vehicle has been stored in your garage',
|
||||
['garage_has_notstored'] = 'no nearby owned vehicles were found',
|
||||
['garage_notavailable'] = 'your vehicle is not stored in the garage.',
|
||||
['garage_blocked'] = 'there\'s no available spawn points!',
|
||||
['garage_empty'] = 'you dont have any vehicles in your garage.',
|
||||
['garage_released'] = 'your vehicle has been released from the garage.',
|
||||
['garage_store_nearby'] = 'there is no nearby vehicles.',
|
||||
['garage_storeditem'] = 'open garage',
|
||||
['garage_storeitem'] = 'store vehicle in garage',
|
||||
['garage_buyitem'] = 'vehicle shop',
|
||||
['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.',
|
||||
['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.',
|
||||
['shop_item'] = '$%s',
|
||||
['vehicleshop_title'] = 'vehicle Shop',
|
||||
['vehicleshop_confirm'] = 'do you want to buy this vehicle?',
|
||||
['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~',
|
||||
['vehicleshop_money'] = 'you cannot afford that vehicle',
|
||||
['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait',
|
||||
['confirm_no'] = 'no',
|
||||
['confirm_yes'] = 'yes',
|
||||
-- Service
|
||||
['service_max'] = 'you cannot enter service, max officers in service: %s/%s',
|
||||
['service_not'] = 'you have not entered service! You\'ll have to get changed first.',
|
||||
|
||||
+27
-4
@@ -26,10 +26,33 @@ Locales['fi'] = {
|
||||
['get_weapon_menu'] = 'armory - Withdraw Weapon',
|
||||
['put_weapon_menu'] = 'armory - Store Weapon',
|
||||
-- Vehicles
|
||||
['vehicle_menu'] = 'ajoneuvo',
|
||||
['vehicle_blocked'] = 'ajoneuvo on jo ulkona tallista',
|
||||
['vehicle_spawner'] = 'paina ~INPUT_CONTEXT~ ottaaksesi auton ulos',
|
||||
['store_vehicle'] = 'paina ~INPUT_CONTEXT~ laittaaksesi auto talliin',
|
||||
['vehicle_menu'] = 'vehicle',
|
||||
['vehicle_blocked'] = 'all available spawn points are currently blocked!',
|
||||
['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.',
|
||||
['garage_title'] = 'vehicle Actions',
|
||||
['garage_stored'] = 'stored',
|
||||
['garage_notstored'] = 'not in garage',
|
||||
['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.',
|
||||
['garage_has_stored'] = 'the vehicle has been stored in your garage',
|
||||
['garage_has_notstored'] = 'no nearby owned vehicles were found',
|
||||
['garage_notavailable'] = 'your vehicle is not stored in the garage.',
|
||||
['garage_blocked'] = 'there\'s no available spawn points!',
|
||||
['garage_empty'] = 'you dont have any vehicles in your garage.',
|
||||
['garage_released'] = 'your vehicle has been released from the garage.',
|
||||
['garage_store_nearby'] = 'there is no nearby vehicles.',
|
||||
['garage_storeditem'] = 'open garage',
|
||||
['garage_storeitem'] = 'store vehicle in garage',
|
||||
['garage_buyitem'] = 'vehicle shop',
|
||||
['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.',
|
||||
['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.',
|
||||
['shop_item'] = '$%s',
|
||||
['vehicleshop_title'] = 'vehicle Shop',
|
||||
['vehicleshop_confirm'] = 'do you want to buy this vehicle?',
|
||||
['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~',
|
||||
['vehicleshop_money'] = 'you cannot afford that vehicle',
|
||||
['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait',
|
||||
['confirm_no'] = 'no',
|
||||
['confirm_yes'] = 'yes',
|
||||
-- Service
|
||||
['service_max'] = 'you cannot enter service, max officers in service: %s/%s',
|
||||
['service_not'] = 'you have not entered service! You\'ll have to get changed first.',
|
||||
|
||||
+27
-4
@@ -26,10 +26,33 @@ Locales['fr'] = {
|
||||
['get_weapon_menu'] = 'armory - Withdraw Weapon',
|
||||
['put_weapon_menu'] = 'armory - Store Weapon',
|
||||
-- Vehicles
|
||||
['vehicle_menu'] = 'véhicule',
|
||||
['vehicle_blocked'] = 'il y a déja un véhicule de sorti',
|
||||
['vehicle_spawner'] = 'appuyez sur ~INPUT_CONTEXT~ pour sortir un véhicule',
|
||||
['store_vehicle'] = 'appuyez sur ~INPUT_CONTEXT~ pour ranger le véhicule',
|
||||
['vehicle_menu'] = 'vehicle',
|
||||
['vehicle_blocked'] = 'all available spawn points are currently blocked!',
|
||||
['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.',
|
||||
['garage_title'] = 'vehicle Actions',
|
||||
['garage_stored'] = 'stored',
|
||||
['garage_notstored'] = 'not in garage',
|
||||
['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.',
|
||||
['garage_has_stored'] = 'the vehicle has been stored in your garage',
|
||||
['garage_has_notstored'] = 'no nearby owned vehicles were found',
|
||||
['garage_notavailable'] = 'your vehicle is not stored in the garage.',
|
||||
['garage_blocked'] = 'there\'s no available spawn points!',
|
||||
['garage_empty'] = 'you dont have any vehicles in your garage.',
|
||||
['garage_released'] = 'your vehicle has been released from the garage.',
|
||||
['garage_store_nearby'] = 'there is no nearby vehicles.',
|
||||
['garage_storeditem'] = 'open garage',
|
||||
['garage_storeitem'] = 'store vehicle in garage',
|
||||
['garage_buyitem'] = 'vehicle shop',
|
||||
['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.',
|
||||
['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.',
|
||||
['shop_item'] = '$%s',
|
||||
['vehicleshop_title'] = 'vehicle Shop',
|
||||
['vehicleshop_confirm'] = 'do you want to buy this vehicle?',
|
||||
['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~',
|
||||
['vehicleshop_money'] = 'you cannot afford that vehicle',
|
||||
['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait',
|
||||
['confirm_no'] = 'no',
|
||||
['confirm_yes'] = 'yes',
|
||||
-- Service
|
||||
['service_max'] = 'you cannot enter service, max officers in service: %s/%s',
|
||||
['service_not'] = 'you have not entered service! You\'ll have to get changed first.',
|
||||
|
||||
+27
-4
@@ -26,10 +26,33 @@ Locales['pl'] = {
|
||||
['get_weapon_menu'] = 'armory - Withdraw Weapon',
|
||||
['put_weapon_menu'] = 'armory - Store Weapon',
|
||||
-- Vehicles
|
||||
['vehicle_menu'] = 'pojazdy',
|
||||
['vehicle_blocked'] = 'masz już pojazd poza garażem',
|
||||
['vehicle_spawner'] = 'naciśnij ~INPUT_CONTEXT~ żeby wziąć pojazd',
|
||||
['store_vehicle'] = 'naciśnij ~INPUT_CONTEXT~ żeby przechować pojazd',
|
||||
['vehicle_menu'] = 'vehicle',
|
||||
['vehicle_blocked'] = 'all available spawn points are currently blocked!',
|
||||
['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.',
|
||||
['garage_title'] = 'vehicle Actions',
|
||||
['garage_stored'] = 'stored',
|
||||
['garage_notstored'] = 'not in garage',
|
||||
['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.',
|
||||
['garage_has_stored'] = 'the vehicle has been stored in your garage',
|
||||
['garage_has_notstored'] = 'no nearby owned vehicles were found',
|
||||
['garage_notavailable'] = 'your vehicle is not stored in the garage.',
|
||||
['garage_blocked'] = 'there\'s no available spawn points!',
|
||||
['garage_empty'] = 'you dont have any vehicles in your garage.',
|
||||
['garage_released'] = 'your vehicle has been released from the garage.',
|
||||
['garage_store_nearby'] = 'there is no nearby vehicles.',
|
||||
['garage_storeditem'] = 'open garage',
|
||||
['garage_storeitem'] = 'store vehicle in garage',
|
||||
['garage_buyitem'] = 'vehicle shop',
|
||||
['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.',
|
||||
['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.',
|
||||
['shop_item'] = '$%s',
|
||||
['vehicleshop_title'] = 'vehicle Shop',
|
||||
['vehicleshop_confirm'] = 'do you want to buy this vehicle?',
|
||||
['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~',
|
||||
['vehicleshop_money'] = 'you cannot afford that vehicle',
|
||||
['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait',
|
||||
['confirm_no'] = 'no',
|
||||
['confirm_yes'] = 'yes',
|
||||
-- Service
|
||||
['service_max'] = 'nie możesz wejść do służby, maksymalna liczba oficerów w służbie: %s/%s',
|
||||
['service_not'] = 'nie rozpoczynasz służby! Najpierw musisz się przebrać.',
|
||||
|
||||
+27
-4
@@ -26,10 +26,33 @@ Locales['sv'] = {
|
||||
['get_weapon_menu'] = 'vapenförråd - Ta ut vapen',
|
||||
['put_weapon_menu'] = 'vapenförråd - Spara vapen',
|
||||
-- Vehicles
|
||||
['vehicle_menu'] = 'bilar',
|
||||
['vehicle_blocked'] = 'alla tillgänliga spawn points är blockerade!',
|
||||
['vehicle_spawner'] = 'tryck ~INPUT_CONTEXT~ för att ta ut en bil',
|
||||
['store_vehicle'] = 'tryck ~INPUT_CONTEXT~ för att parkera bilen',
|
||||
['vehicle_menu'] = 'vehicle',
|
||||
['vehicle_blocked'] = 'all available spawn points are currently blocked!',
|
||||
['garage_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Vehicle Actions~s~.',
|
||||
['garage_title'] = 'vehicle Actions',
|
||||
['garage_stored'] = 'stored',
|
||||
['garage_notstored'] = 'not in garage',
|
||||
['garage_storing'] = 'we\'re attempting to remove the vehicle, make sure no players are around it.',
|
||||
['garage_has_stored'] = 'the vehicle has been stored in your garage',
|
||||
['garage_has_notstored'] = 'no nearby owned vehicles were found',
|
||||
['garage_notavailable'] = 'your vehicle is not stored in the garage.',
|
||||
['garage_blocked'] = 'there\'s no available spawn points!',
|
||||
['garage_empty'] = 'you dont have any vehicles in your garage.',
|
||||
['garage_released'] = 'your vehicle has been released from the garage.',
|
||||
['garage_store_nearby'] = 'there is no nearby vehicles.',
|
||||
['garage_storeditem'] = 'open garage',
|
||||
['garage_storeitem'] = 'store vehicle in garage',
|
||||
['garage_buyitem'] = 'vehicle shop',
|
||||
['helicopter_prompt'] = 'press ~INPUT_CONTEXT~ to access the ~y~Helicopter Actions~s~.',
|
||||
['helicopter_notauthorized'] = 'you\'re not authorized to buy helicopters.',
|
||||
['shop_item'] = '$%s',
|
||||
['vehicleshop_title'] = 'vehicle Shop',
|
||||
['vehicleshop_confirm'] = 'do you want to buy this vehicle?',
|
||||
['vehicleshop_bought'] = 'you have bought ~y~%s~s~ for ~r~$%s~s~',
|
||||
['vehicleshop_money'] = 'you cannot afford that vehicle',
|
||||
['vehicleshop_awaiting_model'] = 'the vehicle is currently ~g~DOWNLOADING & LOADING~s~ please wait',
|
||||
['confirm_no'] = 'no',
|
||||
['confirm_yes'] = 'yes',
|
||||
-- Service
|
||||
['service_max'] = 'du kan inte gå tjänst, poliser i tjänst: %s/%s',
|
||||
['service_not'] = 'du är inte i tjänst! Byt om för att gå in i tjänst.',
|
||||
|
||||
@@ -424,6 +424,100 @@ ESX.RegisterServerCallback('esx_policejob:buyWeapon', function(source, cb, weapo
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
ESX.RegisterServerCallback('esx_policejob:buyJobVehicle', function(source, cb, vehicleProps, type)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local price = getPriceFromHash(vehicleProps.model, xPlayer.job.grade_name, type)
|
||||
|
||||
-- vehicle model not found
|
||||
if price == 0 then
|
||||
print(('esx_policejob: %s attempted to exploit the shop! (invalid vehicle model)'):format(xPlayer.identifier))
|
||||
cb(false)
|
||||
end
|
||||
|
||||
if xPlayer.getMoney() >= price then
|
||||
xPlayer.removeMoney(price)
|
||||
|
||||
MySQL.Async.execute('INSERT INTO owned_vehicles (owner, vehicle, plate, type, job, stored) VALUES (@owner, @vehicle, @plate, @type, @job, @stored)', {
|
||||
['@owner'] = xPlayer.identifier,
|
||||
['@vehicle'] = json.encode(vehicleProps),
|
||||
['@plate'] = vehicleProps.plate,
|
||||
['@type'] = type,
|
||||
['@job'] = xPlayer.job.name,
|
||||
['@stored'] = true
|
||||
}, function (rowsChanged)
|
||||
cb(true)
|
||||
end)
|
||||
else
|
||||
cb(false)
|
||||
end
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx_policejob:storeNearbyVehicle', function(source, cb, nearbyVehicles)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local foundPlate, foundNum
|
||||
|
||||
for k,v in ipairs(nearbyVehicles) do
|
||||
local result = MySQL.Sync.fetchAll('SELECT plate FROM owned_vehicles WHERE owner = @owner AND plate = @plate AND job = @job', {
|
||||
['@owner'] = xPlayer.identifier,
|
||||
['@plate'] = v.plate,
|
||||
['@job'] = xPlayer.job.name
|
||||
})
|
||||
|
||||
if result[1] then
|
||||
foundPlate, foundNum = result[1].plate, k
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not foundPlate then
|
||||
cb(false)
|
||||
else
|
||||
MySQL.Async.execute('UPDATE owned_vehicles SET stored = true WHERE owner = @owner AND plate = @plate AND job = @job', {
|
||||
['@owner'] = xPlayer.identifier,
|
||||
['@plate'] = foundPlate,
|
||||
['@job'] = xPlayer.job.name
|
||||
}, function (rowsChanged)
|
||||
if rowsChanged == 0 then
|
||||
print(('esx_policejob: %s has exploited the garage!'):format(xPlayer.identifier))
|
||||
cb(false)
|
||||
else
|
||||
cb(true, foundNum)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
function getPriceFromHash(hashKey, jobGrade, type)
|
||||
if type == 'helicopter' then
|
||||
local vehicles = Config.AuthorizedHelicopters[jobGrade]
|
||||
|
||||
for k,v in ipairs(vehicles) do
|
||||
if GetHashKey(v.model) == hashKey then
|
||||
return v.price
|
||||
end
|
||||
end
|
||||
elseif type == 'car' then
|
||||
local vehicles = Config.AuthorizedVehicles[jobGrade]
|
||||
local shared = Config.AuthorizedVehicles['Shared']
|
||||
|
||||
for k,v in ipairs(vehicles) do
|
||||
if GetHashKey(v.model) == hashKey then
|
||||
return v.price
|
||||
end
|
||||
end
|
||||
|
||||
for k,v in ipairs(shared) do
|
||||
if GetHashKey(v.model) == hashKey then
|
||||
return v.price
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
ESX.RegisterServerCallback('esx_policejob:getStockItems', function(source, cb)
|
||||
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_police', function(inventory)
|
||||
cb(inventory.items)
|
||||
|
||||
Reference in New Issue
Block a user