Skip to content

Commit

Permalink
chore: removal of superfluous code
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpredator committed Dec 18, 2024
1 parent 1f9d239 commit 6ecd385
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 209 deletions.
171 changes: 0 additions & 171 deletions server-data/resources/[bpt_addons]/bpt_ammujob/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ function OpenAmmuActionsMenu()
local elements = {
{ unselectable = true, icon = "fas fa-ammu", title = TranslateCap("menu_title") },
{ icon = "fas fa-user", title = TranslateCap("citizen_interaction"), value = "citizen_interaction" },
{ icon = "fas fa-car", title = TranslateCap("vehicle_interaction"), value = "vehicle_interaction" },
}

ESX.OpenContext("right", elements, function(menu, element)
Expand Down Expand Up @@ -116,99 +115,6 @@ function OpenAmmuActionsMenu()
end, function()
OpenAmmuActionsMenu()
end)
elseif data.current.value == "vehicle_interaction" then
local elements3 = {
{ unselectable = true, icon = "fas fa-car", title = element.title },
}
local playerPed = PlayerPedId()
local vehicle = ESX.Game.GetVehicleInDirection()

if DoesEntityExist(vehicle) then
elements3[#elements3 + 1] = { icon = "fas fa-car", title = TranslateCap("vehicle_info"), value = "vehicle_infos" }
elements3[#elements3 + 1] = { icon = "fas fa-car", title = TranslateCap("pick_lock"), value = "hijack_vehicle" }
elements3[#elements3 + 1] = { icon = "fas fa-car", title = TranslateCap("impound"), value = "impound" }
end

elements3[#elements3 + 1] = {
icon = "fas fa-scroll",
title = TranslateCap("search_database"),
value = "search_database",
}

ESX.OpenContext("right", elements3, function(menu3, element3)
local data2 = { current = element3 }
local coords = GetEntityCoords(playerPed)
vehicle = ESX.Game.GetVehicleInDirection()
local action = data2.current.value

if action == "search_database" then
LookupVehicle(element3)
elseif DoesEntityExist(vehicle) then
if action == "vehicle_infos" then
local vehicleData = ESX.Game.GetVehicleProperties(vehicle)
OpenVehicleInfosMenu(vehicleData)
elseif action == "hijack_vehicle" then
if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 3.0) then
TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_WELDING", 0, true)
Wait(20000)
ClearPedTasksImmediately(playerPed)

SetVehicleDoorsLocked(vehicle, 1)
SetVehicleDoorsLockedForAllPlayers(vehicle, false)
ESX.ShowNotification(TranslateCap("vehicle_unlocked"))
end
elseif action == "impound" then
if currentTask.busy then
return
end

ESX.ShowHelpNotification(TranslateCap("impound_prompt"))
TaskStartScenarioInPlace(playerPed, "CODE_HUMAN_MEDIC_TEND_TO_DEAD", 0, true)

currentTask.busy = true
currentTask.task = ESX.SetTimeout(10000, function()
ClearPedTasks(playerPed)
ImpoundVehicle(vehicle)
Wait(100)
end)

CreateThread(function()
while currentTask.busy do
Wait(1000)

vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 3.0, 0, 71)
if not DoesEntityExist(vehicle) and currentTask.busy then
ESX.ShowNotification(TranslateCap("impound_canceled_moved"))
ESX.ClearTimeout(currentTask.task)
ClearPedTasks(playerPed)
currentTask.busy = false
break
end
end
end)
end
else
ESX.ShowNotification(TranslateCap("no_vehicles_nearby"))
end
end, function()
OpenAmmuActionsMenu()
end)
elseif data.current.value == "object_spawner" then

ESX.OpenContext("right", elements4, function(menu4, element4)
local data2 = { current = element4 }
local playerPed = PlayerPedId()
local coords, forward = GetEntityCoords(playerPed), GetEntityForwardVector(playerPed)
local objectCoords = (coords + forward * 1.0)

ESX.Game.SpawnObject(data2.current.model, objectCoords, function(obj)
Wait(100)
SetEntityHeading(obj, GetEntityHeading(playerPed))
PlaceObjectOnGroundProperly(obj)
end)
end, function()
OpenAmmuActionsMenu()
end)
end
end)
end
Expand Down Expand Up @@ -398,44 +304,7 @@ function OpenFineTextInput(player)
end)
end

function LookupVehicle(elementF)
local elements = {
{ unselectable = true, icon = "fas fa-car", title = elementF.title },
{ title = TranslateCap("search_plate"), input = true, inputType = "text", inputPlaceholder = "ABC 123" },
{ icon = "fas fa-check-double", title = TranslateCap("lookup_plate"), value = "lookup" },
}

ESX.OpenContext("right", elements, function(menu, element)
local data = { value = menu.eles[2].inputValue }
local length = string.len(data.value)
if not data.value or length < 2 or length > 8 then
ESX.ShowNotification(TranslateCap("search_database_error_invalid"))
else
ESX.TriggerServerCallback("bpt_ammujob:getVehicleInfos", function(retrivedInfo)
elements = {
{ unselectable = true, icon = "fas fa-car", title = element.title },
{ unselectable = true, icon = "fas fa-car", title = TranslateCap("plate", retrivedInfo.plate) },
}

if not retrivedInfo.owner then
elements[#elements + 1] = { unselectable = true, icon = "fas fa-user", title = TranslateCap("owner_unknown") }
else
elements[#elements + 1] = { unselectable = true, icon = "fas fa-user", title = TranslateCap("owner", retrivedInfo.owner) }
end

ESX.OpenContext("right", elements, nil, function()
OpenAmmuActionsMenu()
end)
end, data.value)
end
end)
end

function ShowPlayerLicense(player)
local elements = {
{ unselectable = true, icon = "fas fa-scroll", title = TranslateCap("license_revoke") },
}

ESX.TriggerServerCallback("bpt_ammujob:getOtherPlayerData", function(playerData)
if playerData.licenses then
for i = 1, #playerData.licenses, 1 do
Expand All @@ -448,38 +317,9 @@ function ShowPlayerLicense(player)
end
end
end

ESX.OpenContext("right", elements, function(menu, element)
local data = { current = element }
ESX.ShowNotification(TranslateCap("licence_you_revoked", data.current.label, playerData.name))
TriggerServerEvent("bpt_ammujob:message", GetPlayerServerId(player), TranslateCap("license_revoked", data.current.label))

TriggerServerEvent("esx_license:removeLicense", GetPlayerServerId(player), data.current.type)

ESX.SetTimeout(300, function()
ShowPlayerLicense(player)
end)
end)
end, GetPlayerServerId(player))
end

function OpenVehicleInfosMenu(vehicleData)
ESX.TriggerServerCallback("bpt_ammujob:getVehicleInfos", function(retrivedInfo)
local elements = {
{ unselectable = true, icon = "fas fa-car", title = TranslateCap("vehicle_info") },
{ icon = "fas fa-car", title = TranslateCap("plate", retrivedInfo.plate) },
}

if not retrivedInfo.owner then
elements[#elements + 1] = { unselectable = true, icon = "fas fa-user", title = TranslateCap("owner_unknown") }
else
elements[#elements + 1] = { unselectable = true, icon = "fas fa-user", title = TranslateCap("owner", retrivedInfo.owner) }
end

ESX.OpenContext("right", elements, nil, nil)
end, vehicleData.plate)
end

function OpenGetWeaponMenu()
ESX.TriggerServerCallback("bpt_ammujob:getArmoryWeapons", function(weapons)
local elements = {
Expand Down Expand Up @@ -917,7 +757,6 @@ CreateThread(function()
local currentStation, currentPart, currentPartNum

for k, v in pairs(Config.Ammu) do

for i = 1, #v.Armories, 1 do
local distance = #(playerCoords - v.Armories[i])

Expand Down Expand Up @@ -1162,13 +1001,3 @@ function StartHandcuffTimer()
handcuffTimer.active = false
end)
end

-- TODO
-- - return to garage if owned
-- - message owner that his vehicle has been impounded
function ImpoundVehicle(vehicle)
--local vehicleName = GetLabelText(GetDisplayNameFromVehicleModel(GetEntityModel(vehicle)))
ESX.Game.DeleteVehicle(vehicle)
ESX.ShowNotification(TranslateCap("impound_successful"))
currentTask.busy = false
end
19 changes: 0 additions & 19 deletions server-data/resources/[bpt_addons]/bpt_ammujob/locales/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ Locales["en"] = {
-- Action Menu
["menu_title"] = "Ammu",
["citizen_interaction"] = "citizen Interaction",
["vehicle_interaction"] = "vehicle Interaction",
["id_card"] = "ID Card",
["search"] = "search",
["handcuff"] = "cuff / Uncuff",
Expand All @@ -68,26 +67,8 @@ Locales["en"] = {
["out_the_vehicle"] = "drag out from vehicle",
["fine"] = "fine",
["license_check"] = "manage license",
["license_revoke"] = "revoke license",
["license_revoked"] = "your %s has been revoked!",
["licence_you_revoked"] = "you revoked a %s which belonged to %s",
["no_players_nearby"] = "there is no player(s) nearby!",
["being_searched"] = "you are being searched by the Ammu",
-- Vehicle interaction
["vehicle_info"] = "vehicle Info",
["pick_lock"] = "lockpick Vehicle",
["vehicle_unlocked"] = "vehicle Unlocked",
["no_vehicles_nearby"] = "there is no vehicles nearby",
["impound"] = "impound vehicle",
["impound_prompt"] = "press [E] to cancel the impound",
["impound_canceled"] = "you canceled the impound",
["impound_canceled_moved"] = "the impound has been canceled because the vehicle moved",
["impound_successful"] = "you have impounded the vehicle",
["search_database"] = "vehicle information",
["search_database_title"] = "vehicle information - search with registration number",
["search_database_error_invalid"] = "that is ~r~not a valid registration number",
["search_plate"] = "Enter Plate",
["lookup_plate"] = "Lookup Plate",
-- ID Card Menu
["name"] = "name: %s",
["job"] = "job: %s",
Expand Down
19 changes: 0 additions & 19 deletions server-data/resources/[bpt_addons]/bpt_ammujob/locales/it.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ Locales["it"] = {
-- Menu Azioni
["menu_title"] = "Armeria",
["citizen_interaction"] = "Interazione con cittadino",
["vehicle_interaction"] = "Interazione con veicolo",
["id_card"] = "Carta d'identità",
["search"] = "perquisisci",
["handcuff"] = "ammanetta / smanetta",
Expand All @@ -68,29 +67,11 @@ Locales["it"] = {
["out_the_vehicle"] = "trascina fuori dal veicolo",
["fine"] = "multa",
["license_check"] = "gestisci licenze",
["license_revoke"] = "revoca licenza",
["license_revoked"] = "la tua %s è stata revocata!",
["licence_you_revoked"] = "hai revocato una %s che apparteneva a %s",
["no_players_nearby"] = "non ci sono giocatori nelle vicinanze!",
["being_searched"] = "perquisizione in corso",
["fine_enter_amount"] = "Inserisci l'importo della sanzione",
["fine_enter_text"] = "Inserisci il motivo della multa",
["invalid_amount"] = "Errore: l'importo non era un numero o non era valido",
-- Interazione veicolo
["vehicle_info"] = "informazioni sul veicolo",
["pick_lock"] = "forza la serratura del veicolo",
["vehicle_unlocked"] = "veicolo sbloccato",
["no_vehicles_nearby"] = "non ci sono veicoli nelle vicinanze",
["impound"] = "recupera veicolo",
["impound_prompt"] = "Premi [E] per annullare il recupero",
["impound_canceled"] = "hai annullato il recupero",
["impound_canceled_moved"] = "il recupero è stato annullato perché il veicolo si è mosso",
["impound_successful"] = "hai confiscato il veicolo",
["search_database"] = "informazioni sul veicolo",
["search_database_title"] = "informazioni sul veicolo - cerca con numero di targa",
["search_database_error_invalid"] = "quello non è un numero di targa valido",
["search_plate"] = "Inserisci targa",
["lookup_plate"] = "Cerca targa",
-- Menu Carta d'identità
["name"] = "nome: %s",
["job"] = "lavoro: %s",
Expand Down

0 comments on commit 6ecd385

Please sign in to comment.