mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 10:18:54 +00:00
A lot of cleanup, see desc
- Improved i18n formatting - All employees can buy vehicles - Fixed exploit taking more than you can carry from the society
This commit is contained in:
+16
-22
@@ -110,11 +110,11 @@ function OpenShopMenu ()
|
||||
ESX.UI.Menu.Open(
|
||||
'default', GetCurrentResourceName(), 'shop_confirm',
|
||||
{
|
||||
title = _U('buy') .. ' ' .. vehicleData.name .. ' ' .. _U('for') .. ' ' .. vehicleData.price .. ' ?',
|
||||
title = _U('buy_vehicle_shop', vehicleData.name, vehicleData.price),
|
||||
align = 'top-left',
|
||||
elements = {
|
||||
{label = _U('yes'), value = 'yes'},
|
||||
{label = _U('no'), value = 'no'},
|
||||
{label = _U('no'), value = 'no'},
|
||||
},
|
||||
},
|
||||
function (data2, menu2)
|
||||
@@ -134,7 +134,7 @@ function OpenShopMenu ()
|
||||
|
||||
FreezeEntityPosition(playerPed, false)
|
||||
SetEntityVisible(playerPed, true)
|
||||
SetEntityCoords(playerPed, Config.Zones.BossActions.Pos.x, Config.Zones.BossActions.Pos.y, Config.Zones.BossActions.Pos.z)
|
||||
SetEntityCoords(playerPed, Config.Zones.ShopEntering.Pos.x, Config.Zones.ShopEntering.Pos.y, Config.Zones.ShopEntering.Pos.z)
|
||||
|
||||
menu2.close()
|
||||
menu.close()
|
||||
@@ -152,11 +152,11 @@ function OpenShopMenu ()
|
||||
ESX.UI.Menu.Open(
|
||||
'default', GetCurrentResourceName(), 'shop_confirm_buy_type',
|
||||
{
|
||||
title = 'Type d\'achat',
|
||||
title = _U('purchase_type'),
|
||||
align = 'top-left',
|
||||
elements = {
|
||||
{label = 'Personnel', value = 'personnal'},
|
||||
{label = 'Societé', value = 'society'},
|
||||
{label = _U('staff_type'), value = 'personnal'},
|
||||
{label = _U('society_type'), value = 'society'},
|
||||
},
|
||||
},
|
||||
function (data3, menu3)
|
||||
@@ -300,12 +300,7 @@ function OpenShopMenu ()
|
||||
|
||||
FreezeEntityPosition(playerPed, false)
|
||||
SetEntityVisible(playerPed, true)
|
||||
|
||||
if Config.EnablePlayerManagement then
|
||||
SetEntityCoords(playerPed, Config.Zones.BossActions.Pos.x, Config.Zones.BossActions.Pos.y, Config.Zones.BossActions.Pos.z)
|
||||
else
|
||||
SetEntityCoords(playerPed, Config.Zones.ShopEntering.Pos.x, Config.Zones.ShopEntering.Pos.y, Config.Zones.ShopEntering.Pos.z)
|
||||
end
|
||||
SetEntityCoords(playerPed, Config.Zones.ShopEntering.Pos.x, Config.Zones.ShopEntering.Pos.y, Config.Zones.ShopEntering.Pos.z)
|
||||
|
||||
IsInShopMenu = false
|
||||
|
||||
@@ -352,6 +347,7 @@ function OpenResellerMenu ()
|
||||
title = _U('car_dealer'),
|
||||
align = 'top-left',
|
||||
elements = {
|
||||
{label = _U('buy_vehicle'), value = 'buy_vehicle'},
|
||||
{label = _U('pop_vehicle'), value = 'pop_vehicle'},
|
||||
{label = _U('depop_vehicle'), value = 'depop_vehicle'},
|
||||
{label = _U('create_bill'), value = 'create_bill'},
|
||||
@@ -364,6 +360,9 @@ function OpenResellerMenu ()
|
||||
}
|
||||
},
|
||||
function (data, menu)
|
||||
if data.current.value == 'buy_vehicle' then
|
||||
OpenShopMenu()
|
||||
end
|
||||
if data.current.value == 'put_stock' then
|
||||
OpenPutStocksMenu()
|
||||
end
|
||||
@@ -634,15 +633,10 @@ function OpenBossActionsMenu ()
|
||||
title = _U('dealer_boss'),
|
||||
align = 'top-left',
|
||||
elements = {
|
||||
{label = _U('buy_vehicle'), value = 'buy_vehicle'},
|
||||
{label = 'Action Patron', value = 'boss_actions'},
|
||||
{label = _U('boss_actions'), value = 'boss_actions'},
|
||||
},
|
||||
},
|
||||
function (data, menu)
|
||||
if data.current.value == 'buy_vehicle' then
|
||||
OpenShopMenu()
|
||||
end
|
||||
|
||||
if data.current.value == 'boss_actions' then
|
||||
TriggerEvent('esx_society:openBossMenu', 'cardealer', function(data, menu)
|
||||
menu.close()
|
||||
@@ -849,7 +843,7 @@ AddEventHandler('esx_vehicleshop:hasEnteredMarker', function (zone)
|
||||
local resellPrice = math.floor(vehicleData.price / 100 * Config.ResellPercentage)
|
||||
|
||||
CurrentAction = 'resell_vehicle'
|
||||
CurrentActionMsg = _U('sell_menu').. vehicleData.name .. _U('price') .. resellPrice
|
||||
CurrentActionMsg = _U('sell_menu', vehicleData.name, resellPrice)
|
||||
|
||||
CurrentActionData = {
|
||||
vehicle = vehicle,
|
||||
@@ -903,7 +897,7 @@ end)
|
||||
-- Display markers
|
||||
Citizen.CreateThread(function ()
|
||||
while true do
|
||||
Wait(0)
|
||||
Citizen.Wait(10)
|
||||
|
||||
local coords = GetEntityCoords(GetPlayerPed(-1))
|
||||
|
||||
@@ -918,7 +912,7 @@ end)
|
||||
-- Enter / Exit marker events
|
||||
Citizen.CreateThread(function ()
|
||||
while true do
|
||||
Wait(0)
|
||||
Citizen.Wait(10)
|
||||
|
||||
local coords = GetEntityCoords(GetPlayerPed(-1))
|
||||
local isInMarker = false
|
||||
@@ -947,7 +941,7 @@ end)
|
||||
-- Key controls
|
||||
Citizen.CreateThread(function ()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
Citizen.Wait(10)
|
||||
|
||||
if CurrentAction ~= nil then
|
||||
SetTextComponentFormat('STRING')
|
||||
|
||||
+1
-2
@@ -72,12 +72,11 @@ INSERT INTO `vehicle_categories` (name, label) VALUES
|
||||
;
|
||||
|
||||
CREATE TABLE `vehicles` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(60) NOT NULL,
|
||||
`model` varchar(60) NOT NULL,
|
||||
`price` int(11) NOT NULL,
|
||||
`category` varchar(60) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
PRIMARY KEY (`model`)
|
||||
);
|
||||
|
||||
INSERT INTO `vehicles` (name, model, price, category) VALUES
|
||||
|
||||
+2
-4
@@ -3,7 +3,7 @@ Locales['br'] = {
|
||||
['belongs'] = ' agora pertence a você',
|
||||
['bleach amount'] = 'amount to bleach',
|
||||
['broke_company'] = 'você não tem dinheiro suficiente na conta da empresa',
|
||||
['buy'] = 'Comprar ',
|
||||
['buy_vehicle_shop'] = 'comprar %s por $%s?',
|
||||
['buy_vehicle'] = 'comprar veículo',
|
||||
['car_dealer'] = 'Concessionária de carros',
|
||||
['create_bill'] = 'criar recibo',
|
||||
@@ -13,7 +13,6 @@ Locales['br'] = {
|
||||
['deposit_amount'] = 'valor do depósito',
|
||||
['deposit_money'] = 'depositar dinheiro',
|
||||
['experianced'] = 'com experiência',
|
||||
['for'] = ' por $',
|
||||
['get_rented_vehicles'] = 'veículos para alugar',
|
||||
['invalid_amount'] = 'Montante inválido',
|
||||
['invoice_amount'] = 'valor da fatura',
|
||||
@@ -26,14 +25,13 @@ Locales['br'] = {
|
||||
['paid_rental'] = 'Você tem ~g~pago~s~ para o seu aluguel de veiculos : ~g~$',
|
||||
['personal_vehicle'] = 'veículo pessoal',
|
||||
['pop_vehicle'] = 'sai do veiculo',
|
||||
['price'] = ' pela quantidade de $',
|
||||
['recruit'] = 'Recrutar',
|
||||
['rent_vehicle'] = 'Concessionária - Veículos para alugar',
|
||||
['rental_amount'] = 'montante do aluguel',
|
||||
['sell_menu'] = 'Pressione ~INPUT_CONTEXT~ para vender ',
|
||||
['set_vehicle_owner_rent'] = 'Atribuir veículo [Alugar]',
|
||||
['set_vehicle_owner_sell'] = 'Veículos para [Venda]',
|
||||
['shop_menu'] = 'Pressione ~INPUT_CONTEXT~ para acessar o menu',
|
||||
['shop_menu'] = 'pressione ~INPUT_CONTEXT~ para acessar o menu ~y~%s~s~ pela quantidade de ~g~$%s~s~',
|
||||
['the_boss'] = 'Chefe',
|
||||
['vehicle'] = 'veículo ',
|
||||
['vehicle_dealer'] = 'Veículo - Concessionária',
|
||||
|
||||
+2
-4
@@ -3,7 +3,7 @@ Locales['de'] = {
|
||||
['belongs'] = ' gehört jetzt dir',
|
||||
['bleach amount'] = 'Betrag zum waschen',
|
||||
['broke_company'] = 'du hast nicht genug Geld auf dem Firmenkonto',
|
||||
['buy'] = 'kaufen',
|
||||
['buy_vehicle_shop'] = 'kaufen %s für $%s?',
|
||||
['buy_vehicle'] = 'Fahrzeug kaufen',
|
||||
['car_dealer'] = 'Autohändler',
|
||||
['create_bill'] = 'Rechnung erstellen',
|
||||
@@ -13,7 +13,6 @@ Locales['de'] = {
|
||||
['deposit_amount'] = 'Einzahlbetrag',
|
||||
['deposit_money'] = 'Geld einzahlen',
|
||||
['experianced'] = 'erfahren',
|
||||
['for'] = 'für $',
|
||||
['get_rented_vehicles'] = 'Mietwagen',
|
||||
['invalid_amount'] = 'ungültiger Betrag',
|
||||
['invoice_amount'] = 'Rechnungsbetrag',
|
||||
@@ -26,11 +25,10 @@ Locales['de'] = {
|
||||
['paid_rental'] = 'du ~g~bezahlst~s~ für den Mietwagen : ~g~$',
|
||||
['personal_vehicle'] = 'Persönliches Fahrzeug',
|
||||
['pop_vehicle'] = 'Fahrzeug holen',
|
||||
['price'] = ' für den Betrag $',
|
||||
['recruit'] = 'Neuling',
|
||||
['rent_vehicle'] = 'Autohändler - Fahrzeuge zum vermieten',
|
||||
['rental_amount'] = 'Mietbetrag',
|
||||
['sell_menu'] = 'Drücke ~INPUT_CONTEXT~ zum verkaufen ',
|
||||
['sell_menu'] = 'drücke ~INPUT_CONTEXT~ zum verkaufen ~y~%s~s~ für den Betrag ~g~$%s~s~',
|
||||
['set_vehicle_owner_rent'] = 'Fahrzeug zuweisen [Mieten]',
|
||||
['set_vehicle_owner_sell'] = 'Fahrzeuge [Verkauf]',
|
||||
['set_vehicle_owner_sell_society'] = 'Fahrzeuge [Verkauf] [Society]',
|
||||
|
||||
+13
-13
@@ -1,22 +1,23 @@
|
||||
Locales['en'] = {
|
||||
--Global menus
|
||||
['not_enough_in_society'] = 'there\'s not enough of ~r~that item~w~ in the society!',
|
||||
['player_cannot_hold'] = 'you do ~r~not~w~ have enough ~y~free space~w~ in your inventory!',
|
||||
['vehicle'] = 'vehicle ~y~',
|
||||
['belongs'] = '~w~ now belongs to you',
|
||||
['not_enough_in_society'] = 'there\'s not enough of ~r~that item~s~ in the society!',
|
||||
['player_cannot_hold'] = 'you do ~r~not~s~ have enough ~y~free space~s~ in your inventory!',
|
||||
['vehicle_belongs'] = 'an vehicle with plate ~y~%s~s~ now belongs to ~b~you~s~',
|
||||
['bleach amount'] = 'amount to bleach',
|
||||
['broke_company'] = 'you do not have enough money in the company account',
|
||||
['buy'] = 'buy',
|
||||
['purchase_type'] = 'type of purchase',
|
||||
['society_type'] = 'society',
|
||||
['staff_type'] = 'staff',
|
||||
['buy_vehicle_shop'] = 'do you want to purchase %s for $%s?',
|
||||
['buy_vehicle'] = 'buy vehicle',
|
||||
['car_dealer'] = 'car Dealership',
|
||||
['create_bill'] = 'create bill',
|
||||
['dealer_boss'] = 'car Dealer - Boss',
|
||||
['delivered'] = 'vehicle ~g~delivered~s~ to the dealer',
|
||||
['delivered'] = 'the vehicle has been ~g~delivered~s~ to the dealer',
|
||||
['depop_vehicle'] = 'return vehicle',
|
||||
['deposit_amount'] = 'deposit amount',
|
||||
['deposit_money'] = 'deposit money',
|
||||
['experianced'] = 'experianced',
|
||||
['for'] = 'for $',
|
||||
['get_rented_vehicles'] = 'vehicles for rent',
|
||||
['invalid_amount'] = 'invalid amount',
|
||||
['invoice_amount'] = 'invoice amount',
|
||||
@@ -29,11 +30,10 @@ Locales['en'] = {
|
||||
['paid_rental'] = 'you have ~g~payed~s~ for your vehicle rental : ~g~$',
|
||||
['personal_vehicle'] = 'personal vehicle',
|
||||
['pop_vehicle'] = 'put out vehicle for sale',
|
||||
['price'] = '~w~ for ~g~$',
|
||||
['recruit'] = 'recruit',
|
||||
['rent_vehicle'] = 'car Dealer - Vehicles for rent',
|
||||
['rental_amount'] = 'rental amount',
|
||||
['sell_menu'] = 'press ~INPUT_CONTEXT~ to sell your ~y~',
|
||||
['sell_menu'] = 'press ~INPUT_CONTEXT~ to sell your ~y~%s~s~ for ~g~$%s~s~',
|
||||
['set_vehicle_owner_rent'] = 'assign vehicle [Location]',
|
||||
['set_vehicle_owner_sell'] = 'Sell vehicle',
|
||||
['set_vehicle_owner_sell_society'] = 'Assign Vehicle [Sale] [Society]',
|
||||
@@ -50,15 +50,15 @@ Locales['en'] = {
|
||||
['withdraw_amount'] = 'amount of withdrawal',
|
||||
['withdraw_money'] = 'remove company money',
|
||||
['yes'] = 'yes',
|
||||
['deposit_stock'] = 'deposit Stock',
|
||||
['take_stock'] = 'take Stock',
|
||||
['deposit_stock'] = 'deposit stock',
|
||||
['take_stock'] = 'withdraw stock',
|
||||
['dealership_stock'] = 'dealership Stock',
|
||||
['amount'] = 'amount',
|
||||
['quantity_invalid'] = 'invalid Quantity',
|
||||
['inventory'] = 'inventory',
|
||||
['dealership'] = 'car Dealer',
|
||||
['dealer_customers'] = 'dealer customers',
|
||||
['have_withdrawn'] = 'you have withdrawn ~y~x%s~w~ ~b~%s~w~',
|
||||
['have_deposited'] = 'you have deposited ~y~x%s~w~ ~b~%s~w~',
|
||||
['have_withdrawn'] = 'you have withdrawn ~y~x%s~s~ ~b~%s~s~',
|
||||
['have_deposited'] = 'you have deposited ~y~x%s~s~ ~b~%s~s~',
|
||||
['boss_actions'] = 'boss actions',
|
||||
}
|
||||
|
||||
+5
-4
@@ -2,8 +2,11 @@ Locales['fr'] = {
|
||||
--Global menus
|
||||
['belongs'] = 'Vous appartient désormais',
|
||||
['bleach amount'] = 'Montant à blanchir',
|
||||
['purchase_type'] = 'type d\'achat',
|
||||
['society_type'] = 'societé',
|
||||
['staff_type'] = 'personnel',
|
||||
['broke_company'] = 'Vous n\'avez pas assez d\'argent sur votre compte société',
|
||||
['buy'] = 'Acheter',
|
||||
['buy_vehicle_shop'] = 'Acheter %s pour $%s?',
|
||||
['buy_vehicle'] = 'Acheter véhicule',
|
||||
['car_dealer'] = 'Concessionnaire',
|
||||
['create_bill'] = 'Créer facture',
|
||||
@@ -13,7 +16,6 @@ Locales['fr'] = {
|
||||
['deposit_amount'] = 'Montant du dépôt',
|
||||
['deposit_money'] = 'Déposer argent',
|
||||
['experianced'] = 'Experimente',
|
||||
['for'] = 'pour $',
|
||||
['get_rented_vehicles'] = 'Véhicules en location',
|
||||
['invalid_amount'] = 'Montant invalide',
|
||||
['invoice_amount'] = 'Montant de la facture',
|
||||
@@ -26,11 +28,10 @@ Locales['fr'] = {
|
||||
['paid_rental'] = 'Vous avez ~g~payé~s~ votre location de véhicule : ~g~$',
|
||||
['personal_vehicle'] = 'Véhicule personnel',
|
||||
['pop_vehicle'] = 'Sortir véhicule',
|
||||
['price'] = 'au prix de $',
|
||||
['recruit'] = 'Recrue',
|
||||
['rent_vehicle'] = 'Concessionnaire - Véhicules en location',
|
||||
['rental_amount'] = 'Montant de la location',
|
||||
['sell_menu'] = 'Appuez sur ~INPUT_CONTEXT~ pour vendre',
|
||||
['sell_menu'] = 'Appuez sur ~INPUT_CONTEXT~ pour vendre ~y~%s~s~ au prix de ~g~$%s~s~',
|
||||
['set_vehicle_owner_rent'] = 'Attribuer véhicule [Location]',
|
||||
['set_vehicle_owner_sell'] = 'Attribuer véhicule [Vente]',
|
||||
['set_vehicle_owner_sell_society'] = 'Attribuer véhicule [Vente] [Société]',
|
||||
|
||||
+35
-27
@@ -5,7 +5,7 @@ local Vehicles = {}
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
|
||||
TriggerEvent('esx_phone:registerNumber', 'cardealer', _U('dealer_customers'), false, false)
|
||||
TriggerEvent('esx_society:registerSociety', 'cardealer', 'Concessionnaire', 'society_cardealer', 'society_cardealer', 'society_cardealer', {type = 'private'})
|
||||
TriggerEvent('esx_society:registerSociety', 'cardealer', _U('car_dealer'), 'society_cardealer', 'society_cardealer', 'society_cardealer', {type = 'private'})
|
||||
|
||||
function RemoveOwnedVehicle (plate)
|
||||
MySQL.Async.fetchAll(
|
||||
@@ -55,7 +55,7 @@ AddEventHandler('esx_vehicleshop:setVehicleOwned', function (vehicleProps)
|
||||
['@owner'] = xPlayer.identifier,
|
||||
},
|
||||
function (rowsChanged)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('vehicle').. vehicleProps.plate .. _('belongs'))
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('vehicle_belongs', vehicleProps.plate))
|
||||
end
|
||||
)
|
||||
end)
|
||||
@@ -71,7 +71,7 @@ AddEventHandler('esx_vehicleshop:setVehicleOwnedPlayerId', function (playerId, v
|
||||
['@owner'] = xPlayer.identifier,
|
||||
},
|
||||
function (rowsChanged)
|
||||
TriggerClientEvent('esx:showNotification', playerId, _U('vehicle') .. vehicleProps.plate .. _('belongs'))
|
||||
TriggerClientEvent('esx:showNotification', playerId, _U('vehicle_belongs', vehicleProps.plate))
|
||||
end
|
||||
)
|
||||
end)
|
||||
@@ -149,38 +149,46 @@ end)
|
||||
|
||||
RegisterServerEvent('esx_vehicleshop:getStockItem')
|
||||
AddEventHandler('esx_vehicleshop:getStockItem', function (itemName, count)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local sourceItem = xPlayer.getInventoryItem(itemName)
|
||||
|
||||
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_cardealer', function (inventory)
|
||||
local item = inventory.getItem(itemName)
|
||||
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_cardealer', function (inventory)
|
||||
local item = inventory.getItem(itemName)
|
||||
|
||||
if item.count >= count then
|
||||
inventory.removeItem(itemName, count)
|
||||
xPlayer.addInventoryItem(itemName, count)
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, 'Quantité invalide')
|
||||
end
|
||||
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('have_withdrawn') .. ' x' .. count .. ' ' .. item.label)
|
||||
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 sourceItem.limit ~= -1 and (sourceItem.count + count) > sourceItem.limit then
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('player_cannot_hold'))
|
||||
else
|
||||
inventory.removeItem(itemName, count)
|
||||
xPlayer.addInventoryItem(itemName, count)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('have_withdrawn', count, item.label))
|
||||
end
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('not_enough_in_society'))
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_vehicleshop:putStockItems')
|
||||
AddEventHandler('esx_vehicleshop:putStockItems', function (itemName, count)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
|
||||
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_cardealer', function (inventory)
|
||||
local item = inventory.getItem(itemName)
|
||||
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_cardealer', function (inventory)
|
||||
local item = inventory.getItem(itemName)
|
||||
|
||||
if item.count >= 0 then
|
||||
xPlayer.removeInventoryItem(itemName, count)
|
||||
inventory.addItem(itemName, count)
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, 'Quantité invalide')
|
||||
end
|
||||
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('added') .. ' x' .. count .. ' ' .. item.label)
|
||||
end)
|
||||
if item.count >= 0 then
|
||||
xPlayer.removeInventoryItem(itemName, count)
|
||||
inventory.addItem(itemName, count)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('have_deposited', count, item.label))
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('invalid_amount'))
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx_vehicleshop:getCategories', function (source, cb)
|
||||
|
||||
Reference in New Issue
Block a user