Skip to content

Commit

Permalink
chore: bpt_ammujob 🎨 Run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpredator committed Jun 11, 2024
1 parent ef9a008 commit 6c5eb45
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 168 deletions.
72 changes: 36 additions & 36 deletions server-data/resources/[bpt_addons]/bpt_ammujob/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,48 @@ Config.Locale = "en"
Config.OxInventory = ESX.GetConfig().OxInventory

Config.AuthorizedVehicles = {
{ model = "rumpo", label = "Rumpo" },
{ model = "rumpo", label = "Rumpo" },
}

Config.Zones = {

VehicleSpawner = {
Pos = { x = 821.340637, y = -2146.417480, z = 28.706909 },
Size = { x = 1.0, y = 1.0, z = 1.0 },
Color = { r = 145, g = 30, b = 30 },
Type = 36,
Rotate = true,
},
VehicleSpawner = {
Pos = { x = 821.340637, y = -2146.417480, z = 28.706909 },
Size = { x = 1.0, y = 1.0, z = 1.0 },
Color = { r = 145, g = 30, b = 30 },
Type = 36,
Rotate = true,
},

VehicleSpawnPoint = {
Pos = { x = 822.540649, y = -2134.575928, z = 29.279907 },
Size = { x = 1.5, y = 1.5, z = 1.0 },
Type = -1,
Rotate = false,
Heading = 225.0,
},
VehicleSpawnPoint = {
Pos = { x = 822.540649, y = -2134.575928, z = 29.279907 },
Size = { x = 1.5, y = 1.5, z = 1.0 },
Type = -1,
Rotate = false,
Heading = 225.0,
},

VehicleDeleter = {
Pos = { x = 822.540649, y = -2134.575928, z = 28.279907 },
Size = { x = 3.0, y = 3.0, z = 0.25 },
Color = { r = 255, g = 0, b = 0 },
Type = 1,
Rotate = false,
},
VehicleDeleter = {
Pos = { x = 822.540649, y = -2134.575928, z = 28.279907 },
Size = { x = 3.0, y = 3.0, z = 0.25 },
Color = { r = 255, g = 0, b = 0 },
Type = 1,
Rotate = false,
},

AmmuActions = {
Pos = { x = 812.479126, y = -2159.182373, z = 29.616821 },
Size = { x = 0.5, y = 0.5, z = 0.5 },
Color = { r = 204, g = 204, b = 0 },
Type = 20,
Rotate = true,
},
AmmuActions = {
Pos = { x = 812.479126, y = -2159.182373, z = 29.616821 },
Size = { x = 0.5, y = 0.5, z = 0.5 },
Color = { r = 204, g = 204, b = 0 },
Type = 20,
Rotate = true,
},

Cloakroom = {
Pos = { x = 810.065918, y = -2162.439453, z = 29.616821 },
Size = { x = 0.5, y = 0.5, z = 0.5 },
Color = { r = 204, g = 204, b = 0 },
Type = 21,
Rotate = true,
},
Cloakroom = {
Pos = { x = 810.065918, y = -2162.439453, z = 29.616821 },
Size = { x = 0.5, y = 0.5, z = 0.5 },
Color = { r = 204, g = 204, b = 0 },
Type = 21,
Rotate = true,
},
}
16 changes: 8 additions & 8 deletions server-data/resources/[bpt_addons]/bpt_ammujob/fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ version("1.0.1")
shared_script("@es_extended/imports.lua")

client_scripts({
"@es_extended/locale.lua",
"locales/*.lua",
"config.lua",
"client/*.lua",
"@es_extended/locale.lua",
"locales/*.lua",
"config.lua",
"client/*.lua",
})

server_scripts({
"@es_extended/locale.lua",
"locales/*.lua",
"config.lua",
"server/*.lua",
"@es_extended/locale.lua",
"locales/*.lua",
"config.lua",
"server/*.lua",
})

dependency("es_extended")
64 changes: 32 additions & 32 deletions server-data/resources/[bpt_addons]/bpt_ammujob/locales/en.lua
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
Locales["en"] = {
-- cloakroom
["cloakroom_menu"] = "cloakroom",
["cloakroom_prompt"] = "press [E] to access the cloakroom.",
["wear_citizen"] = "civilian clothing",
["wear_work"] = "work clothes",
-- Inventory
["deposit_stock"] = "Deposit stock",
["take_stock"] = "Take stock",
["have_deposited"] = "Have deposited",
["quantity_invalid"] = "Quantity invelid",
-- garage
["spawner_prompt"] = "press [E] to access the garage.",
["vehicle_spawned"] = "vehicle spawned successfully!",
["store_veh"] = "press [E] to deposit the vehicle",
["spawn_veh"] = "spawn vehicle",
["spawnpoint_blocked"] = "vehicle blocks the spawnpoint!",
["only_ammu"] = "you can only deposit company vehicles.",
["empty_garage"] = "no vehicles in the garage!",
["taking_service"] = "Take service: Gunsmith",
["full_service"] = "complete service: ",
["amount_invalid"] = "invalid amount",
["press_to_open"] = "press [E] to access the menu",
["billing"] = "billing",
["billing_sent"] = "the invoice has been posted!",
["invoice_amount"] = "invoice amount",
["no_players_near"] = "no players nearby",
["boss_actions"] = "Boss actions",
["blip_ammu"] = "Armory.",
["ammu"] = "ammu",
-- billing
["bill_amount"] = "Amount to bill..",
["confirm"] = "Confirm",
-- cloakroom
["cloakroom_menu"] = "cloakroom",
["cloakroom_prompt"] = "press [E] to access the cloakroom.",
["wear_citizen"] = "civilian clothing",
["wear_work"] = "work clothes",
-- Inventory
["deposit_stock"] = "Deposit stock",
["take_stock"] = "Take stock",
["have_deposited"] = "Have deposited",
["quantity_invalid"] = "Quantity invelid",
-- garage
["spawner_prompt"] = "press [E] to access the garage.",
["vehicle_spawned"] = "vehicle spawned successfully!",
["store_veh"] = "press [E] to deposit the vehicle",
["spawn_veh"] = "spawn vehicle",
["spawnpoint_blocked"] = "vehicle blocks the spawnpoint!",
["only_ammu"] = "you can only deposit company vehicles.",
["empty_garage"] = "no vehicles in the garage!",
["taking_service"] = "Take service: Gunsmith",
["full_service"] = "complete service: ",
["amount_invalid"] = "invalid amount",
["press_to_open"] = "press [E] to access the menu",
["billing"] = "billing",
["billing_sent"] = "the invoice has been posted!",
["invoice_amount"] = "invoice amount",
["no_players_near"] = "no players nearby",
["boss_actions"] = "Boss actions",
["blip_ammu"] = "Armory.",
["ammu"] = "ammu",
-- billing
["bill_amount"] = "Amount to bill..",
["confirm"] = "Confirm",
}
64 changes: 32 additions & 32 deletions server-data/resources/[bpt_addons]/bpt_ammujob/locales/it.lua
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
Locales["it"] = {
-- cloakroom
["cloakroom_menu"] = "guardaroba",
["cloakroom_prompt"] = "premi [E] per accedere al guardaroba.",
["wear_citizen"] = "abbigliamento civile",
["wear_work"] = "abiti da lavoro",
-- Inventory
["deposit_stock"] = "Depositare",
["take_stock"] = "Prendi",
["have_deposited"] = "Hai depositato",
["quantity_invalid"] = "Qunatità non valida",
-- garage
["spawner_prompt"] = "premi [E] per accedere al garage.",
["vehicle_spawned"] = "veicolo generato con successo!",
["store_veh"] = "premi [E] per depositare il veicolo",
["spawn_veh"] = "genera veicolo",
["spawnpoint_blocked"] = "un veicolo blocca lo spawnpoint!",
["only_ammu"] = "puoi depositare solo veicoli aziendali.",
["empty_garage"] = "nessun veicolo nel garage!",
["taking_service"] = "prendi servizio: Armaiolo",
["full_service"] = "servizio completo: ",
["amount_invalid"] = "importo non valido",
["press_to_open"] = "premi [E] per accedere al menu",
["billing"] = "fattura",
["billing_sent"] = "la fattura è stata registrata!",
["invoice_amount"] = "importo fattura",
["no_players_near"] = "nessun giocatore nelle vicinanze",
["boss_actions"] = "Azioni del capo",
["blip_ammu"] = "Armeria.",
["ammu"] = "ammu",
-- billing
["bill_amount"] = "importo della fattura",
["confirm"] = "Conferma",
-- cloakroom
["cloakroom_menu"] = "guardaroba",
["cloakroom_prompt"] = "premi [E] per accedere al guardaroba.",
["wear_citizen"] = "abbigliamento civile",
["wear_work"] = "abiti da lavoro",
-- Inventory
["deposit_stock"] = "Depositare",
["take_stock"] = "Prendi",
["have_deposited"] = "Hai depositato",
["quantity_invalid"] = "Qunatità non valida",
-- garage
["spawner_prompt"] = "premi [E] per accedere al garage.",
["vehicle_spawned"] = "veicolo generato con successo!",
["store_veh"] = "premi [E] per depositare il veicolo",
["spawn_veh"] = "genera veicolo",
["spawnpoint_blocked"] = "un veicolo blocca lo spawnpoint!",
["only_ammu"] = "puoi depositare solo veicoli aziendali.",
["empty_garage"] = "nessun veicolo nel garage!",
["taking_service"] = "prendi servizio: Armaiolo",
["full_service"] = "servizio completo: ",
["amount_invalid"] = "importo non valido",
["press_to_open"] = "premi [E] per accedere al menu",
["billing"] = "fattura",
["billing_sent"] = "la fattura è stata registrata!",
["invoice_amount"] = "importo fattura",
["no_players_near"] = "nessun giocatore nelle vicinanze",
["boss_actions"] = "Azioni del capo",
["blip_ammu"] = "Armeria.",
["ammu"] = "ammu",
-- billing
["bill_amount"] = "importo della fattura",
["confirm"] = "Conferma",
}
116 changes: 56 additions & 60 deletions server-data/resources/[bpt_addons]/bpt_ammujob/server/main.lua
Original file line number Diff line number Diff line change
@@ -1,84 +1,80 @@
TriggerEvent("esx_society:registerSociety", "ammu", "Ammu", "society_ammu", "society_ammu", "society_ammu", {
type = "public",
type = "public",
})

if Config.MaxInService ~= -1 then
TriggerEvent("esx_service:activateService", "ammu", Config.MaxInService)
TriggerEvent("esx_service:activateService", "ammu", Config.MaxInService)
end

ESX.RegisterServerCallback("bpt_ammujob:SpawnVehicle", function(source, cb, model, props)
local xPlayer = ESX.GetPlayerFromId(source)
local xPlayer = ESX.GetPlayerFromId(source)

if xPlayer.job.name ~= "ammu" then
print(("[^3WARNING^7] Player ^5%s^7 attempted to Exploit Vehicle Spawing!!"):format(source))
return
end
local SpawnPoint = vector3(
Config.Zones.VehicleSpawnPoint.Pos.x,
Config.Zones.VehicleSpawnPoint.Pos.y,
Config.Zones.VehicleSpawnPoint.Pos.z
)
ESX.OneSync.SpawnVehicle(joaat(model), SpawnPoint, Config.Zones.VehicleSpawnPoint.Heading, props, function()
local vehicle = NetworkGetEntityFromNetworkId()
while GetVehicleNumberPlateText(vehicle) ~= props.plate do
Wait(0)
end
TaskWarpPedIntoVehicle(GetPlayerPed(source), vehicle, -1)
end)
cb()
if xPlayer.job.name ~= "ammu" then
print(("[^3WARNING^7] Player ^5%s^7 attempted to Exploit Vehicle Spawing!!"):format(source))
return
end
local SpawnPoint = vector3(Config.Zones.VehicleSpawnPoint.Pos.x, Config.Zones.VehicleSpawnPoint.Pos.y, Config.Zones.VehicleSpawnPoint.Pos.z)
ESX.OneSync.SpawnVehicle(joaat(model), SpawnPoint, Config.Zones.VehicleSpawnPoint.Heading, props, function()
local vehicle = NetworkGetEntityFromNetworkId()
while GetVehicleNumberPlateText(vehicle) ~= props.plate do
Wait(0)
end
TaskWarpPedIntoVehicle(GetPlayerPed(source), vehicle, -1)
end)
cb()
end)

RegisterNetEvent("bpt_ammujob:getStockItem")
AddEventHandler("bpt_ammujob:getStockItem", function(itemName, count)
local xPlayer = ESX.GetPlayerFromId(source)
local xPlayer = ESX.GetPlayerFromId(source)

if xPlayer.job.name == "ammu" then
TriggerEvent("bpt_addoninventory:getSharedInventory", "society_ammu", function(inventory)
local item = inventory.getItem(itemName)
if xPlayer.job.name == "ammu" then
TriggerEvent("bpt_addoninventory:getSharedInventory", "society_ammu", function(inventory)
local item = inventory.getItem(itemName)

-- is there enough in the society?
if count > 0 and item.count >= count then
-- can the player carry the said amount of x item?
if xPlayer.canCarryItem(itemName, count) then
inventory.removeItem(itemName, count)
xPlayer.addInventoryItem(itemName, count)
xPlayer.showNotification(TranslateCap("have_withdrawn", count, item.label))
else
xPlayer.showNotification(TranslateCap("player_cannot_hold"))
end
else
xPlayer.showNotification(TranslateCap("quantity_invalid"))
end
end)
else
print(("[^3WARNING^7] Player ^5%s^7 attempted ^5bpt_ammujob:getStockItem^7 (cheating)"):format(source))
end
-- is there enough in the society?
if count > 0 and item.count >= count then
-- can the player carry the said amount of x item?
if xPlayer.canCarryItem(itemName, count) then
inventory.removeItem(itemName, count)
xPlayer.addInventoryItem(itemName, count)
xPlayer.showNotification(TranslateCap("have_withdrawn", count, item.label))
else
xPlayer.showNotification(TranslateCap("player_cannot_hold"))
end
else
xPlayer.showNotification(TranslateCap("quantity_invalid"))
end
end)
else
print(("[^3WARNING^7] Player ^5%s^7 attempted ^5bpt_ammujob:getStockItem^7 (cheating)"):format(source))
end
end)

ESX.RegisterServerCallback("bpt_ammujob:getStockItems", function(_, cb)
TriggerEvent("bpt_addoninventory:getSharedInventory", "society_ammu", function(inventory)
cb(inventory.items)
end)
TriggerEvent("bpt_addoninventory:getSharedInventory", "society_ammu", function(inventory)
cb(inventory.items)
end)
end)

RegisterNetEvent("bpt_ammujob:putStockItems")
AddEventHandler("bpt_ammujob:putStockItems", function(itemName, count)
local xPlayer = ESX.GetPlayerFromId(source)
local sourceItem = xPlayer.getInventoryItem(itemName)
local xPlayer = ESX.GetPlayerFromId(source)
local sourceItem = xPlayer.getInventoryItem(itemName)

if xPlayer.job.name == "ammu" then
TriggerEvent("bpt_addoninventory:getSharedInventory", "society_ammu", function(inventory)
local item = inventory.getItem(itemName)
if xPlayer.job.name == "ammu" then
TriggerEvent("bpt_addoninventory:getSharedInventory", "society_ammu", function(inventory)
local item = inventory.getItem(itemName)

if sourceItem.count >= count and count > 0 then
xPlayer.removeInventoryItem(itemName, count)
inventory.addItem(itemName, count)
xPlayer.showNotification(TranslateCap("have_deposited", count, item.label))
else
xPlayer.showNotification(TranslateCap("quantity_invalid"))
end
end)
else
print(("[^3WARNING^7] Player ^5%s^7 attempted ^5bpt_ammujob:putStockItems^7 (cheating)"):format(source))
end
if sourceItem.count >= count and count > 0 then
xPlayer.removeInventoryItem(itemName, count)
inventory.addItem(itemName, count)
xPlayer.showNotification(TranslateCap("have_deposited", count, item.label))
else
xPlayer.showNotification(TranslateCap("quantity_invalid"))
end
end)
else
print(("[^3WARNING^7] Player ^5%s^7 attempted ^5bpt_ammujob:putStockItems^7 (cheating)"):format(source))
end
end)

0 comments on commit 6c5eb45

Please sign in to comment.