mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 10:18:54 +00:00
Fixed confiscating weapons, and locales for ammo count
This commit is contained in:
+57
-58
@@ -716,78 +716,77 @@ end
|
||||
|
||||
function OpenBodySearchMenu(player)
|
||||
|
||||
ESX.TriggerServerCallback('esx_policejob:getOtherPlayerData', function(data)
|
||||
ESX.TriggerServerCallback('esx_policejob:getOtherPlayerData', function(data)
|
||||
|
||||
local elements = {}
|
||||
local elements = {}
|
||||
|
||||
local blackMoney = 0
|
||||
local blackMoney = 0
|
||||
|
||||
for i=1, #data.accounts, 1 do
|
||||
if data.accounts[i].name == 'black_money' then
|
||||
blackMoney = data.accounts[i].money
|
||||
end
|
||||
end
|
||||
for i=1, #data.accounts, 1 do
|
||||
if data.accounts[i].money > 0 then
|
||||
if data.accounts[i].name == 'black_money' then
|
||||
blackMoney = data.accounts[i].money
|
||||
|
||||
table.insert(elements, {
|
||||
label = _U('confiscate_dirty', blackMoney),
|
||||
value = 'black_money',
|
||||
itemType = 'item_account',
|
||||
amount = blackMoney
|
||||
})
|
||||
table.insert(elements, {
|
||||
label = _U('confiscate_dirty', ESX.Round(blackMoney)),
|
||||
value = 'black_money',
|
||||
itemType = 'item_account',
|
||||
amount = blackMoney
|
||||
})
|
||||
|
||||
table.insert(elements, {label = _U('guns_label'), value = nil})
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
for i=1, #data.weapons, 1 do
|
||||
table.insert(elements, {
|
||||
label = _U('confiscate', ESX.GetWeaponLabel(data.weapons[i].name)),
|
||||
value = data.weapons[i].name,
|
||||
itemType = 'item_weapon',
|
||||
amount = data.ammo
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(elements, {label = _U('inventory_label'), value = nil})
|
||||
table.insert(elements, {label = _U('guns_label'), value = nil})
|
||||
|
||||
for i=1, #data.inventory, 1 do
|
||||
if data.inventory[i].count > 0 then
|
||||
table.insert(elements, {
|
||||
label = _U('confiscate_inv', data.inventory[i].count, data.inventory[i].label),
|
||||
value = data.inventory[i].name,
|
||||
itemType = 'item_standard',
|
||||
amount = data.inventory[i].count
|
||||
})
|
||||
end
|
||||
end
|
||||
for i=1, #data.weapons, 1 do
|
||||
table.insert(elements, {
|
||||
label = _U('confiscate_weapon', ESX.GetWeaponLabel(data.weapons[i].name), data.weapons[i].ammo),
|
||||
value = data.weapons[i].name,
|
||||
itemType = 'item_weapon',
|
||||
amount = data.weapons[i].ammo
|
||||
})
|
||||
end
|
||||
|
||||
table.insert(elements, {label = _U('inventory_label'), value = nil})
|
||||
|
||||
for i=1, #data.inventory, 1 do
|
||||
if data.inventory[i].count > 0 then
|
||||
table.insert(elements, {
|
||||
label = _U('confiscate_inv', data.inventory[i].count, data.inventory[i].label),
|
||||
value = data.inventory[i].name,
|
||||
itemType = 'item_standard',
|
||||
amount = data.inventory[i].count
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
ESX.UI.Menu.Open(
|
||||
'default', GetCurrentResourceName(), 'body_search',
|
||||
{
|
||||
title = _U('search'),
|
||||
align = 'top-left',
|
||||
elements = elements,
|
||||
},
|
||||
function(data, menu)
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'body_search',
|
||||
{
|
||||
title = _U('search'),
|
||||
align = 'top-left',
|
||||
elements = elements,
|
||||
},
|
||||
function(data, menu)
|
||||
|
||||
local itemType = data.current.itemType
|
||||
local itemName = data.current.value
|
||||
local amount = data.current.amount
|
||||
local itemType = data.current.itemType
|
||||
local itemName = data.current.value
|
||||
local amount = data.current.amount
|
||||
|
||||
if data.current.value ~= nil then
|
||||
if data.current.value ~= nil then
|
||||
TriggerServerEvent('esx_policejob:confiscatePlayerItem', GetPlayerServerId(player), itemType, itemName, amount)
|
||||
OpenBodySearchMenu(player)
|
||||
end
|
||||
|
||||
TriggerServerEvent('esx_policejob:confiscatePlayerItem', GetPlayerServerId(player), itemType, itemName, amount)
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
end)
|
||||
|
||||
OpenBodySearchMenu(player)
|
||||
|
||||
end
|
||||
|
||||
end,
|
||||
function(data, menu)
|
||||
menu.close()
|
||||
end
|
||||
)
|
||||
|
||||
end, GetPlayerServerId(player))
|
||||
end, GetPlayerServerId(player))
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ Locales['br'] = {
|
||||
['inventory_label'] = '--- Inventário ---',
|
||||
['license_label'] = ' --- Licenses ---',
|
||||
['confiscate'] = 'confiscar %s',
|
||||
['confiscate_weapon'] = 'confiscate %s with %s bullets',
|
||||
['confiscate_inv'] = 'Confiscar %sx %s',
|
||||
['confiscate_dirty'] = 'Confiscar dinheiro sujo: <span style="color:red;">$%s</span>',
|
||||
['you_confiscated'] = 'you confiscated ~y~%sx~s~ ~b~%s~s~ from ~b~%s~s~',
|
||||
|
||||
@@ -79,6 +79,7 @@ Locales['de'] = {
|
||||
['inventory_label'] = '--- Inventar ---',
|
||||
['license_label'] = ' --- Licenses ---',
|
||||
['confiscate'] = 'konfeszieren %s',
|
||||
['confiscate_weapon'] = 'confiscate %s with %s bullets',
|
||||
['confiscate_inv'] = 'konfeziere %sx %s',
|
||||
['confiscate_dirty'] = 'schwarzgeld konfesziert: <span style="color:red;">$%s</span>',
|
||||
['you_confiscated'] = 'you confiscated ~y~%sx~s~ ~b~%s~s~ from ~b~%s~s~',
|
||||
|
||||
@@ -79,6 +79,7 @@ Locales['en'] = {
|
||||
['inventory_label'] = '--- Inventory ---',
|
||||
['license_label'] = ' --- Licenses ---',
|
||||
['confiscate'] = 'confiscate %s',
|
||||
['confiscate_weapon'] = 'confiscate %s with %s bullets',
|
||||
['confiscate_inv'] = 'confiscate %sx %s',
|
||||
['confiscate_dirty'] = 'confiscate dirty money: <span style="color:red;">$%s</span>',
|
||||
['you_confiscated'] = 'you confiscated ~y~%sx~s~ ~b~%s~s~ from ~b~%s~s~',
|
||||
|
||||
@@ -79,6 +79,7 @@ Locales['es'] = {
|
||||
['inventory_label'] = '--- Inventario ---',
|
||||
['license_label'] = ' --- Licenses ---',
|
||||
['confiscate'] = 'confiscar %s',
|
||||
['confiscate_weapon'] = 'confiscate %s with %s bullets',
|
||||
['confiscate_inv'] = 'confiscar %sx %s',
|
||||
['confiscate_dirty'] = 'confiscar dinero negro: <span style="color:red;">€%s</span>',
|
||||
['you_confiscated'] = 'you confiscated ~y~%sx~s~ ~b~%s~s~ from ~b~%s~s~',
|
||||
|
||||
@@ -79,6 +79,7 @@ Locales['fi'] = {
|
||||
['inventory_label'] = '--- Reppu ---',
|
||||
['license_label'] = ' --- Lisenssit ---',
|
||||
['confiscate'] = 'takavarikoi %s',
|
||||
['confiscate_weapon'] = 'confiscate %s with %s bullets',
|
||||
['confiscate_inv'] = 'takavarikoi %sx %s',
|
||||
['confiscate_dirty'] = 'takavarikoi likainen raha: <span style="color:red;">€%s</span>',
|
||||
['you_confiscated'] = 'you confiscated ~y~%sx~s~ ~b~%s~s~ from ~b~%s~s~',
|
||||
|
||||
@@ -79,6 +79,7 @@ Locales['fr'] = {
|
||||
['inventory_label'] = '--- Inventaire ---',
|
||||
['license_label'] = ' --- Licenses ---',
|
||||
['confiscate'] = 'confisquer %s',
|
||||
['confiscate_weapon'] = 'confiscate %s with %s bullets',
|
||||
['confiscate_inv'] = 'confisquer %sx %s',
|
||||
['confiscate_dirty'] = 'confisquer argent sale: <span style="color:red;">€%s</span>',
|
||||
['you_confiscated'] = 'you confiscated ~y~%sx~s~ ~b~%s~s~ from ~b~%s~s~',
|
||||
|
||||
@@ -79,6 +79,7 @@ Locales['pl'] = {
|
||||
['inventory_label'] = '--- Ekwipunek ---',
|
||||
['license_label'] = ' --- Licenses ---',
|
||||
['confiscate'] = 'skonfiskuj %s',
|
||||
['confiscate_weapon'] = 'confiscate %s with %s bullets',
|
||||
['confiscate_inv'] = 'skonfiskuj %sx %s',
|
||||
['confiscate_dirty'] = 'skonfiskuj brudne pieniądze: <span style="color:red;">$%s</span>',
|
||||
['you_confiscated'] = 'you confiscated ~y~%sx~s~ ~b~%s~s~ from ~b~%s~s~',
|
||||
|
||||
+21
-20
@@ -10,12 +10,12 @@ Locales['sv'] = {
|
||||
['no_outfit'] = 'det finns ingen uniform som passar dig!',
|
||||
['open_cloackroom'] = 'tryck ~INPUT_CONTEXT~ för att välja ~y~kläder~s~.',
|
||||
-- Armory
|
||||
['remove_object'] = 'Ta ut objekt',
|
||||
['deposit_object'] = 'Lägg in objekt',
|
||||
['get_weapon'] = 'Ta ut vapen',
|
||||
['put_weapon'] = 'Lägg in vapen',
|
||||
['buy_weapons'] = 'Köp in vapen',
|
||||
['armory'] = 'Vapenförråd',
|
||||
['remove_object'] = 'ta ut objekt',
|
||||
['deposit_object'] = 'lägg in objekt',
|
||||
['get_weapon'] = 'ta ut vapen',
|
||||
['put_weapon'] = 'lägg in vapen',
|
||||
['buy_weapons'] = 'köp in vapen',
|
||||
['armory'] = 'vapenförråd',
|
||||
['open_armory'] = 'tryck ~INPUT_CONTEXT~ för att komma åt förrådet',
|
||||
-- Vehicles
|
||||
['vehicle_menu'] = 'Bilar',
|
||||
@@ -57,9 +57,9 @@ Locales['sv'] = {
|
||||
['search_database_found'] = 'detta fordon är ~y~registrerat~s~ till ~b~%s~s~',
|
||||
-- Traffic interaction
|
||||
['traffic_interaction'] = 'trafiksåtgärder',
|
||||
['cone'] = 'Kon',
|
||||
['barrier'] = 'Barriär',
|
||||
['spikestrips'] = 'Spikmatta',
|
||||
['cone'] = 'kon',
|
||||
['barrier'] = 'barriär',
|
||||
['spikestrips'] = 'spikmatta',
|
||||
['box'] = 'låda',
|
||||
['cash'] = 'låda med pengar',
|
||||
-- ID Card Menu
|
||||
@@ -78,6 +78,7 @@ Locales['sv'] = {
|
||||
['inventory_label'] = '--- Inventory ---',
|
||||
['license_label'] = ' --- Licenser ---',
|
||||
['confiscate'] = 'beslagta %s',
|
||||
['confiscate_weapon'] = 'beslagta %s med %s skott',
|
||||
['confiscate_inv'] = 'beslagta %sx %s',
|
||||
['confiscate_dirty'] = 'beslagta svarta pengar: <span style="color:red;">$%s</span>',
|
||||
['you_confiscated'] = 'du beslagtog ~y~%sx~s~ ~b~%s~s~ från ~b~%s~s~',
|
||||
@@ -96,18 +97,18 @@ Locales['sv'] = {
|
||||
['owner_unknown'] = 'ägare: Okänt',
|
||||
['owner'] = 'ägare: %s',
|
||||
-- Weapons Menus
|
||||
['get_weapon_menu'] = 'Vapenförråd - Ta vapen',
|
||||
['put_weapon_menu'] = 'Vapenförråd - Lägg in vapen',
|
||||
['buy_weapon_menu'] = 'Vapenförråd - Köp in vapen',
|
||||
['not_enough_money'] = 'Du har inte tillräckligt mycket pengar',
|
||||
['get_weapon_menu'] = 'vapenförråd - Ta vapen',
|
||||
['put_weapon_menu'] = 'vapenförråd - Lägg in vapen',
|
||||
['buy_weapon_menu'] = 'vapenförråd - Köp in vapen',
|
||||
['not_enough_money'] = 'du har inte tillräckligt mycket pengar',
|
||||
-- Boss Menu
|
||||
['take_company_money'] = 'Ta ut företagspengar',
|
||||
['deposit_money'] = 'Lägg in pengar till företaget',
|
||||
['amount_of_withdrawal'] = 'Belopp att ta ut',
|
||||
['invalid_amount'] = 'Otillgängligt belopp',
|
||||
['amount_of_deposit'] = 'Belopp att lägga in',
|
||||
['open_bossmenu'] = 'Tryck ~INPUT_CONTEXT~ för att öppna menyn',
|
||||
['quantity_invalid'] = 'Otillgängligt antal',
|
||||
['take_company_money'] = 'ta ut företagspengar',
|
||||
['deposit_money'] = 'lägg in pengar till företaget',
|
||||
['amount_of_withdrawal'] = 'belopp att ta ut',
|
||||
['invalid_amount'] = 'otillgängligt belopp',
|
||||
['amount_of_deposit'] = 'belopp att lägga in',
|
||||
['open_bossmenu'] = 'tryck ~INPUT_CONTEXT~ för att öppna menyn',
|
||||
['quantity_invalid'] = 'otillgängligt antal',
|
||||
['have_withdraw'] = 'Du har tagit ut x',
|
||||
['added'] = 'Du la in x',
|
||||
['quantity'] = 'Antal',
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ AddEventHandler('esx_policejob:confiscatePlayerItem', function(target, itemType,
|
||||
|
||||
-- can the player carry the said amount of x item?
|
||||
if sourceItem.limit ~= -1 and (sourceItem.count + amount) > sourceItem.limit then
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('invalid_quantity'))
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('quantity_invalid'))
|
||||
else
|
||||
targetXPlayer.removeInventoryItem(itemName, amount)
|
||||
sourceXPlayer.addInventoryItem (itemName, amount)
|
||||
@@ -38,7 +38,7 @@ AddEventHandler('esx_policejob:confiscatePlayerItem', function(target, itemType,
|
||||
TriggerClientEvent('esx:showNotification', target, _U('got_confiscated', amount, sourceItem.label, sourceXPlayer.name))
|
||||
end
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('invalid_quantity'))
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('quantity_invalid'))
|
||||
end
|
||||
|
||||
elseif itemType == 'item_account' then
|
||||
|
||||
Reference in New Issue
Block a user