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:
ElPumpo
2018-04-10 21:28:15 +02:00
parent 78265594d2
commit f6b01ed968
7 changed files with 74 additions and 76 deletions
+16 -22
View File
@@ -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')