diff --git a/client/main.lua b/client/main.lua index 850d24d0..ae6e2956 100644 --- a/client/main.lua +++ b/client/main.lua @@ -686,172 +686,157 @@ end function OpenRoomInventoryMenu(property, owner) - ESX.TriggerServerCallback('esx_property:getPropertyInventory', function(inventory) + ESX.TriggerServerCallback('esx_property:getPropertyInventory', function(inventory) - local elements = {} + local elements = {} - table.insert(elements, {label = _U('dirty_money') .. inventory.blackMoney, type = 'item_account', value = 'black_money'}) + if inventory.blackMoney > 0 then + table.insert(elements, {label = _U('dirty_money', inventory.blackMoney), type = 'item_account', value = 'black_money'}) + end - for i=1, #inventory.items, 1 do + for i=1, #inventory.items, 1 do + local item = inventory.items[i] - local item = inventory.items[i] + if item.count > 0 then + table.insert(elements, {label = item.label .. ' x' .. item.count, type = 'item_standard', value = item.name}) + end + end - if item.count > 0 then - table.insert(elements, {label = item.label .. ' x' .. item.count, type = 'item_standard', value = item.name}) - end + for i=1, #inventory.weapons, 1 do + local weapon = inventory.weapons[i] + table.insert(elements, {label = ESX.GetWeaponLabel(weapon.name) .. ' [' .. weapon.ammo .. ']', type = 'item_weapon', value = weapon.name, ammo = weapon.ammo}) + end - end + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'room_inventory', + { + title = property.label .. ' - ' .. _U('inventory'), + align = 'top-left', + elements = elements, + }, function(data, menu) - for i=1, #inventory.weapons, 1 do - local weapon = inventory.weapons[i] - table.insert(elements, {label = ESX.GetWeaponLabel(weapon.name) .. ' [' .. weapon.ammo .. ']', type = 'item_weapon', value = weapon.name, ammo = weapon.ammo}) - end + if data.current.type == 'item_weapon' then - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'room_inventory', - { - title = property.label .. ' - ' .. _U('inventory'), - align = 'top-left', - elements = elements, - }, - function(data, menu) + menu.close() - if data.current.type == 'item_weapon' then + TriggerServerEvent('esx_property:getItem', owner, data.current.type, data.current.value, data.current.ammo) - menu.close() + ESX.SetTimeout(300, function() + OpenRoomInventoryMenu(property, owner) + end) - TriggerServerEvent('esx_property:getItem', owner, data.current.type, data.current.value, data.current.ammo) + else - ESX.SetTimeout(300, function() - OpenRoomInventoryMenu(property, owner) - end) + ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'get_item_count', + { + title = _U('amount'), + }, function(data2, menu) - else + local quantity = tonumber(data2.value) - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'get_item_count', - { - title = _U('amount'), - }, - function(data2, menu) + if quantity == nil then + ESX.ShowNotification(_U('amount_invalid')) + else - local quantity = tonumber(data2.value) + menu.close() - if quantity == nil then - ESX.ShowNotification(_U('amount_invalid')) - else + TriggerServerEvent('esx_property:getItem', owner, data.current.type, data.current.value, quantity) - menu.close() + ESX.SetTimeout(300, function() + OpenRoomInventoryMenu(property, owner) + end) - TriggerServerEvent('esx_property:getItem', owner, data.current.type, data.current.value, quantity) + end - ESX.SetTimeout(300, function() - OpenRoomInventoryMenu(property, owner) - end) + end, function(data2,menu) + menu.close() + end) - end + end - end, - function(data2,menu) - menu.close() - end - ) + end, function(data, menu) + menu.close() + end) - end - - end, - function(data, menu) - menu.close() - end - ) - - end, owner) + end, owner) end function OpenPlayerInventoryMenu(property, owner) - ESX.TriggerServerCallback('esx_property:getPlayerInventory', function(inventory) + ESX.TriggerServerCallback('esx_property:getPlayerInventory', function(inventory) - local elements = {} + local elements = {} - table.insert(elements, {label = _U('dirty_money') .. inventory.blackMoney, type = 'item_account', value = 'black_money'}) + if inventory.blackMoney > 0 then + table.insert(elements, {label = _U('dirty_money', inventory.blackMoney), type = 'item_account', value = 'black_money'}) + end - for i=1, #inventory.items, 1 do + for i=1, #inventory.items, 1 do + local item = inventory.items[i] + if item.count > 0 then + table.insert(elements, {label = item.label .. ' x' .. item.count, type = 'item_standard', value = item.name}) + end + end - local item = inventory.items[i] + local playerPed = GetPlayerPed(-1) + local weaponList = ESX.GetWeaponList() - if item.count > 0 then - table.insert(elements, {label = item.label .. ' x' .. item.count, type = 'item_standard', value = item.name}) - end + for i=1, #weaponList, 1 do + local weaponHash = GetHashKey(weaponList[i].name) + if HasPedGotWeapon(playerPed, weaponHash, false) and weaponList[i].name ~= 'WEAPON_UNARMED' then + local ammo = GetAmmoInPedWeapon(playerPed, weaponHash) + table.insert(elements, {label = weaponList[i].label .. ' [' .. ammo .. ']', type = 'item_weapon', value = weaponList[i].name, ammo = ammo}) + end + end - end + ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'player_inventory', + { + title = property.label .. ' - ' .. _U('inventory'), + align = 'top-left', + elements = elements, + }, function(data, menu) - local playerPed = GetPlayerPed(-1) - local weaponList = ESX.GetWeaponList() + if data.current.type == 'item_weapon' then - for i=1, #weaponList, 1 do + menu.close() - local weaponHash = GetHashKey(weaponList[i].name) + TriggerServerEvent('esx_property:putItem', owner, data.current.type, data.current.value, data.current.ammo) - if HasPedGotWeapon(playerPed, weaponHash, false) and weaponList[i].name ~= 'WEAPON_UNARMED' then - local ammo = GetAmmoInPedWeapon(playerPed, weaponHash) - table.insert(elements, {label = weaponList[i].label .. ' [' .. ammo .. ']', type = 'item_weapon', value = weaponList[i].name, ammo = ammo}) - end + ESX.SetTimeout(300, function() + OpenPlayerInventoryMenu(property, owner) + end) - end + else - ESX.UI.Menu.Open( - 'default', GetCurrentResourceName(), 'player_inventory', - { - title = property.label .. ' - ' .. _U('inventory'), - align = 'top-left', - elements = elements, - }, - function(data, menu) + ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'put_item_count', { + title = _U('amount'), + }, function(data2, menu2) - if data.current.type == 'item_weapon' then + local quantity = tonumber(data2.value) - menu.close() + if quantity == nil then + ESX.ShowNotification(_U('amount_invalid')) + else - TriggerServerEvent('esx_property:putItem', owner, data.current.type, data.current.value, data.current.ammo) + menu2.close() - ESX.SetTimeout(300, function() - OpenPlayerInventoryMenu(property, owner) - end) + TriggerServerEvent('esx_property:putItem', owner, data.current.type, data.current.value, tonumber(data2.value)) + ESX.SetTimeout(300, function() + OpenPlayerInventoryMenu(property, owner) + end) + end - else + end, function(data2, menu2) + menu2.close() + end) - ESX.UI.Menu.Open( - 'dialog', GetCurrentResourceName(), 'put_item_count', - { - title = _U('amount'), - }, - function(data2, menu) + end - menu.close() + end, function(data, menu) + menu.close() + end) - TriggerServerEvent('esx_property:putItem', owner, data.current.type, data.current.value, tonumber(data2.value)) - - ESX.SetTimeout(300, function() - OpenPlayerInventoryMenu(property, owner) - end) - - end, - function(data2,menu) - menu.close() - end - ) - - end - - end, - function(data, menu) - menu.close() - end - ) - - end) + end) end @@ -1094,21 +1079,15 @@ Citizen.CreateThread(function() if CurrentAction == 'property_menu' then OpenPropertyMenu(CurrentActionData.property) - end - - if CurrentAction == 'gateway_menu' then + elseif CurrentAction == 'gateway_menu' then if Config.EnablePlayerManagement then OpenGatewayOwnedPropertiesMenu(CurrentActionData.property) else OpenGatewayMenu(CurrentActionData.property) end - end - - if CurrentAction == 'room_menu' then + elseif CurrentAction == 'room_menu' then OpenRoomMenu(CurrentActionData.property, CurrentActionData.owner) - end - - if CurrentAction == 'room_exit' then + elseif CurrentAction == 'room_exit' then TriggerEvent('instance:leave') end diff --git a/locales/br.lua b/locales/br.lua index f922826f..152bdacb 100644 --- a/locales/br.lua +++ b/locales/br.lua @@ -19,13 +19,13 @@ Locales['br'] = { ['remove_object'] = 'Remover objeto', ['deposit_object'] = 'Depositar objeto', ['invite'] = 'Convidar', - ['dirty_money'] = 'Dinheiro sujo $', + ['dirty_money'] = 'Dinheiro sujo: $%s', ['inventory'] = 'Inventário', ['amount'] = 'valor?', ['amount_invalid'] = 'quantidade inválida', ['press_to_exit'] = 'Pressione ~INPUT_CONTEXT~ para sair da propriedade', - ['rented_for'] = 'Você alugou uma propriedade por $', - ['purchased_for'] = 'Você comprou uma propriedade por $', + ['rented_for'] = 'Você alugou uma propriedade por ~g~$%s~s~', + ['purchased_for'] = 'Você comprou uma propriedade por ~g~$%s~s~', ['made_property'] = 'Você criou uma propriedade', ['not_enough'] = 'Você não tem dinheiro suficiente', ['invalid_quantity'] = 'Quantidade inválida', diff --git a/locales/de.lua b/locales/de.lua index f82f0567..cd4f3cb5 100644 --- a/locales/de.lua +++ b/locales/de.lua @@ -19,13 +19,13 @@ Locales['de'] = { ['remove_object'] = 'Objekt nehmen', ['deposit_object'] = 'Objekt deponieren', ['invite'] = 'Einladen', - ['dirty_money'] = 'Schwarzgeld $', + ['dirty_money'] = 'Schwarzgeld: $%s', ['inventory'] = 'Inventar', ['amount'] = 'Anzahlt?', ['amount_invalid'] = 'Ungültiger Wert', ['press_to_exit'] = 'Drücke ~INPUT_CONTEXT~ um die Immobilie zu verlassen', - ['rented_for'] = 'Du hast eine Immobilie gemietet $', - ['purchased_for'] = 'Du hast eine Immobilie gekauft $', + ['rented_for'] = 'Du hast eine Immobilie gemietet ~g~$%s~s~', + ['purchased_for'] = 'Du hast eine Immobilie gekauft ~g~$%s~s~', ['made_property'] = 'Du hast eine Immobilie gemacht', ['not_enough'] = 'du hast nicht genug Geld', ['invalid_quantity'] = 'Ungültiger Betrag', diff --git a/locales/en.lua b/locales/en.lua index 4ddf1a61..2fc5ce23 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -19,13 +19,13 @@ Locales['en'] = { ['remove_object'] = 'remove object', ['deposit_object'] = 'deposit object', ['invite'] = 'invite', - ['dirty_money'] = 'dirty money $', + ['dirty_money'] = 'dirty money: $%s', ['inventory'] = 'inventory', ['amount'] = 'amount?', ['amount_invalid'] = 'invalid amount', ['press_to_exit'] = 'press ~INPUT_CONTEXT~ to exit the property', - ['rented_for'] = 'you rented a property for $', - ['purchased_for'] = 'you purchased a property for $', + ['rented_for'] = 'you rented a property for ~g~$%s~s~', + ['purchased_for'] = 'you purchased a property for ~g~$%s~s~', ['made_property'] = 'you have made a property', ['not_enough'] = 'you do not have enough money', ['invalid_quantity'] = 'invalid quantity', diff --git a/locales/es.lua b/locales/es.lua index b1fb8d07..c2477884 100644 --- a/locales/es.lua +++ b/locales/es.lua @@ -19,13 +19,13 @@ Locales['es'] = { ['remove_object'] = 'Retirar objeto', ['deposit_object'] = 'Depositar objeto', ['invite'] = 'Invitar', - ['dirty_money'] = 'Dinero sucio €', + ['dirty_money'] = 'Dinero sucio: €%s', ['inventory'] = 'Inventario', ['amount'] = '¿Cantidad?', ['amount_invalid'] = 'Cantidad inválida', ['press_to_exit'] = 'Presione ~INPUT_CONTEXT~ para salir de la propiedad', - ['rented_for'] = 'Has alquilado una propiedad por €', - ['purchased_for'] = 'Has comprado una propiedad por €', + ['rented_for'] = 'Has alquilado una propiedad por ~g~€%s~s~', + ['purchased_for'] = 'Has comprado una propiedad por ~g~€%s~s~', ['made_property'] = 'Ha hecho una propiedad', ['not_enough'] = 'n\'No tiene suficiente d\'dinero', ['invalid_quantity'] = 'Cantidad inválida', diff --git a/locales/fi.lua b/locales/fi.lua index 65e2edf3..fd958a43 100644 --- a/locales/fi.lua +++ b/locales/fi.lua @@ -19,13 +19,13 @@ Locales['fi'] = { ['remove_object'] = 'poista esine', ['deposit_object'] = 'talleta esine', ['invite'] = 'kutsu', - ['dirty_money'] = 'likainen raha $', + ['dirty_money'] = 'likainen raha: $%s', ['inventory'] = 'reppu', ['amount'] = 'määrä?', ['amount_invalid'] = 'virheellinen määrä', ['press_to_exit'] = 'paina ~INPUT_CONTEXT~ poistuaksesi kiinteistöstä', - ['rented_for'] = 'sinä vuokrasit kiinteistön hintaan $', - ['purchased_for'] = 'sinä ostit kiinteistön hintaan $', + ['rented_for'] = 'sinä vuokrasit kiinteistön hintaan ~g~$%s~s~', + ['purchased_for'] = 'sinä ostit kiinteistön hintaan ~g~$%s~s~', ['made_property'] = 'sinä teit kiinteistön', ['not_enough'] = 'sinulla ei ole tarpeeksi rahaa', ['invalid_quantity'] = 'virheellinen määrä', diff --git a/locales/fr.lua b/locales/fr.lua index 61d06b82..4aa55cf7 100644 --- a/locales/fr.lua +++ b/locales/fr.lua @@ -19,13 +19,13 @@ Locales['fr'] = { ['remove_object'] = 'retirer objet', ['deposit_object'] = 'déposer objet', ['invite'] = 'inviter', - ['dirty_money'] = 'argent sale $', + ['dirty_money'] = 'argent sale: $%s', ['inventory'] = 'inventaire', ['amount'] = 'quantité ?', ['amount_invalid'] = 'montant invalide', ['press_to_exit'] = 'appuyez sur ~INPUT_CONTEXT~ pour sortir de la propriété', - ['rented_for'] = 'vous avez loué une propriété pour $', - ['purchased_for'] = 'vous avez acheté une propriété pour $', + ['rented_for'] = 'vous avez loué une propriété pour ~g~$%s~s~', + ['purchased_for'] = 'vous avez acheté une propriété pour ~g~$%s~s~', ['made_property'] = 'vous avez rendu une propriété', ['not_enough'] = 'vous n\'avez pas assez d\'argent', ['invalid_quantity'] = 'quantité invalide', diff --git a/locales/pl.lua b/locales/pl.lua index e79f2ba2..0c6fe04d 100644 --- a/locales/pl.lua +++ b/locales/pl.lua @@ -19,13 +19,13 @@ Locales['pl'] = { ['remove_object'] = 'usuń objekt', ['deposit_object'] = 'deponuj objekt', ['invite'] = 'zaproś', - ['dirty_money'] = 'brudne pieniądze $', + ['dirty_money'] = 'brudne pieniądze: $%s', ['inventory'] = 'ekwipunek', ['amount'] = 'suma?', ['amount_invalid'] = 'nieprawidłowa suma', ['press_to_exit'] = 'wciśnij ~INPUT_CONTEXT~ aby wyjść z mieszkania', - ['rented_for'] = 'wynająłeś/aś mieszkanie za $', - ['purchased_for'] = 'kupiłeś/aś mieszkanie za $', + ['rented_for'] = 'wynająłeś/aś mieszkanie za ~g~$%s~s~', + ['purchased_for'] = 'kupiłeś/aś mieszkanie za ~g~$%s~s~', ['made_property'] = 'stworzyłeś/aś mieszkanie', ['not_enough'] = 'nie posiadasz wystarczająco pieniędzy', ['invalid_quantity'] = 'nieprawidłowa ilość', diff --git a/locales/sv.lua b/locales/sv.lua index a4485173..0eacaf54 100644 --- a/locales/sv.lua +++ b/locales/sv.lua @@ -19,17 +19,17 @@ Locales['sv'] = { ['remove_object'] = 'ta ut objekt', ['deposit_object'] = 'lagra objekt', ['invite'] = 'bjud in', - ['dirty_money'] = 'Smutsiga pengar: $', + ['dirty_money'] = 'smutsiga pengar: %s SEK', ['inventory'] = 'inventory', ['amount'] = 'summa?', ['amount_invalid'] = 'ogiltlig summa', - ['press_to_exit'] = 'tryck ~INPUT_CONTEXT~ för att gå ur fastigheten', - ['rented_for'] = 'du hyrde en fastighet för: ~g~$', - ['purchased_for'] = 'du köpte en fastighet för: ~g~$', + ['press_to_exit'] = 'tryck ~INPUT_CONTEXT~ för att lämna fastigheten', + ['rented_for'] = 'du hyrde en fastighet för: ~g~%s SEK~s~', + ['purchased_for'] = 'du köpte en fastighet för: ~g~%s SEK~s~', ['made_property'] = 'you have made a property', ['not_enough'] = 'du har inte tillräckligt med pengar!', ['invalid_quantity'] = 'ogiltlig mängd', - ['paid_rent'] = 'du ~y~betalade~s~ din hyra: ~g~$%s~s~', + ['paid_rent'] = 'du ~y~betalade~s~ din hyra: ~g~%s SEK~s~', ['not_enough_in_property'] = 'det finns ~r~inte~s~ tillräckligt av ~r~det objektet~s~ i fastigheten!', ['player_cannot_hold'] = 'du har ~r~inte~s~ tillräckligt med ~y~utrymme~s~ för att hålla det!', } \ No newline at end of file diff --git a/server/main.lua b/server/main.lua index 6e2e136e..d88dca41 100644 --- a/server/main.lua +++ b/server/main.lua @@ -36,9 +36,9 @@ function SetPropertyOwned(name, price, rented, owner) TriggerClientEvent('esx_property:setPropertyOwned', xPlayer.source, name, true) if rented then - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('rented_for') .. price) + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('rented_for', price)) else - TriggerClientEvent('esx:showNotification', xPlayer.source, _U('purchased_for') .. price) + TriggerClientEvent('esx:showNotification', xPlayer.source, _U('purchased_for', price)) end break