diff --git a/client/main.lua b/client/main.lua index 2d8e8ce0..1802c34f 100644 --- a/client/main.lua +++ b/client/main.lua @@ -118,7 +118,7 @@ function OpenShopMenu() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'shop_confirm', { - title = _U('buy').. vehicleData.name .. _U('for').. vehicleData.price .. ' ?', + title = _U('buy') .. ' ' .. vehicleData.name .. ' ' .. _U('for') .. ' ' .. vehicleData.price .. ' ?', align = 'top-left', elements = { {label = _U('yes'), value = 'yes'}, @@ -157,47 +157,157 @@ function OpenShopMenu() ESX.ShowNotification(_U('broke_company')) end - end, vehicleData.model) + end, 'cardealer', vehicleData.model) else - ESX.TriggerServerCallback('esx_vehicleshop:buyVehicle', function(hasEnoughMoney) + local playerData = ESX.GetPlayerData() - if hasEnoughMoney then + if Config.EnableSocietyOwnedVehicles and playerData.job.grade_name == 'boss' then - IsInShopMenu = false + ESX.UI.Menu.Open( + 'default', GetCurrentResourceName(), 'shop_confirm_buy_type', + { + title = 'Type d\'achat', + align = 'top-left', + elements = { + {label = 'Personnel', value = 'personnal'}, + {label = 'Societé', value = 'society'}, + } + }, + function(data3, menu3) - menu2.close() - menu.close() + if data3.current.value == 'personnal' then - DeleteShopInsideVehicles() + ESX.TriggerServerCallback('esx_vehicleshop:buyVehicle', function(hasEnoughMoney) - ESX.Game.SpawnVehicle(vehicleData.model, { - x = Config.Zones.ShopOutside.Pos.x, - y = Config.Zones.ShopOutside.Pos.y, - z = Config.Zones.ShopOutside.Pos.z - }, -20.0, function(vehicle) + if hasEnoughMoney then - TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + IsInShopMenu = false - local vehicleProps = ESX.Game.GetVehicleProperties(vehicle) + menu3.close() + menu2.close() + menu.close() + + DeleteShopInsideVehicles() + + ESX.Game.SpawnVehicle(vehicleData.model, { + x = Config.Zones.ShopOutside.Pos.x, + y = Config.Zones.ShopOutside.Pos.y, + z = Config.Zones.ShopOutside.Pos.z + }, -20.0, function(vehicle) + + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + + local vehicleProps = ESX.Game.GetVehicleProperties(vehicle) + + if Config.EnableOwnedVehicles then + TriggerServerEvent('esx_vehicleshop:setVehicleOwned', vehicleProps) + end + + ESX.ShowNotification(_U('vehicle_purchased')) + + end) + + FreezeEntityPosition(playerPed, false) + SetEntityVisible(playerPed, true) + + else + ESX.ShowNotification(_U('not_enough_money')) + end + + end, vehicleData.model) - if Config.EnableOwnedVehicles then - TriggerServerEvent('esx_vehicleshop:setVehicleOwned', vehicleProps) end - ESX.ShowNotification(_U('vehicle_purchased')) + if data3.current.value == 'society' then - end) + ESX.TriggerServerCallback('esx_vehicleshop:buyVehicleSociety', function(hasEnoughMoney) - FreezeEntityPosition(playerPed, false) - SetEntityVisible(playerPed, true) + if hasEnoughMoney then - else - ESX.ShowNotification(_U('not_enough_money')) - end + IsInShopMenu = false - end, vehicleData.model) + menu3.close() + menu2.close() + menu.close() + + DeleteShopInsideVehicles() + + ESX.Game.SpawnVehicle(vehicleData.model, { + x = Config.Zones.ShopOutside.Pos.x, + y = Config.Zones.ShopOutside.Pos.y, + z = Config.Zones.ShopOutside.Pos.z + }, -20.0, function(vehicle) + + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + + local vehicleProps = ESX.Game.GetVehicleProperties(vehicle) + + TriggerServerEvent('esx_vehicleshop:setVehicleOwnedSociety', playerData.job.name, vehicleProps) + + ESX.ShowNotification(_U('vehicle_purchased')) + + end) + + FreezeEntityPosition(playerPed, false) + SetEntityVisible(playerPed, true) + + else + ESX.ShowNotification(_U('broke_company')) + end + + end, playerData.job.name, vehicleData.model) + + end + + end, + function(data3, menu3) + menu3.close() + end + ) + + else + + ESX.TriggerServerCallback('esx_vehicleshop:buyVehicle', function(hasEnoughMoney) + + if hasEnoughMoney then + + IsInShopMenu = false + + menu2.close() + menu.close() + + DeleteShopInsideVehicles() + + ESX.Game.SpawnVehicle(vehicleData.model, { + x = Config.Zones.ShopOutside.Pos.x, + y = Config.Zones.ShopOutside.Pos.y, + z = Config.Zones.ShopOutside.Pos.z + }, -20.0, function(vehicle) + + TaskWarpPedIntoVehicle(playerPed, vehicle, -1) + + local vehicleProps = ESX.Game.GetVehicleProperties(vehicle) + + if Config.EnableOwnedVehicles then + TriggerServerEvent('esx_vehicleshop:setVehicleOwned', vehicleProps) + end + + ESX.ShowNotification(_U('vehicle_purchased')) + + end) + + FreezeEntityPosition(playerPed, false) + SetEntityVisible(playerPed, true) + + else + ESX.ShowNotification(_U('not_enough_money')) + end + + end, vehicleData.model) + + end end @@ -282,25 +392,26 @@ function OpenResellerMenu() title = _U('car_dealer'), align = 'top-left', elements = { - {label = _U('pop_vehicle'), value = 'pop_vehicle'}, - {label = _U('depop_vehicle'), value = 'depop_vehicle'}, - {label = _U('create_bill'), value = 'create_bill'}, - {label = _U('get_rented_vehicles'), value = 'get_rented_vehicles'}, - {label = _U('set_vehicle_owner_sell'), value = 'set_vehicle_owner_sell'}, - {label = _U('set_vehicle_owner_rent'), value = 'set_vehicle_owner_rent'}, - {label = _U('deposit_stock'), value = 'put_stock'}, - {label = _U('take_stock'), value = 'get_stock'} + {label = _U('pop_vehicle'), value = 'pop_vehicle'}, + {label = _U('depop_vehicle'), value = 'depop_vehicle'}, + {label = _U('create_bill'), value = 'create_bill'}, + {label = _U('get_rented_vehicles'), value = 'get_rented_vehicles'}, + {label = _U('set_vehicle_owner_sell'), value = 'set_vehicle_owner_sell'}, + {label = _U('set_vehicle_owner_rent'), value = 'set_vehicle_owner_rent'}, + {label = _U('set_vehicle_owner_sell_society'), value = 'set_vehicle_owner_sell_society'}, + {label = _U('deposit_stock'), value = 'put_stock'}, + {label = _U('take_stock'), value = 'get_stock'} } }, function(data, menu) if data.current.value == 'put_stock' then - OpenPutStocksMenu() - end + OpenPutStocksMenu() + end - if data.current.value == 'get_stock' then - OpenGetStocksMenu() - end + if data.current.value == 'get_stock' then + OpenGetStocksMenu() + end if data.current.value == 'pop_vehicle' then OpenPopVehicleMenu() @@ -373,6 +484,34 @@ function OpenResellerMenu() end + if data.current.value == 'set_vehicle_owner_sell_society' then + + local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer() + + if closestPlayer == -1 or closestDistance > 3.0 then + ESX.ShowNotification(_U('no_players')) + else + + ESX.TriggerServerCallback('esx:getOtherPlayerData', function(xPlayer) + + local vehicleProps = ESX.Game.GetVehicleProperties(LastVehicles[#LastVehicles]) + local model = CurrentVehicleData.model + + TriggerServerEvent('esx_vehicleshop:sellVehicle', model) + + if Config.EnableSocietyOwnedVehicles then + TriggerServerEvent('esx_vehicleshop:setVehicleOwnedSociety', xPlayer.job.name, vehicleProps) + ESX.ShowNotification(_U('vehicle_set_owned', vehicleProps.plate, GetPlayerName(closestPlayer))) + else + ESX.ShowNotification(_U('vehicle_sold_to', vehicleProps.plate, GetPlayerName(closestPlayer))) + end + + end, GetPlayerServerId(closestPlayer)) + + end + + end + if data.current.value == 'set_vehicle_owner_rent' then ESX.UI.Menu.Open( diff --git a/config.lua b/config.lua index c4cb3f43..5b9e7515 100644 --- a/config.lua +++ b/config.lua @@ -1,11 +1,12 @@ -Config = {} -Config.DrawDistance = 100.0 -Config.MarkerColor = {r = 120, g = 120, b = 240} -Config.EnablePlayerManagement = false -- If set to true, you need esx_addonaccount, esx_billing and esx_society -Config.EnablePvCommand = true -Config.EnableOwnedVehicles = true -Config.ResellPercentage = 50 -Config.Locale = 'fr' +Config = {} +Config.DrawDistance = 100.0 +Config.MarkerColor = {r = 120, g = 120, b = 240} +Config.EnablePlayerManagement = false -- If set to true, you need esx_addonaccount, esx_billing and esx_society +Config.EnablePvCommand = true +Config.EnableOwnedVehicles = true +Config.EnableSocietyOwnedVehicles = false +Config.ResellPercentage = 50 +Config.Locale = 'fr' Config.Zones = { diff --git a/locales/de.lua b/locales/de.lua index fa06f1db..caaeb486 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -1,50 +1,51 @@ Locales['de'] = { --Global menus - ['belongs'] = ' gehört jetzt dir', - ['bleach amount'] = 'Betrag zum waschen', - ['broke_company'] = 'du hast nicht genug Geld auf dem Firmenkonto', - ['buy'] = 'kaufen', - ['buy_vehicle'] = 'Fahrzeug kaufen', - ['car_dealer'] = 'Autohändler', - ['create_bill'] = 'Rechnung erstellen', - ['dealer_boss'] = 'Autohändler - Boss', - ['delivered'] = 'Fahrzeug zum Händler ~g~gebracht~s~', - ['depop_vehicle'] = 'Fahrzeug zurückholen', - ['deposit_amount'] = 'Einzahlbetrag', - ['deposit_money'] = 'Geld einzahlen', - ['experianced'] = 'erfahren', - ['for'] = 'für $', - ['get_rented_vehicles'] = 'Mietwagen', - ['invalid_amount'] = 'ungültiger Betrag', - ['invoice_amount'] = 'Rechnungsbetrag', - ['leaving'] = 'verlasse persönnliches Fahrzeug', - ['no'] = 'nein', - ['no_players'] = 'keine Spieler in der Nähe', - ['not_enough_money'] = 'du hast nicht genug Geld', - ['not_rental'] = 'dies ist kein ~r~Mietwagen~s~', - ['not_yours'] = 'dieses Fahrzeug gehört dir nicht', - ['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 ', - ['set_vehicle_owner_rent'] = 'Fahrzeug zuweisen [Mieten]', - ['set_vehicle_owner_sell'] = 'Fahrzeuge [Verkauf]', - ['shop_menu'] = 'Drücke ~INPUT_CONTEXT~ um das Menü zu öffnen', - ['the_boss'] = 'boss', - ['vehicle'] = 'Fahrzeug ', - ['vehicle_dealer'] = 'Autohändler', - ['vehicle_menu'] = 'Drücke ~INPUT_CONTEXT~ um ein Fahrzeug zu übergeben', - ['vehicle_purchased'] = 'du hast ein Fahrzeug gekauft', - ['vehicle_set_owned'] = 'Vehicle ~y~%s~s~ has been assigned to ~b~%s~s~', - ['vehicle_set_rented'] = 'Vehicle ~y~%s~s~ has been rented to ~b~%s~s~', - ['vehicle_sold'] = 'Fahrzeug ~g~verkauft~s~', - ['vehicle_sold_to'] = 'Vehicle ~y~%s~s~ sold to ~b~%s~s~', - ['wash_money'] = 'Geld waschen', - ['withdraw_amount'] = 'Abhebebetrag', - ['withdraw_money'] = 'Firmengeld abheben', - ['yes'] = 'ja', + ['belongs'] = ' gehört jetzt dir', + ['bleach amount'] = 'Betrag zum waschen', + ['broke_company'] = 'du hast nicht genug Geld auf dem Firmenkonto', + ['buy'] = 'kaufen', + ['buy_vehicle'] = 'Fahrzeug kaufen', + ['car_dealer'] = 'Autohändler', + ['create_bill'] = 'Rechnung erstellen', + ['dealer_boss'] = 'Autohändler - Boss', + ['delivered'] = 'Fahrzeug zum Händler ~g~gebracht~s~', + ['depop_vehicle'] = 'Fahrzeug zurückholen', + ['deposit_amount'] = 'Einzahlbetrag', + ['deposit_money'] = 'Geld einzahlen', + ['experianced'] = 'erfahren', + ['for'] = 'für $', + ['get_rented_vehicles'] = 'Mietwagen', + ['invalid_amount'] = 'ungültiger Betrag', + ['invoice_amount'] = 'Rechnungsbetrag', + ['leaving'] = 'verlasse persönnliches Fahrzeug', + ['no'] = 'nein', + ['no_players'] = 'keine Spieler in der Nähe', + ['not_enough_money'] = 'du hast nicht genug Geld', + ['not_rental'] = 'dies ist kein ~r~Mietwagen~s~', + ['not_yours'] = 'dieses Fahrzeug gehört dir nicht', + ['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 ', + ['set_vehicle_owner_rent'] = 'Fahrzeug zuweisen [Mieten]', + ['set_vehicle_owner_sell'] = 'Fahrzeuge [Verkauf]', + ['set_vehicle_owner_sell_society'] = 'Fahrzeuge [Verkauf] [Society]', + ['shop_menu'] = 'Drücke ~INPUT_CONTEXT~ um das Menü zu öffnen', + ['the_boss'] = 'boss', + ['vehicle'] = 'Fahrzeug ', + ['vehicle_dealer'] = 'Autohändler', + ['vehicle_menu'] = 'Drücke ~INPUT_CONTEXT~ um ein Fahrzeug zu übergeben', + ['vehicle_purchased'] = 'du hast ein Fahrzeug gekauft', + ['vehicle_set_owned'] = 'Vehicle ~y~%s~s~ has been assigned to ~b~%s~s~', + ['vehicle_set_rented'] = 'Vehicle ~y~%s~s~ has been rented to ~b~%s~s~', + ['vehicle_sold'] = 'Fahrzeug ~g~verkauft~s~', + ['vehicle_sold_to'] = 'Vehicle ~y~%s~s~ sold to ~b~%s~s~', + ['wash_money'] = 'Geld waschen', + ['withdraw_amount'] = 'Abhebebetrag', + ['withdraw_money'] = 'Firmengeld abheben', + ['yes'] = 'ja', } diff --git a/locales/en.lua b/locales/en.lua index 04a62063..ae5d280f 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -1,60 +1,61 @@ Locales['en'] = { --Global menus - ['belongs'] = ' now belongs to you', - ['bleach amount'] = 'amount to bleach', - ['broke_company'] = 'you do not have enough money in the company account', - ['buy'] = 'buy', - ['buy_vehicle'] = 'buy vehicle', - ['car_dealer'] = 'car Dealership', - ['create_bill'] = 'create invoice', - ['dealer_boss'] = 'car Dealer - Boss', - ['delivered'] = 'vehicle ~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', - ['remove_pv'] = 'remove a personal vehicle', - ['no'] = 'no', - ['no_players'] = 'no players nearby', - ['not_enough_money'] = 'you do not have enough money', - ['not_rental'] = 'this is not a ~r~rental vehicle~s~', - ['not_yours'] = 'this vehicle does not belong to you', - ['paid_rental'] = 'you have ~g~payed~s~ for your vehicle rental : ~g~$', - ['personal_vehicle'] = 'personal vehicle', - ['pop_vehicle'] = 'exit vehicle', - ['price'] = ' for the amount of $', - ['recruit'] = 'recruit', - ['rent_vehicle'] = 'car Dealer - Vehicles for rent', - ['rental_amount'] = 'rental amount', - ['sell_menu'] = 'press ~INPUT_CONTEXT~ to sell ', - ['set_vehicle_owner_rent'] = 'assign vehicle [Location]', - ['set_vehicle_owner_sell'] = 'vehicles for [sale]', - ['shop_menu'] = 'press ~INPUT_CONTEXT~ to access the menu', - ['the_boss'] = 'boss', - ['vehicle'] = 'vehicle ', - ['vehicle_dealer'] = 'vehicle - Car Dealer', - ['vehicle_menu'] = 'press ~INPUT_CONTEXT~ to make your vehicle', - ['vehicle_purchased'] = 'you bought a vehicle', - ['vehicle_set_owned'] = 'Vehicle ~y~%s~s~ has been assigned to ~b~%s~s~', - ['vehicle_set_rented'] = 'Vehicle ~y~%s~s~ has been rented to ~b~%s~s~', - ['vehicle_sold'] = 'vehicle ~g~sold~s~', - ['vehicle_sold_to'] = 'Vehicle ~y~%s~s~ sold to ~b~%s~s~', - ['wash_money'] = 'money laundering', - ['withdraw_amount'] = 'amount of withdrawal', - ['withdraw_money'] = 'remove company money', - ['yes'] = 'yes', - ['deposit_stock'] = 'deposit Stock', - ['take_stock'] = 'take Stock', - ['dealership_stock'] = 'dealership Stock', - ['amount'] = 'amount', - ['quantity_invalid'] = 'invalid Quantity', - ['inventoty'] = 'inventory', - ['dealership'] = 'car Dealer', - ['dealer_customers'] = 'dealer customers', - ['have_withdrawn'] = 'you have withdrawn ', - ['added'] = 'you added ', + ['belongs'] = ' now belongs to you', + ['bleach amount'] = 'amount to bleach', + ['broke_company'] = 'you do not have enough money in the company account', + ['buy'] = 'buy', + ['buy_vehicle'] = 'buy vehicle', + ['car_dealer'] = 'car Dealership', + ['create_bill'] = 'create invoice', + ['dealer_boss'] = 'car Dealer - Boss', + ['delivered'] = 'vehicle ~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', + ['leaving'] = 'leaving a personal vehicle', + ['no'] = 'no', + ['no_players'] = 'no players nearby', + ['not_enough_money'] = 'you do not have enough money', + ['not_rental'] = 'this is not a ~r~rental vehicle~s~', + ['not_yours'] = 'this vehicle does not belong to you', + ['paid_rental'] = 'you have ~g~payed~s~ for your vehicle rental : ~g~$', + ['personal_vehicle'] = 'personal vehicle', + ['pop_vehicle'] = 'exit vehicle', + ['price'] = ' for the amount of $', + ['recruit'] = 'recruit', + ['rent_vehicle'] = 'car Dealer - Vehicles for rent', + ['rental_amount'] = 'rental amount', + ['sell_menu'] = 'press ~INPUT_CONTEXT~ to sell ', + ['set_vehicle_owner_rent'] = 'assign vehicle [Location]', + ['set_vehicle_owner_sell'] = 'vehicles for [sale]', + ['set_vehicle_owner_sell_society'] = 'vehicles for [sale] [Society]', + ['shop_menu'] = 'press ~INPUT_CONTEXT~ to access the menu', + ['the_boss'] = 'boss', + ['vehicle'] = 'vehicle ', + ['vehicle_dealer'] = 'vehicle - Car Dealer', + ['vehicle_menu'] = 'press ~INPUT_CONTEXT~ to make your vehicle', + ['vehicle_purchased'] = 'you bought a vehicle', + ['vehicle_set_owned'] = 'Vehicle ~y~%s~s~ has been assigned to ~b~%s~s~', + ['vehicle_set_rented'] = 'Vehicle ~y~%s~s~ has been rented to ~b~%s~s~', + ['vehicle_sold'] = 'vehicle ~g~sold~s~', + ['vehicle_sold_to'] = 'Vehicle ~y~%s~s~ sold to ~b~%s~s~', + ['wash_money'] = 'money laundering', + ['withdraw_amount'] = 'amount of withdrawal', + ['withdraw_money'] = 'remove company money', + ['yes'] = 'yes', + ['deposit_stock'] = 'deposit Stock', + ['take_stock'] = 'take Stock', + ['dealership_stock'] = 'dealership Stock', + ['amount'] = 'amount', + ['quantity_invalid'] = 'invalid Quantity', + ['inventoty'] = 'inventory', + ['dealership'] = 'car Dealer', + ['dealer_customers'] = 'dealer customers', + ['have_withdrawn'] = 'you have withdrawn ', + ['added'] = 'you added ', } diff --git a/locales/fr.lua b/locales/fr.lua index 9a84b199..3d08be3c 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -1,60 +1,61 @@ Locales['fr'] = { --Global menus - ['belongs'] = 'vous appartient désormais', - ['bleach amount'] = 'Montant à blanchir', - ['broke_company'] = 'Vous n\'avez pas assez d\'argent sur votre compte société', - ['buy'] = 'Acheter', - ['buy_vehicle'] = 'Acheter véhicule', - ['car_dealer'] = 'Concessionnaire', - ['create_bill'] = 'Créer facture', - ['dealer_boss'] = 'Concessionnaire - Patron', - ['delivered'] = 'Véhicule ~g~rendu~s~ au concessionnaire', - ['depop_vehicle'] = 'Rentrer véhicule', - ['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', - ['remove_pv'] = 'Sortir un véhicule personnel', - ['no'] = 'Non', - ['no_players'] = 'Aucun joueur à proximité', - ['not_enough_money'] = 'Vous n\'avez pas assez d\'argent', - ['not_rental'] = 'Ce n\'est pas un ~r~véhicule de location~s~', - ['not_yours'] = 'Ce véhicule ne vous appartient pas', - ['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', - ['set_vehicle_owner_rent'] = 'Attribuer véhicule [Location]', - ['set_vehicle_owner_sell'] = 'Attribuer véhicule [Vente]', - ['shop_menu'] = 'Appuez sur ~INPUT_CONTEXT~ pour accéder au menu', - ['the_boss'] = 'Patron', - ['vehicle'] = 'Le véhicule', - ['vehicle_dealer'] = 'Concessionnaire - Véhicules', - ['vehicle_menu'] = 'Appuez sur ~INPUT_CONTEXT~ pour rendre votre véhicule', - ['vehicle_purchased'] = 'Vous avez acheté un véhicule', - ['vehicle_set_owned'] = 'Le véhicule ~y~%s~s~ a été attribué à ~b~%s~s~', - ['vehicle_set_rented'] = 'Le véhicule ~y~%s~s~ a été loué à ~b~%s~s~', - ['vehicle_sold'] = 'Véhicule ~g~vendu~s~', - ['vehicle_sold_to'] = 'Véhicule ~y~%s~s~ vendu à ~b~%s~s~', - ['wash_money'] = 'Blanchir argent', - ['withdraw_amount'] = 'Montant du retrait', - ['withdraw_money'] = 'Retirer argent société', - ['yes'] = 'Oui', - ['deposit_stock'] = 'déposer Stock', - ['take_stock'] = 'prendre Stock', - ['dealership_stock'] = 'concession Stock', - ['amount'] = 'quantité', - ['quantity_invalid'] = 'quantité invalide', - ['inventory'] = 'inventaire', - ['dealership'] = 'concession', - ['dealer_customers'] = 'client concession', - ['have_withdrawn'] = 'Vous avez retiré ', - ['added'] = 'vous avez ajouté ', + ['belongs'] = 'Vous appartient désormais', + ['bleach amount'] = 'Montant à blanchir', + ['broke_company'] = 'Vous n\'avez pas assez d\'argent sur votre compte société', + ['buy'] = 'Acheter', + ['buy_vehicle'] = 'Acheter véhicule', + ['car_dealer'] = 'Concessionnaire', + ['create_bill'] = 'Créer facture', + ['dealer_boss'] = 'Concessionnaire - Patron', + ['delivered'] = 'Véhicule ~g~rendu~s~ au concessionnaire', + ['depop_vehicle'] = 'Rentrer véhicule', + ['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', + ['leaving'] = 'Sortir un véhicule personnel', + ['no'] = 'Non', + ['no_players'] = 'Aucun joueur à proximité', + ['not_enough_money'] = 'Vous n\'avez pas assez d\'argent', + ['not_rental'] = 'Ce n\'est pas un ~r~véhicule de location~s~', + ['not_yours'] = 'Ce véhicule ne vous appartient pas', + ['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', + ['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é]', + ['shop_menu'] = 'Appuez sur ~INPUT_CONTEXT~ pour accéder au menu', + ['the_boss'] = 'Patron', + ['vehicle'] = 'Le véhicule', + ['vehicle_dealer'] = 'Concessionnaire - Véhicules', + ['vehicle_menu'] = 'Appuez sur ~INPUT_CONTEXT~ pour rendre votre véhicule', + ['vehicle_purchased'] = 'Vous avez acheté un véhicule', + ['vehicle_set_owned'] = 'Le véhicule ~y~%s~s~ a été attribué à ~b~%s~s~', + ['vehicle_set_rented'] = 'Le véhicule ~y~%s~s~ a été loué à ~b~%s~s~', + ['vehicle_sold'] = 'Véhicule ~g~vendu~s~', + ['vehicle_sold_to'] = 'Véhicule ~y~%s~s~ vendu à ~b~%s~s~', + ['wash_money'] = 'Blanchir argent', + ['withdraw_amount'] = 'Montant du retrait', + ['withdraw_money'] = 'Retirer argent société', + ['yes'] = 'Oui', + ['deposit_stock'] = 'déposer Stock', + ['take_stock'] = 'prendre Stock', + ['dealership_stock'] = 'concession Stock', + ['amount'] = 'quantité', + ['quantity_invalid'] = 'quantité invalide', + ['inventory'] = 'inventaire', + ['dealership'] = 'concession', + ['dealer_customers'] = 'client concession', + ['have_withdrawn'] = 'Vous avez retiré ', + ['added'] = 'vous avez ajouté ', } diff --git a/server/main.lua b/server/main.lua index c3c6e344..b1a10627 100644 --- a/server/main.lua +++ b/server/main.lua @@ -87,7 +87,26 @@ AddEventHandler('esx_vehicleshop:setVehicleOwnedPlayerId', function(playerId, ve ['@owner'] = xPlayer.identifier }, function(rowsChanged) - TriggerClientEvent('esx:showNotification', playerId, _U('vehicle').. vehicleProps.plate .. _('belongs')) + TriggerClientEvent('esx:showNotification', playerId, _U('vehicle') .. vehicleProps.plate .. _('belongs')) + end + ) + +end) + +RegisterServerEvent('esx_vehicleshop:setVehicleOwnedSociety') +AddEventHandler('esx_vehicleshop:setVehicleOwnedSociety', function(society, vehicleProps) + + local _source = source + local xPlayer = ESX.GetPlayerFromId(source) + + MySQL.Async.execute( + 'INSERT INTO owned_vehicles (vehicle, owner) VALUES (@vehicle, @owner)', + { + ['@vehicle'] = json.encode(vehicleProps), + ['@owner'] = 'society:' .. society + }, + function(rowsChanged) + end ) @@ -176,10 +195,10 @@ AddEventHandler('esx_vehicleshop:getStockItem', function(itemName, count) inventory.removeItem(itemName, count) xPlayer.addInventoryItem(itemName, count) else - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('quantity_invalid')) + TriggerClientEvent('esx:showNotification', xPlayer.source, 'Quantité invalide') end - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('have_withdrawn') .. 'x' .. count .. ' ' .. item.label) + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('have_withdrawn') .. ' x' .. count .. ' ' .. item.label) end) @@ -198,10 +217,10 @@ AddEventHandler('esx_vehicleshop:putStockItems', function(itemName, count) xPlayer.removeInventoryItem(itemName, count) inventory.addItem(itemName, count) else - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('quantity_invalid')) + TriggerClientEvent('esx:showNotification', xPlayer.source, 'Quantité invalide') end - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('added') .. 'x' .. count .. ' ' .. item.label) + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('added') .. ' x' .. count .. ' ' .. item.label) end) @@ -236,7 +255,7 @@ ESX.RegisterServerCallback('esx_vehicleshop:buyVehicle', function(source, cb, ve end) -ESX.RegisterServerCallback('esx_vehicleshop:buyVehicleSociety', function(source, cb, vehicleModel) +ESX.RegisterServerCallback('esx_vehicleshop:buyVehicleSociety', function(source, cb, society, vehicleModel) local vehicleData = nil @@ -247,7 +266,7 @@ ESX.RegisterServerCallback('esx_vehicleshop:buyVehicleSociety', function(source, end end - TriggerEvent('esx_addonaccount:getSharedAccount', 'society_cardealer', function(account) + TriggerEvent('esx_addonaccount:getSharedAccount', 'society_' .. society, function(account) if account.money >= vehicleData.price then @@ -429,7 +448,47 @@ ESX.RegisterServerCallback('esx_vehicleshop:resellVehicle', function(source, cb, cb(true) else - cb(false) + + if xPlayer.job.grade_name == 'boss' then + + MySQL.Async.fetchAll( + 'SELECT * FROM owned_vehicles WHERE owner = @owner', + { + ['@owner'] = 'society:' .. xPlayer.job.name + }, + function(result) + + local found = false + + for i=1, #result, 1 do + + local vehicleProps = json.decode(result[i].vehicle) + + if vehicleProps.plate == plate then + found = true + break + end + + end + + if found then + + xPlayer.addMoney(price) + RemoveOwnedVehicle(plate) + + cb(true) + + else + cb(false) + end + + end + ) + + else + cb(false) + end + end end @@ -465,7 +524,7 @@ if Config.EnablePvCommand then TriggerEvent('es:addCommand', 'pv', function(source, args, user) TriggerClientEvent('esx_vehicleshop:openPersonnalVehicleMenu', source) - end, {help = _U('remove_pv')}) + end, {help = _U('leaving')}) end