Implemented pay when selling property, added prices to menu and more (desc)

- Improved dialogs, differnet for owning / renting
- Updated locale names
- Get half money back when selling
- Added configurable rent & sell prices in config
This commit is contained in:
ElPumpo
2020-02-03 13:19:55 +01:00
parent 897d60bf13
commit 96c1ab491f
11 changed files with 159 additions and 134 deletions
+41 -39
View File
@@ -17,9 +17,9 @@ AddEventHandler('esx:playerLoaded', function(xPlayer)
CreateBlips()
end)
ESX.TriggerServerCallback('esx_property:getOwnedProperties', function(ownedProperties)
for i=1, #ownedProperties, 1 do
SetPropertyOwned(ownedProperties[i], true)
ESX.TriggerServerCallback('esx_property:getOwnedProperties', function(result)
for k,v in ipairs(result) do
SetPropertyOwned(v.name, true, v.rented)
end
end)
end)
@@ -30,9 +30,9 @@ AddEventHandler('esx_property:sendProperties', function(properties)
Config.Properties = properties
CreateBlips()
ESX.TriggerServerCallback('esx_property:getOwnedProperties', function(ownedProperties)
for i=1, #ownedProperties, 1 do
SetPropertyOwned(ownedProperties[i], true)
ESX.TriggerServerCallback('esx_property:getOwnedProperties', function(result)
for k,v in ipairs(result) do
SetPropertyOwned(v.name, true, v.rented)
end
end)
end)
@@ -168,7 +168,7 @@ function ExitProperty(name)
end)
end
function SetPropertyOwned(name, owned)
function SetPropertyOwned(name, owned, rented)
local property = GetProperty(name)
local entering = nil
local enteringName = nil
@@ -183,7 +183,7 @@ function SetPropertyOwned(name, owned)
end
if owned then
OwnedProperties[name] = true
OwnedProperties[name] = rented
RemoveBlip(Blips[enteringName])
Blips[enteringName] = AddBlipForCoord(entering.x, entering.y, entering.z)
@@ -224,7 +224,7 @@ function SetPropertyOwned(name, owned)
end
function PropertyIsOwned(property)
return OwnedProperties[property.name] == true
return OwnedProperties[property.name] ~= nil
end
function OpenPropertyMenu(property)
@@ -233,16 +233,24 @@ function OpenPropertyMenu(property)
if PropertyIsOwned(property) then
table.insert(elements, {label = _U('enter'), value = 'enter'})
-- add move out
if not Config.EnablePlayerManagement then
table.insert(elements, {label = _U('leave'), value = 'leave'})
local leaveLabel = _U('move_out')
if not OwnedProperties[property.name] then
leaveLabel = _U('move_out_sold', ESX.Math.GroupDigits(ESX.Math.Round(property.price / Config.SellModifier)))
end
table.insert(elements, {label = leaveLabel, value = 'leave'})
end
else
if not Config.EnablePlayerManagement then
table.insert(elements, {label = _U('buy'), value = 'buy'})
table.insert(elements, {label = _U('rent'), value = 'rent'})
end
table.insert(elements, {label = _U('buy', ESX.Math.GroupDigits(property.price)), value = 'buy'})
table.insert(elements, {label = _U('visit'), value = 'visit'})
-- display rent price
local rent = ESX.Math.Round(property.price / Config.RentModifier)
table.insert(elements, {label = _U('rent', ESX.Math.GroupDigits(rent)), value = 'rent'})
end
end
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'property', {
@@ -260,8 +268,6 @@ function OpenPropertyMenu(property)
TriggerServerEvent('esx_property:buyProperty', property.name)
elseif data.current.value == 'rent' then
TriggerServerEvent('esx_property:rentProperty', property.name)
elseif data.current.value == 'visit' then
TriggerEvent('instance:create', 'property', {property = property.name, owner = ESX.GetPlayerData().identifier})
end
end, function(data, menu)
menu.close()
@@ -276,7 +282,6 @@ function OpenGatewayMenu(property)
if Config.EnablePlayerManagement then
OpenGatewayOwnedPropertiesMenu(gatewayProperties)
else
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'gateway', {
title = property.name,
align = 'top-left',
@@ -301,7 +306,7 @@ end
function OpenGatewayOwnedPropertiesMenu(property)
local gatewayProperties = GetGatewayProperties(property)
local elements = {}
local elements = {}
for i=1, #gatewayProperties, 1 do
if PropertyIsOwned(gatewayProperties[i]) then
@@ -318,10 +323,7 @@ function OpenGatewayOwnedPropertiesMenu(property)
elements = elements
}, function(data, menu)
menu.close()
local elements = {
{label = _U('enter'), value = 'enter'}
}
local elements = {{label = _U('enter'), value = 'enter'}}
if not Config.EnablePlayerManagement then
table.insert(elements, {label = _U('leave'), value = 'leave'})
@@ -350,14 +352,15 @@ end
function OpenGatewayAvailablePropertiesMenu(property)
local gatewayProperties = GetGatewayProperties(property)
local elements = {}
local elements = {}
for i=1, #gatewayProperties, 1 do
if not PropertyIsOwned(gatewayProperties[i]) then
table.insert(elements, {
label = gatewayProperties[i].label .. ' $' .. ESX.Math.GroupDigits(gatewayProperties[i].price),
label = gatewayProperties[i].label,
value = gatewayProperties[i].name,
price = gatewayProperties[i].price
buyPrice = gatewayProperties[i].price,
rentPrice = ESX.Math.Round(gatewayProperties[i].price / Config.RentModifier)
})
end
end
@@ -367,24 +370,20 @@ function OpenGatewayAvailablePropertiesMenu(property)
align = 'top-left',
elements = elements
}, function(data, menu)
menu.close()
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'gateway_available_properties_actions', {
title = property.label .. ' - ' .. _U('available_properties'),
align = 'top-left',
elements = {
{label = _U('buy'), value = 'buy'},
{label = _U('rent'), value = 'rent'},
{label = _U('visit'), value = 'visit'}
{label = _U('buy', ESX.Math.GroupDigits(data.current.buyPrice)), value = 'buy'},
{label = _U('rent', ESX.Math.GroupDigits(data.current.rentPrice)), value = 'rent'}
}}, function(data2, menu2)
menu.close()
menu2.close()
if data2.current.value == 'buy' then
TriggerServerEvent('esx_property:buyProperty', data.current.value)
elseif data2.current.value == 'rent' then
TriggerServerEvent('esx_property:rentProperty', data.current.value)
elseif data2.current.value == 'visit' then
TriggerEvent('instance:create', 'property', {property = data.current.value, owner = ESX.GetPlayerData().identifier})
end
end, function(data2, menu2)
menu2.close()
@@ -545,7 +544,7 @@ function OpenRoomInventoryMenu(property, owner)
label = ESX.GetWeaponLabel(weapon.name) .. ' [' .. weapon.ammo .. ']',
type = 'item_weapon',
value = weapon.name,
ammo = weapon.ammo
index = i
})
end
@@ -558,7 +557,7 @@ function OpenRoomInventoryMenu(property, owner)
if data.current.type == 'item_weapon' then
menu.close()
TriggerServerEvent('esx_property:getItem', owner, data.current.type, data.current.value, data.current.ammo)
TriggerServerEvent('esx_property:getItem', owner, data.current.type, data.current.value, data.current.index)
ESX.SetTimeout(300, function()
OpenRoomInventoryMenu(property, owner)
end)
@@ -684,7 +683,7 @@ AddEventHandler('playerSpawned', function()
for i=1, #property.ipls, 1 do
RequestIpl(property.ipls[i])
while not IsIplActive(property.ipls[i]) do
Citizen.Wait(0)
end
@@ -713,8 +712,8 @@ AddEventHandler('esx_property:getGateway', function(property, cb)
end)
RegisterNetEvent('esx_property:setPropertyOwned')
AddEventHandler('esx_property:setPropertyOwned', function(name, owned)
SetPropertyOwned(name, owned)
AddEventHandler('esx_property:setPropertyOwned', function(name, owned, rented)
SetPropertyOwned(name, owned, rented)
end)
RegisterNetEvent('instance:onCreate')
@@ -779,6 +778,8 @@ AddEventHandler('esx_property:hasExitedMarker', function(name, part)
CurrentAction = nil
end)
local index = 0
RegisterCommand('s', function(a, b, c)
-- Enter / Exit marker events & Draw markers
Citizen.CreateThread(function()
while true do
@@ -797,6 +798,7 @@ Citizen.CreateThread(function()
if distance < Config.DrawDistance then
DrawMarker(Config.MarkerType, property.entering.x, property.entering.y, property.entering.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, nil, nil, false)
ESX.Game.Utils.DrawText3D(property.entering, property.name, 2)
letSleep = false
end
@@ -824,7 +826,7 @@ Citizen.CreateThread(function()
end
-- Room menu
if property.roomMenu and hasChest and not property.disabled then
if property.roomMenu then
local distance = GetDistanceBetweenCoords(coords, property.roomMenu.x, property.roomMenu.y, property.roomMenu.z, true)
if distance < Config.DrawDistance then
@@ -865,7 +867,7 @@ Citizen.CreateThread(function()
Citizen.Wait(0)
if CurrentAction then
ESX.ShowHelpNotification(CurrentActionMsg)
--ESX.ShowHelpNotification(CurrentActionMsg)
if IsControlJustReleased(0, 38) then
if CurrentAction == 'property_menu' then
+13 -8
View File
@@ -1,10 +1,15 @@
Config = {}
Config.DrawDistance = 100
Config.MarkerSize = {x = 1.5, y = 1.5, z = 1.0}
Config.MarkerColor = {r = 102, g = 102, b = 204}
Config.RoomMenuMarkerColor = {r = 102, g = 204, b = 102}
Config.MarkerType = 1
Config = {}
Config.DrawDistance = 100
Config.MarkerSize = {x = 1.5, y = 1.5, z = 1.0}
Config.MarkerColor = {r = 102, g = 102, b = 204}
Config.RoomMenuMarkerColor = {r = 102, g = 204, b = 102}
Config.MarkerType = 1
Config.RentModifier = 200 -- rent price: <property price> / <rent modifier> (rounded)
Config.SellModifier = 2 -- sell price: <property price> / <sell modifier> (rounded)
Config.Properties = {}
Config.Properties = {}
Config.EnablePlayerManagement = false -- If set to true you use esx_realestateagentjob
Config.Locale = 'fr'
Config.Locale = 'fr'
+9 -8
View File
@@ -4,10 +4,14 @@ Locales['br'] = {
['free_prop'] = 'Propriedade a Venda',
['property'] = 'Propriedade',
['enter'] = 'Entrar',
['leave'] = 'Sair',
['buy'] = 'Comprar',
['rent'] = 'Alugar',
['visit'] = 'Visitar',
['move_out'] = 'move out from property',
['move_out_sold'] = 'sell property for <span style="color:green;">$%s</span>',
['moved_out'] = 'you moved out and do no longer rent the property.',
['moved_out_sold'] = 'you have sold the property for ~g~$%s~s~',
['buy'] = 'buy property for <span style="color:green;">$%s</span>',
['buy_for'] = 'você comprou uma propriedade por ~g~$%s~s~',
['rent'] = 'rent property for <span style="color:green;">$%s</span> / week',
['rent_for'] = 'você alugou uma propriedade por ~g~$%s~s~',
['press_to_menu'] = 'Pressione ~INPUT_CONTEXT~ para acessar o menu',
['owned_properties'] = 'Propriedades adquiridas',
['available_properties'] = 'Propriedades disponíveis',
@@ -19,14 +23,11 @@ Locales['br'] = {
['remove_object'] = 'Remover objeto',
['deposit_object'] = 'Depositar objeto',
['invite'] = 'Convidar',
['dirty_money'] = 'Dinheiro sujo: <span style="color: red;">$%s</span>',
['dirty_money'] = 'Dinheiro sujo: <span style="color:red;">$%s</span>',
['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 ~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',
['paid_rent'] = 'Você ~g~pagou~s~ seu aluguel: ~g~$%s~s~',
+10 -7
View File
@@ -4,10 +4,14 @@ Locales['de'] = {
['free_prop'] = 'Kostenlose Immobilie',
['property'] = 'Immobilie',
['enter'] = 'Eintreten',
['leave'] = 'Verlassen',
['buy'] = 'Kaufen',
['rent'] = 'Mieten',
['visit'] = 'Ansehen',
['move_out'] = 'move out from property',
['move_out_sold'] = 'sell property for <span style="color:green;">$%s</span>',
['moved_out'] = 'you moved out and do no longer rent the property.',
['moved_out_sold'] = 'you have sold the property for ~g~$%s~s~',
['buy'] = 'buy property for <span style="color:green;">$%s</span>',
['buy_for'] = 'you purchased a property for ~g~$%s~s~',
['rent'] = 'rent property for <span style="color:green;">$%s</span> / week',
['rent_for'] = 'you rented a property for ~g~$%s~s~ / week, payment is automatic',
['press_to_menu'] = 'Drücke ~INPUT_CONTEXT~ um das Menü zu öffnen',
['owned_properties'] = 'Gekaufte Immobilien',
['available_properties'] = 'Verfügbare Immobilien',
@@ -19,14 +23,13 @@ Locales['de'] = {
['remove_object'] = 'Objekt nehmen',
['deposit_object'] = 'Objekt deponieren',
['invite'] = 'Einladen',
['dirty_money'] = 'Schwarzgeld: <span style="color: red;">$%s</span>',
['dirty_money'] = 'Schwarzgeld: <span style="color:red;">$%s</span>',
['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 ~g~$%s~s~',
['rent_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',
['paid_rent'] = 'du ~g~bezahlst~s~ deine Miete: ~g~$%s~s~',
+11 -10
View File
@@ -4,11 +4,15 @@ Locales['en'] = {
['free_prop'] = 'property For Sale',
['property'] = 'property',
['enter'] = 'enter',
['leave'] = 'sell',
['buy'] = 'buy',
['rent'] = 'rent',
['visit'] = 'visit',
['press_to_menu'] = 'press ~INPUT_CONTEXT~ to access the menu',
['move_out'] = 'move out from property',
['move_out_sold'] = 'sell property for <span style="color:green;">$%s</span>',
['moved_out'] = 'you moved out and do no longer rent the property.',
['moved_out_sold'] = 'you have sold the property for ~g~$%s~s~',
['buy'] = 'buy property for <span style="color:green;">$%s</span>',
['buy_for'] = 'you purchased a property for ~g~$%s~s~',
['rent'] = 'rent property for <span style="color:green;">$%s</span> / week',
['rent_for'] = 'you rented a property for ~g~$%s~s~ / week, payment is automatic',
['press_to_menu'] = 'press ~INPUT_CONTEXT~ to access the ~y~Property Menu~s~.',
['owned_properties'] = 'acquired properties',
['available_properties'] = 'available properties',
['invite_player'] = 'invite a player',
@@ -19,17 +23,14 @@ Locales['en'] = {
['remove_object'] = 'remove object',
['deposit_object'] = 'deposit object',
['invite'] = 'invite',
['dirty_money'] = 'dirty money: <span style="color: red;">$%s</span>',
['dirty_money'] = 'dirty money: <span style="color:red;">$%s</span>',
['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 ~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',
['paid_rent'] = 'you ~g~paid~s~ your rent: ~g~$%s~s~',
['not_enough_in_property'] = 'there\'s not enough of ~r~that item~s~ in the property!',
['player_cannot_hold'] = 'you do ~r~not~s~ have enough ~y~free space~s~ in your inventory!',
}
}
+9 -8
View File
@@ -4,10 +4,14 @@ Locales['es'] = {
['free_prop'] = 'Propiedad libre',
['property'] = 'Propiedad',
['enter'] = 'Entrar',
['leave'] = 'Salir',
['buy'] = 'Comprar',
['rent'] = 'Alquilar',
['visit'] = 'Visitar',
['move_out'] = 'move out from property',
['move_out_sold'] = 'sell property for <span style="color:green;">€%s</span>',
['moved_out'] = 'you moved out and do no longer rent the property.',
['moved_out_sold'] = 'you have sold the property for ~g~€%s~s~',
['buy'] = 'buy property for <span style="color:green;">€%s</span>',
['buy_for'] = 'has comprado una propiedad por ~g~€%s~s~',
['rent'] = 'rent property for <span style="color:green;">€%s</span> / week',
['rent_for'] = 'has alquilado una propiedad por ~g~€%s~s~',
['press_to_menu'] = 'Presionar ~INPUT_CONTEXT~ para acceder al menú',
['owned_properties'] = 'Propiedad adquirida',
['available_properties'] = 'Propiedades disponibles',
@@ -19,14 +23,11 @@ Locales['es'] = {
['remove_object'] = 'Retirar objeto',
['deposit_object'] = 'Depositar objeto',
['invite'] = 'Invitar',
['dirty_money'] = 'Dinero sucio: <span style="color: red;">€%s</span>',
['dirty_money'] = 'Dinero sucio: <span style="color:red;">€%s</span>',
['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 ~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',
['paid_rent'] = 'Has ~g~pagado~s~ por el alquiler: ~g~€%s~s~',
+10 -9
View File
@@ -4,10 +4,14 @@ Locales['fi'] = {
['free_prop'] = 'vapaa kiinteistö',
['property'] = 'asunto',
['enter'] = 'sisään',
['leave'] = 'myy',
['buy'] = 'osta',
['rent'] = 'vuokraa',
['visit'] = 'vieraile',
['move_out'] = 'move out from property',
['move_out_sold'] = 'sell property for <span style="color:green;">$%s</span>',
['moved_out'] = 'you moved out and do no longer rent the property.',
['moved_out_sold'] = 'you have sold the property for ~g~$%s~s~',
['buy'] = 'buy property for <span style="color:green;">$%s</span>',
['buy_for'] = 'sinä ostit kiinteistön hintaan ~g~$%s~s~',
['rent'] = 'rent property for <span style="color:green;">$%s</span> / week',
['rent_for'] = 'sinä vuokrasit kiinteistön hintaan ~g~$%s~s~',
['press_to_menu'] = 'paina ~INPUT_CONTEXT~ avataksesi talon valikko',
['owned_properties'] = 'omistuksessa olevat asunnot',
['available_properties'] = 'vapaat asunnot',
@@ -19,17 +23,14 @@ Locales['fi'] = {
['remove_object'] = 'poista esine',
['deposit_object'] = 'talleta esine',
['invite'] = 'kutsu',
['dirty_money'] = 'likainen raha: <span style="color: red;">$%s</span>',
['dirty_money'] = 'likainen raha: <span style="color:red;">$%s</span>',
['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 ~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ä',
['paid_rent'] = 'sinä ~g~maksoit~s~ vuokraasi: ~g~$%s~s~',
['not_enough_in_property'] = 'täällä ei ole enempää ~r~tätä itemiä~s~ tässä kiinteistössä!',
['player_cannot_hold'] = 'sinulla ~r~ei ole~s~ tarpeeksi ~y~vapaata tilaa~s~ repussasi!',
}
}
+9 -8
View File
@@ -4,10 +4,14 @@ Locales['fr'] = {
['free_prop'] = 'propriété libre',
['property'] = 'propriété',
['enter'] = 'entrer',
['leave'] = 'rendre',
['buy'] = 'acheter',
['rent'] = 'louer',
['visit'] = 'visiter',
['move_out'] = 'move out from property',
['move_out_sold'] = 'sell property for <span style="color:green;">$%s</span>',
['moved_out'] = 'you moved out and do no longer rent the property.',
['moved_out_sold'] = 'you have sold the property for ~g~$%s~s~',
['buy'] = 'buy property for <span style="color:green;">$%s</span>',
['buy_for'] = 'vous avez acheté une propriété pour ~g~$%s~s~',
['rent'] = 'rent property for <span style="color:green;">$%s</span> / week',
['rent_for'] = 'vous avez loué une propriété pour ~g~$%s~s~',
['press_to_menu'] = 'appuyez sur ~INPUT_CONTEXT~ pour accéder au menu',
['owned_properties'] = 'propriétés acquises',
['available_properties'] = 'propriétés disponibles',
@@ -19,14 +23,11 @@ Locales['fr'] = {
['remove_object'] = 'retirer objet',
['deposit_object'] = 'déposer objet',
['invite'] = 'inviter',
['dirty_money'] = 'argent sale: <span style="color: red;">$%s</span>',
['dirty_money'] = 'argent sale: <span style="color:red;">$%s</span>',
['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 ~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',
['paid_rent'] = 'vous avez ~g~payé~s~ votre loyer: ~g~$%s~s~',
+10 -9
View File
@@ -4,10 +4,14 @@ Locales['pl'] = {
['free_prop'] = 'wolne mieszkanie',
['property'] = 'mieszkanie',
['enter'] = 'wejdz',
['leave'] = 'sprzedzaj',
['buy'] = 'kup',
['rent'] = 'wynajmij',
['visit'] = 'odwiedz',
['move_out'] = 'move out from property',
['move_out_sold'] = 'sell property for <span style="color:green;">$%s</span>',
['moved_out'] = 'you moved out and do no longer rent the property.',
['moved_out_sold'] = 'you have sold the property for ~g~$%s~s~',
['buy'] = 'buy property for <span style="color:green;">$%s</span>',
['buy_for'] = 'kupiłeś/aś mieszkanie za ~g~$%s~s~',
['rent'] = 'rent property for <span style="color:green;">$%s</span> / week',
['rent_for'] = 'wynająłeś/aś mieszkanie za ~g~$%s~s~',
['press_to_menu'] = 'wciśnij ~INPUT_CONTEXT~ aby otworzyć menu',
['owned_properties'] = 'twoje mieszkania',
['available_properties'] = 'dostępne mieszkania',
@@ -19,17 +23,14 @@ Locales['pl'] = {
['remove_object'] = 'usuń objekt',
['deposit_object'] = 'deponuj objekt',
['invite'] = 'zaproś',
['dirty_money'] = 'brudne pieniądze: <span style="color: red;">$%s</span>',
['dirty_money'] = 'brudne pieniądze: <span style="color:red;">$%s</span>',
['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 ~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ść',
['paid_rent'] = '~g~zapłaciłeś/aś~s~ za wynajem: ~g~$%s~s~',
['not_enough_in_property'] = 'nie ma wystarczająco ~r~tego przedmiotu~s~ w mieszkaniu!',
['player_cannot_hold'] = '~r~nie masz~s~ wystarczająco ~y~wolnego~s~ miejsca w ekwipunku!',
}
}
+13 -12
View File
@@ -4,14 +4,18 @@ Locales['sv'] = {
['free_prop'] = 'ledig fastighet',
['property'] = 'fastighet',
['enter'] = 'gå in',
['leave'] = 'sälj',
['buy'] = 'köp',
['rent'] = 'hyr',
['visit'] = 'besök',
['move_out'] = 'flytta ut',
['move_out_sold'] = 'sälj fastighet för <span style="color:green;">%s SEK</span>',
['moved_out'] = 'du har flyttat ut och hyr inte fastigheten längre',
['moved_out_sold'] = 'du har sålt fastigheten för ~g~%s SEK~s~',
['buy'] = 'köp fastighet för <span style="color:green;">%s SEK</span>',
['buy_for'] = 'du hyrde en fastighet för ~g~%s SEK~s~ / vecka, betalning sker automatiskt',
['rent'] = 'hyr fastighet för <span style="color:green;">%s SEK</span> / vecka',
['rent_for'] = 'du köpte en fastighet för ~g~%s SEK~s~',
['press_to_menu'] = 'tryck ~INPUT_CONTEXT~ för att komma åt menyn',
['owned_properties'] = 'upptagna fastigheter',
['available_properties'] = 'lediga fastigheter',
['invite_player'] = 'bjud in granne',
['owned_properties'] = 'ägda fastigheter',
['available_properties'] = 'fastigheter till salu',
['invite_player'] = 'bjud in spelare',
['you_invited'] = 'du bjöd in ~y~%s~s~ till din fastighet',
['player_clothes'] = 'Kläder',
['remove_cloth'] = 'ta bort klädstil',
@@ -19,17 +23,14 @@ Locales['sv'] = {
['remove_object'] = 'ta ut objekt',
['deposit_object'] = 'lagra objekt',
['invite'] = 'bjud in',
['dirty_money'] = 'smutsiga pengar: <span style="color: red;">%s SEK</span>',
['dirty_money'] = 'smutsiga pengar: <span style="color:red;">%s SEK</span>',
['inventory'] = 'inventory',
['amount'] = 'summa?',
['amount_invalid'] = 'ogiltlig summa',
['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 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!',
}
}
+24 -16
View File
@@ -20,7 +20,7 @@ function SetPropertyOwned(name, price, rented, owner)
local xPlayer = ESX.GetPlayerFromIdentifier(owner)
if xPlayer then
TriggerClientEvent('esx_property:setPropertyOwned', xPlayer.source, name, true)
TriggerClientEvent('esx_property:setPropertyOwned', xPlayer.source, name, true, rented)
if rented then
xPlayer.showNotification(_U('rented_for', ESX.Math.GroupDigits(price)))
@@ -32,15 +32,29 @@ function SetPropertyOwned(name, price, rented, owner)
end
function RemoveOwnedProperty(name, owner)
MySQL.Async.execute('DELETE FROM owned_properties WHERE name = @name AND owner = @owner', {
MySQL.Async.fetchAll('SELECT id, rented, price FROM owned_properties WHERE name = @name AND owner = @owner', {
['@name'] = name,
['@owner'] = owner
}, function(rowsChanged)
local xPlayer = ESX.GetPlayerFromIdentifier(owner)
}, function(result)
if result[1] then
MySQL.Async.execute('DELETE FROM owned_properties WHERE id = @id', {
['@id'] = result[1].id
}, function(rowsChanged)
local xPlayer = ESX.GetPlayerFromIdentifier(owner)
if xPlayer then
TriggerClientEvent('esx_property:setPropertyOwned', xPlayer.source, name, false)
xPlayer.showNotification(_U('made_property'))
if xPlayer then
xPlayer.triggerEvent('esx_property:setPropertyOwned', name, false)
if result[1].rented == 1 then
xPlayer.showNotification(_U('moved_out'))
else
local sellPrice = ESX.Math.Round(result[1].price / Config.SellModifier)
xPlayer.showNotification(_U('moved_out_sold', ESX.Math.GroupDigits(sellPrice)))
xPlayer.addAccountMoney('bank', sellPrice)
end
end
end)
end
end)
end
@@ -152,7 +166,7 @@ RegisterServerEvent('esx_property:rentProperty')
AddEventHandler('esx_property:rentProperty', function(propertyName)
local xPlayer = ESX.GetPlayerFromId(source)
local property = GetProperty(propertyName)
local rent = ESX.Math.Round(property.price / 200)
local rent = ESX.Math.Round(property.price / Config.RentModifier)
SetPropertyOwned(propertyName, rent, true, xPlayer.identifier)
end)
@@ -296,16 +310,10 @@ end)
ESX.RegisterServerCallback('esx_property:getOwnedProperties', function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)
MySQL.Async.fetchAll('SELECT name FROM owned_properties WHERE owner = @owner', {
MySQL.Async.fetchAll('SELECT name, rented FROM owned_properties WHERE owner = @owner', {
['@owner'] = xPlayer.identifier
}, function(result)
local properties = {}
for i=1, #result, 1 do
table.insert(properties, result[i].name)
end
cb(properties)
cb(result)
end)
end)