mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 10:18:54 +00:00
+3
-2
@@ -420,6 +420,7 @@ function OpenResellerMenu ()
|
||||
if closestPlayer == -1 or closestDistance > 3.0 then
|
||||
ESX.ShowNotification(_U('no_players'))
|
||||
else
|
||||
SetVehicleNumberPlateText(LastVehicles[#LastVehicles], string.upper(ESX.GetRandomString(8)))
|
||||
local vehicleProps = ESX.Game.GetVehicleProperties(LastVehicles[#LastVehicles])
|
||||
local model = CurrentVehicleData.model
|
||||
|
||||
@@ -441,6 +442,7 @@ function OpenResellerMenu ()
|
||||
ESX.ShowNotification(_U('no_players'))
|
||||
else
|
||||
ESX.TriggerServerCallback('esx:getOtherPlayerData', function (xPlayer)
|
||||
SetVehicleNumberPlateText(LastVehicles[#LastVehicles], string.upper(ESX.GetRandomString(8)))
|
||||
local vehicleProps = ESX.Game.GetVehicleProperties(LastVehicles[#LastVehicles])
|
||||
local model = CurrentVehicleData.model
|
||||
|
||||
@@ -475,8 +477,7 @@ function OpenResellerMenu ()
|
||||
if closestPlayer == -1 or closestDistance > 5.0 then
|
||||
ESX.ShowNotification(_U('no_players'))
|
||||
else
|
||||
SetVehicleNumberPlateText(LastVehicles[#LastVehicles], 'LOC ' .. ESX.GetRandomString(5))
|
||||
|
||||
SetVehicleNumberPlateText(LastVehicles[#LastVehicles], 'RENT' .. string.upper(ESX.GetRandomString(4)))
|
||||
local vehicleProps = ESX.Game.GetVehicleProperties(LastVehicles[#LastVehicles])
|
||||
local model = CurrentVehicleData.model
|
||||
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ Locales['br'] = {
|
||||
['not_enough_money'] = 'você não tem dinheiro suficiente',
|
||||
['not_rental'] = 'isso não é um ~r~veículo de aluguel~s~',
|
||||
['not_yours'] = 'este veículo não pertence a você',
|
||||
['paid_rental'] = 'Você tem ~g~pago~s~ para o seu aluguel de veiculos : ~g~$',
|
||||
['paid_rental'] = 'Você tem ~g~pago~s~ para o seu aluguel de veiculos: ~g~$%s~s~',
|
||||
['personal_vehicle'] = 'veículo pessoal',
|
||||
['pop_vehicle'] = 'sai do veiculo',
|
||||
['recruit'] = 'Recrutar',
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ Locales['de'] = {
|
||||
['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~$',
|
||||
['paid_rental'] = 'du ~g~bezahlst~s~ für den Mietwagen: ~g~$%s~s~',
|
||||
['personal_vehicle'] = 'Persönliches Fahrzeug',
|
||||
['pop_vehicle'] = 'Fahrzeug holen',
|
||||
['recruit'] = 'Neuling',
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ Locales['en'] = {
|
||||
['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~$',
|
||||
['paid_rental'] = 'you have ~g~payed~s~ for your vehicle rental: ~g~$%s~s~',
|
||||
['personal_vehicle'] = 'personal vehicle',
|
||||
['pop_vehicle'] = 'put out vehicle for sale',
|
||||
['recruit'] = 'recruit',
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ Locales['fr'] = {
|
||||
['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~$',
|
||||
['paid_rental'] = 'Vous avez ~g~payé~s~ votre location de véhicule: ~g~$%s~s~',
|
||||
['personal_vehicle'] = 'Véhicule personnel',
|
||||
['pop_vehicle'] = 'Sortir véhicule',
|
||||
['recruit'] = 'Recrue',
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ Locales['sv'] = {
|
||||
['not_enough_money'] = 'Du har inte tillräckligt mycket pengar',
|
||||
['not_rental'] = 'Detta är inte ett~r~uthyrt fordon~s~',
|
||||
['not_yours'] = 'Det här fordonet tillhör inte dig',
|
||||
['paid_rental'] = 'Du har ~g~betalat~s~ för din hyrning : ~g~$',
|
||||
['paid_rental'] = 'du har ~y~betalat~s~ ditt hyrda fordon: ~g~$%s~s~',
|
||||
['personal_vehicle'] = 'Privat fordon',
|
||||
['pop_vehicle'] = 'Ställ ut fordon till salu',
|
||||
['recruit'] = 'Anställ',
|
||||
|
||||
+26
-60
@@ -423,70 +423,36 @@ ESX.RegisterServerCallback('esx_vehicleshop:getPlayerInventory', function (sourc
|
||||
end)
|
||||
|
||||
if Config.EnablePvCommand then
|
||||
TriggerEvent('es:addCommand', 'pv', function (source, args, user)
|
||||
TriggerClientEvent('esx_vehicleshop:openPersonnalVehicleMenu', source)
|
||||
end, {help = _U('leaving')})
|
||||
TriggerEvent('es:addGroupCommand', 'pv', 'user', function(source, args, user)
|
||||
TriggerClientEvent('esx_vehicleshop:openPersonnalVehicleMenu', source)
|
||||
end, {help = _U('leaving')})
|
||||
end
|
||||
|
||||
function PayRent (d, h, m)
|
||||
MySQL.Async.fetchAll(
|
||||
'SELECT * FROM users',
|
||||
{},
|
||||
function (_users)
|
||||
local prevMoney = {}
|
||||
local newMoney = {}
|
||||
function PayRent()
|
||||
MySQL.Async.fetchAll(
|
||||
'SELECT * FROM rented_vehicles', {},
|
||||
function (result)
|
||||
for i=1, #result, 1 do
|
||||
local xPlayer = ESX.GetPlayerFromIdentifier(result[i].owner)
|
||||
|
||||
for i=1, #_users, 1 do
|
||||
prevMoney[_users[i].identifier] = _users[i].money
|
||||
newMoney[_users[i].identifier] = _users[i].money
|
||||
end
|
||||
-- message player if connected
|
||||
if xPlayer ~= nil then
|
||||
xPlayer.removeBank(result[i].rent_price)
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('paid_rental', result[i].rent_price))
|
||||
else -- pay rent either way
|
||||
MySQL.Sync.execute(
|
||||
'UPDATE users SET bank = bank - @bank WHERE identifier = @identifier',
|
||||
{
|
||||
['@bank'] = result[i].rent_price,
|
||||
['@identifier'] = result[i].owner
|
||||
})
|
||||
end
|
||||
|
||||
MySQL.Async.fetchAll(
|
||||
'SELECT * FROM rented_vehicles',
|
||||
{},
|
||||
function (result)
|
||||
local xPlayers = ESX.GetPlayers()
|
||||
|
||||
for i=1, #result, 1 do
|
||||
local foundPlayer = false
|
||||
local xPlayer = nil
|
||||
|
||||
for i=1, #xPlayers, 1 do
|
||||
local xPlayer2 = ESX.GetPlayerFromId(xPlayers[i])
|
||||
|
||||
if xPlayer2.identifier == result[i].owner then
|
||||
foundPlayer = true
|
||||
xPlayer = xPlayer2
|
||||
end
|
||||
end
|
||||
|
||||
if foundPlayer then
|
||||
xPlayer.removeMoney(result[i].rent_price)
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('paid_rental') .. result[i].rent_price)
|
||||
else
|
||||
newMoney[result[i].owner] = newMoney[result[i].owner] - result[i].rent_price
|
||||
end
|
||||
|
||||
TriggerEvent('esx_addonaccount:getSharedAccount', 'society_cardealer', function(account)
|
||||
account.addMoney(result[i].rent_price)
|
||||
end)
|
||||
end
|
||||
|
||||
for k,v in pairs(prevMoney) do
|
||||
if v ~= newMoney[k] then
|
||||
MySQL.Async.execute(
|
||||
'UPDATE users SET money = @money WHERE identifier = @identifier',
|
||||
{
|
||||
['@money'] = newMoney[k],
|
||||
['@identifier'] = k,
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
)
|
||||
TriggerEvent('esx_addonaccount:getSharedAccount', 'society_cardealer', function(account)
|
||||
account.addMoney(result[i].rent_price)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
TriggerEvent('cron:runAt', 22, 00, PayRent)
|
||||
|
||||
Reference in New Issue
Block a user