Diff
checker
Texto
Texto
Imagens
Documentos
Excel
Pastas
Legal
Enterprise
Aplicativo para desktop
Preços
Fazer login
Baixar o Diffchecker Desktop
Comparar texto
Encontre a diferença entre dois arquivos de texto
Ferramentas
Histórico
Exibição
Layout
Dividido
Unificado
Editor live
Ocultar espaços em branco
Recolher inalteradas
Sem quebra de linha
Nível de detalhe
Inteligente
Sintaxe
Nenhum
Alterar aparência
Processamento
Ignorar
Transformar texto
Ir à primeira mudança
Editar entrada
Diffchecker Desktop
A maneira mais segura de usar o Diffchecker. Obtenha o aplicativo Diffchecker Desktop: seus diffs nunca saem do seu computador!
Obter Desktop
AdvancedGarage Server
Criado
há 7 anos
O diff nunca expira
Limpar
Exportar
Compartilhar
Explicar
0 remoções
Linhas
Total
Removido
Caracteres
Total
Removido
Para continuar usando este recurso, atualize para
Diff
checker
Pro
Ver preços
403 linhas
Copiar tudo
51 adições
Linhas
Total
Adicionado
Caracteres
Total
Adicionado
Para continuar usando este recurso, atualize para
Diff
checker
Pro
Ver preços
454 linhas
Copiar tudo
ESX = nil
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
-- Make sure all Vehicles are Stored on restart
-- Make sure all Vehicles are Stored on restart
MySQL.ready(function()
MySQL.ready(function()
ParkVehicles()
ParkVehicles()
end)
end)
function ParkVehicles()
function ParkVehicles()
MySQL.Async.execute('UPDATE owned_vehicles SET `stored` = true WHERE `stored` = @stored', {
MySQL.Async.execute('UPDATE owned_vehicles SET `stored` = true WHERE `stored` = @stored', {
['@stored'] = false
['@stored'] = false
}, function(rowsChanged)
}, function(rowsChanged)
if rowsChanged > 0 then
if rowsChanged > 0 then
print(('esx_advancedgarage: %s vehicle(s) have been stored!'):format(rowsChanged))
print(('esx_advancedgarage: %s vehicle(s) have been stored!'):format(rowsChanged))
end
end
end)
end)
end
end
-- Get Owned Properties
-- Get Owned Properties
ESX.RegisterServerCallback('esx_advancedgarage:getOwnedProperties', function(source, cb)
ESX.RegisterServerCallback('esx_advancedgarage:getOwnedProperties', function(source, cb)
local _source = source
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local xPlayer = ESX.GetPlayerFromId(_source)
local properties = {}
local properties = {}
MySQL.Async.fetchAll('SELECT * FROM owned_properties WHERE owner = @owner', {
MySQL.Async.fetchAll('SELECT * FROM owned_properties WHERE owner = @owner', {
['@owner'] = xPlayer.getIdentifier()
['@owner'] = xPlayer.getIdentifier()
}, function(data)
}, function(data)
for _,v in pairs(data) do
for _,v in pairs(data) do
table.insert(properties, v.name)
table.insert(properties, v.name)
end
end
cb(properties)
cb(properties)
end)
end)
end)
end)
-- Fetch Owned Aircrafts
-- Fetch Owned Aircrafts
ESX.RegisterServerCallback('esx_advancedgarage:getOwnedAircrafts', function(source, cb)
ESX.RegisterServerCallback('esx_advancedgarage:getOwnedAircrafts', function(source, cb)
local ownedAircrafts = {}
local ownedAircrafts = {}
if Config.DontShowPoundCarsInGarage == true then
if Config.DontShowPoundCarsInGarage == true then
MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job AND `stored` = @stored', {
MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job AND `stored` = @stored', {
['@owner'] = GetPlayerIdentifiers(source)[1],
['@owner'] = GetPlayerIdentifiers(source)[1],
['@Type'] = 'aircraft',
['@Type'] = 'aircraft',
['@job'] = '',
['@job'] = '',
['@stored'] = true
['@stored'] = true
}, function(data)
}, function(data)
for _,v in pairs(data) do
for _,v in pairs(data) do
local vehicle = json.decode(v.vehicle)
local vehicle = json.decode(v.vehicle)
table.insert(ownedAircrafts, {vehicle = vehicle, stored = v.stored, plate = v.plate})
table.insert(ownedAircrafts, {vehicle = vehicle, stored = v.stored, plate = v.plate})
end
end
cb(ownedAircrafts)
cb(ownedAircrafts)
end)
end)
else
else
MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job', {
MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job', {
['@owner'] = GetPlayerIdentifiers(source)[1],
['@owner'] = GetPlayerIdentifiers(source)[1],
['@Type'] = 'aircraft',
['@Type'] = 'aircraft',
['@job'] = ''
['@job'] = ''
}, function(data)
}, function(data)
for _,v in pairs(data) do
for _,v in pairs(data) do
local vehicle = json.decode(v.vehicle)
local vehicle = json.decode(v.vehicle)
table.insert(ownedAircrafts, {vehicle = vehicle, stored = v.stored, plate = v.plate})
table.insert(ownedAircrafts, {vehicle = vehicle, stored = v.stored, plate = v.plate})
end
end
cb(ownedAircrafts)
cb(ownedAircrafts)
end)
end)
end
end
end)
end)
-- Fetch Owned Boats
-- Fetch Owned Boats
ESX.RegisterServerCallback('esx_advancedgarage:getOwnedBoats', function(source, cb)
ESX.RegisterServerCallback('esx_advancedgarage:getOwnedBoats', function(source, cb)
local ownedBoats = {}
local ownedBoats = {}
if Config.DontShowPoundCarsInGarage == true then
if Config.DontShowPoundCarsInGarage == true then
MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job AND `stored` = @stored', {
MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job AND `stored` = @stored', {
['@owner'] = GetPlayerIdentifiers(source)[1],
['@owner'] = GetPlayerIdentifiers(source)[1],
['@Type'] = 'boat',
['@Type'] = 'boat',
['@job'] = '',
['@job'] = '',
['@stored'] = true
['@stored'] = true
}, function(data)
}, function(data)
for _,v in pairs(data) do
for _,v in pairs(data) do
local vehicle = json.decode(v.vehicle)
local vehicle = json.decode(v.vehicle)
table.insert(ownedBoats, {vehicle = vehicle, stored = v.stored, plate = v.plate})
table.insert(ownedBoats, {vehicle = vehicle, stored = v.stored, plate = v.plate})
end
end
cb(ownedBoats)
cb(ownedBoats)
end)
end)
else
else
MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job', {
MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job', {
['@owner'] = GetPlayerIdentifiers(source)[1],
['@owner'] = GetPlayerIdentifiers(source)[1],
['@Type'] = 'boat',
['@Type'] = 'boat',
['@job'] = ''
['@job'] = ''
}, function(data)
}, function(data)
for _,v in pairs(data) do
for _,v in pairs(data) do
local vehicle = json.decode(v.vehicle)
local vehicle = json.decode(v.vehicle)
table.insert(ownedBoats, {vehicle = vehicle, stored = v.stored, plate = v.plate})
table.insert(ownedBoats, {vehicle = vehicle, stored = v.stored, plate = v.plate})
end
end
cb(ownedBoats)
cb(ownedBoats)
end)
end)
end
end
end)
end)
-- Fetch Owned Cars
-- Fetch Owned Cars
Diferenças salvas
Texto original
Abrir arquivo
ESX = nil TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) -- Make sure all Vehicles are Stored on restart MySQL.ready(function() ParkVehicles() end) function ParkVehicles() MySQL.Async.execute('UPDATE owned_vehicles SET `stored` = true WHERE `stored` = @stored', { ['@stored'] = false }, function(rowsChanged) if rowsChanged > 0 then print(('esx_advancedgarage: %s vehicle(s) have been stored!'):format(rowsChanged)) end end) end -- Get Owned Properties ESX.RegisterServerCallback('esx_advancedgarage:getOwnedProperties', function(source, cb) local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local properties = {} MySQL.Async.fetchAll('SELECT * FROM owned_properties WHERE owner = @owner', { ['@owner'] = xPlayer.getIdentifier() }, function(data) for _,v in pairs(data) do table.insert(properties, v.name) end cb(properties) end) end) -- Fetch Owned Aircrafts ESX.RegisterServerCallback('esx_advancedgarage:getOwnedAircrafts', function(source, cb) local ownedAircrafts = {} if Config.DontShowPoundCarsInGarage == true then MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job AND `stored` = @stored', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'aircraft', ['@job'] = '', ['@stored'] = true }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedAircrafts, {vehicle = vehicle, stored = v.stored, plate = v.plate}) end cb(ownedAircrafts) end) else MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'aircraft', ['@job'] = '' }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedAircrafts, {vehicle = vehicle, stored = v.stored, plate = v.plate}) end cb(ownedAircrafts) end) end end) -- Fetch Owned Boats ESX.RegisterServerCallback('esx_advancedgarage:getOwnedBoats', function(source, cb) local ownedBoats = {} if Config.DontShowPoundCarsInGarage == true then MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job AND `stored` = @stored', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'boat', ['@job'] = '', ['@stored'] = true }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedBoats, {vehicle = vehicle, stored = v.stored, plate = v.plate}) end cb(ownedBoats) end) else MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'boat', ['@job'] = '' }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedBoats, {vehicle = vehicle, stored = v.stored, plate = v.plate}) end cb(ownedBoats) end) end end) -- Fetch Owned Cars ESX.RegisterServerCallback('esx_advancedgarage:getOwnedCars', function(source, cb) local ownedCars = {} if Config.DontShowPoundCarsInGarage == true then MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job AND `stored` = @stored', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'car', ['@job'] = '', ['@stored'] = true }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedCars, {vehicle = vehicle, stored = v.stored, plate = v.plate}) end cb(ownedCars) end) else MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'car', ['@job'] = '' }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedCars, {vehicle = vehicle, stored = v.stored, plate = v.plate}) end cb(ownedCars) end) end end) -- Store Vehicles ESX.RegisterServerCallback('esx_advancedgarage:storeVehicle', function (source, cb, vehicleProps) local ownedCars = {} local vehplate = vehicleProps.plate:match("^%s*(.-)%s*$") local vehiclemodel = vehicleProps.model local xPlayer = ESX.GetPlayerFromId(source) MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND @plate = plate', { ['@owner'] = xPlayer.identifier, ['@plate'] = vehicleProps.plate }, function (result) if result[1] ~= nil then local originalvehprops = json.decode(result[1].vehicle) if originalvehprops.model == vehiclemodel then MySQL.Async.execute('UPDATE owned_vehicles SET vehicle = @vehicle WHERE owner = @owner AND plate = @plate', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@vehicle'] = json.encode(vehicleProps), ['@plate'] = vehicleProps.plate }, function (rowsChanged) if rowsChanged == 0 then print(('esx_advancedgarage: %s attempted to store an vehicle they don\'t own!'):format(GetPlayerIdentifiers(source)[1])) end cb(true) end) else if Config.KickPossibleCheaters == true then if Config.UseCustomKickMessage == true then print(('esx_advancedgarage: %s attempted to Cheat! Tried Storing: '..vehiclemodel..'. Original Vehicle: '..originalvehprops.model):format(GetPlayerIdentifiers(source)[1])) DropPlayer(source, _U('custom_kick')) cb(false) else print(('esx_advancedgarage: %s attempted to Cheat! Tried Storing: '..vehiclemodel..'. Original Vehicle: '..originalvehprops.model):format(GetPlayerIdentifiers(source)[1])) DropPlayer(source, 'You have been Kicked from the Server for Possible Garage Cheating!!!') cb(false) end else print(('esx_advancedgarage: %s attempted to Cheat! Tried Storing: '..vehiclemodel..'. Original Vehicle: '..originalvehprops.model):format(GetPlayerIdentifiers(source)[1])) cb(false) end end else print(('esx_advancedgarage: %s attempted to store an vehicle they don\'t own!'):format(GetPlayerIdentifiers(source)[1])) cb(false) end end) end) -- Fetch Pounded Aircrafts ESX.RegisterServerCallback('esx_advancedgarage:getOutOwnedAircrafts', function(source, cb) local ownedAircrafts = {} MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job AND `stored` = @stored', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'aircraft', ['@job'] = '', ['@stored'] = false }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedAircrafts, vehicle) end cb(ownedAircrafts) end) end) -- Fetch Pounded Boats ESX.RegisterServerCallback('esx_advancedgarage:getOutOwnedBoats', function(source, cb) local ownedBoats = {} MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job AND `stored` = @stored', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'boat', ['@job'] = '', ['@stored'] = false }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedBoats, vehicle) end cb(ownedBoats) end) end) -- Fetch Pounded Cars ESX.RegisterServerCallback('esx_advancedgarage:getOutOwnedCars', function(source, cb) local ownedCars = {} MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job AND `stored` = @stored', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'car', ['@job'] = '', ['@stored'] = false }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedCars, vehicle) end cb(ownedCars) end) end) -- Fetch Pounded Policing Vehicles ESX.RegisterServerCallback('esx_advancedgarage:getOutOwnedPolicingCars', function(source, cb) local ownedPolicingCars = {} MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND job = @job AND `stored` = @stored', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@job'] = 'police', ['@stored'] = false }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedPolicingCars, vehicle) end cb(ownedPolicingCars) end) end) -- Fetch Pounded Ambulance Vehicles ESX.RegisterServerCallback('esx_advancedgarage:getOutOwnedAmbulanceCars', function(source, cb) local ownedAmbulanceCars = {} MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND job = @job AND `stored` = @stored', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@job'] = 'ambulance', ['@stored'] = false }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedAmbulanceCars, vehicle) end cb(ownedAmbulanceCars) end) end) -- Check Money for Pounded Aircrafts ESX.RegisterServerCallback('esx_advancedgarage:checkMoneyAircrafts', function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) if xPlayer.get('money') >= Config.AircraftPoundPrice then cb(true) else cb(false) end end) -- Check Money for Pounded Boats ESX.RegisterServerCallback('esx_advancedgarage:checkMoneyBoats', function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) if xPlayer.get('money') >= Config.BoatPoundPrice then cb(true) else cb(false) end end) -- Check Money for Pounded Cars ESX.RegisterServerCallback('esx_advancedgarage:checkMoneyCars', function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) if xPlayer.get('money') >= Config.CarPoundPrice then cb(true) else cb(false) end end) -- Check Money for Pounded Policing ESX.RegisterServerCallback('esx_advancedgarage:checkMoneyPolicing', function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) if xPlayer.get('money') >= Config.PolicingPoundPrice then cb(true) else cb(false) end end) -- Check Money for Pounded Ambulance ESX.RegisterServerCallback('esx_advancedgarage:checkMoneyAmbulance', function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) if xPlayer.get('money') >= Config.AmbulancePoundPrice then cb(true) else cb(false) end end) -- Pay for Pounded Aircrafts RegisterServerEvent('esx_advancedgarage:payAircraft') AddEventHandler('esx_advancedgarage:payAircraft', function() local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeMoney(Config.AircraftPoundPrice) TriggerClientEvent('esx:showNotification', source, _U('you_paid') .. Config.AircraftPoundPrice) TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mechanic', function(account) account.addMoney(Config.AircraftPoundPrice) end) end) -- Pay for Pounded Boats RegisterServerEvent('esx_advancedgarage:payBoat') AddEventHandler('esx_advancedgarage:payBoat', function() local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeMoney(Config.BoatPoundPrice) TriggerClientEvent('esx:showNotification', source, _U('you_paid') .. Config.BoatPoundPrice) TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mechanic', function(account) account.addMoney(Config.BoatPoundPrice) end) end) -- Pay for Pounded Cars RegisterServerEvent('esx_advancedgarage:payCar') AddEventHandler('esx_advancedgarage:payCar', function() local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeMoney(Config.CarPoundPrice) TriggerClientEvent('esx:showNotification', source, _U('you_paid') .. Config.CarPoundPrice) TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mechanic', function(account) account.addMoney(Config.CarPoundPrice) end) end) -- Pay for Pounded Policing RegisterServerEvent('esx_advancedgarage:payPolicing') AddEventHandler('esx_advancedgarage:payPolicing', function() local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeMoney(Config.PolicingPoundPrice) TriggerClientEvent('esx:showNotification', source, _U('you_paid') .. Config.PolicingPoundPrice) TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mechanic', function(account) account.addMoney(Config.PolicingPoundPrice) end) end) -- Pay for Pounded Ambulance RegisterServerEvent('esx_advancedgarage:payAmbulance') AddEventHandler('esx_advancedgarage:payAmbulance', function() local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeMoney(Config.AmbulancePoundPrice) TriggerClientEvent('esx:showNotification', source, _U('you_paid') .. Config.AmbulancePoundPrice) TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mechanic', function(account) account.addMoney(Config.AmbulancePoundPrice) end) end) -- Pay to Return Broken Vehicles RegisterServerEvent('esx_advancedgarage:payhealth') AddEventHandler('esx_advancedgarage:payhealth', function(price) local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeMoney(price) TriggerClientEvent('esx:showNotification', source, _U('you_paid') .. price) TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mechanic', function(account) account.addMoney(price) end) end) -- Modify State of Vehicles RegisterServerEvent('esx_advancedgarage:setVehicleState') AddEventHandler('esx_advancedgarage:setVehicleState', function(plate, state) local xPlayer = ESX.GetPlayerFromId(source) MySQL.Async.execute('UPDATE owned_vehicles SET `stored` = @stored WHERE plate = @plate', { ['@stored'] = state, ['@plate'] = plate }, function(rowsChanged) if rowsChanged == 0 then print(('esx_advancedgarage: %s exploited the garage!'):format(xPlayer.identifier)) end end) end)
Texto alterado
Abrir arquivo
ESX = nil TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) -- Make sure all Vehicles are Stored on restart MySQL.ready(function() ParkVehicles() end) function ParkVehicles() MySQL.Async.execute('UPDATE owned_vehicles SET `stored` = true WHERE `stored` = @stored', { ['@stored'] = false }, function(rowsChanged) if rowsChanged > 0 then print(('esx_advancedgarage: %s vehicle(s) have been stored!'):format(rowsChanged)) end end) end -- Get Owned Properties ESX.RegisterServerCallback('esx_advancedgarage:getOwnedProperties', function(source, cb) local _source = source local xPlayer = ESX.GetPlayerFromId(_source) local properties = {} MySQL.Async.fetchAll('SELECT * FROM owned_properties WHERE owner = @owner', { ['@owner'] = xPlayer.getIdentifier() }, function(data) for _,v in pairs(data) do table.insert(properties, v.name) end cb(properties) end) end) -- Fetch Owned Aircrafts ESX.RegisterServerCallback('esx_advancedgarage:getOwnedAircrafts', function(source, cb) local ownedAircrafts = {} if Config.DontShowPoundCarsInGarage == true then MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job AND `stored` = @stored', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'aircraft', ['@job'] = '', ['@stored'] = true }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedAircrafts, {vehicle = vehicle, stored = v.stored, plate = v.plate}) end cb(ownedAircrafts) end) else MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'aircraft', ['@job'] = '' }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedAircrafts, {vehicle = vehicle, stored = v.stored, plate = v.plate}) end cb(ownedAircrafts) end) end end) -- Fetch Owned Boats ESX.RegisterServerCallback('esx_advancedgarage:getOwnedBoats', function(source, cb) local ownedBoats = {} if Config.DontShowPoundCarsInGarage == true then MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job AND `stored` = @stored', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'boat', ['@job'] = '', ['@stored'] = true }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedBoats, {vehicle = vehicle, stored = v.stored, plate = v.plate}) end cb(ownedBoats) end) else MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'boat', ['@job'] = '' }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedBoats, {vehicle = vehicle, stored = v.stored, plate = v.plate}) end cb(ownedBoats) end) end end) -- Fetch Owned Cars ESX.RegisterServerCallback('esx_advancedgarage:getOwnedCars', function(source, cb) local ownedCars = {} if Config.DontShowPoundCarsInGarage == true then MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job AND `stored` = @stored', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'car', ['@job'] = '', ['@stored'] = true }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedCars, {vehicle = vehicle, stored = v.stored, plate = v.plate}) end cb(ownedCars) end) else MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'car', ['@job'] = '' }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedCars, {vehicle = vehicle, stored = v.stored, plate = v.plate}) end cb(ownedCars) end) end end) -- Store Vehicles ESX.RegisterServerCallback('esx_advancedgarage:storeVehicle', function (source, cb, vehicleProps) local ownedCars = {} local vehplate = vehicleProps.plate:match("^%s*(.-)%s*$") local vehiclemodel = vehicleProps.model local xPlayer = ESX.GetPlayerFromId(source) --CREO QUE SIRVE PARA IDENTIFICAR QUE EL AUTO QUE SE VA A GUARDAR ES UN AUTO CON DUEÑO MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND @plate = plate', { ['@owner'] = xPlayer.identifier, ['@plate'] = vehicleProps.plate }, function (result) if result[1] ~= nil then local originalvehprops = json.decode(result[1].vehicle) if originalvehprops.model == vehiclemodel then MySQL.Async.execute('UPDATE owned_vehicles SET vehicle = @vehicle WHERE owner = @owner AND plate = @plate', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@vehicle'] = json.encode(vehicleProps), ['@plate'] = vehicleProps.plate }, function (rowsChanged) if rowsChanged == 0 then print(('esx_advancedgarage: %s attempted to store an vehicle they don\'t own!'):format(GetPlayerIdentifiers(source)[1])) end cb(true) end) else if Config.KickPossibleCheaters == true then if Config.UseCustomKickMessage == true then print(('esx_advancedgarage: %s attempted to Cheat! Tried Storing: '..vehiclemodel..'. Original Vehicle: '..originalvehprops.model):format(GetPlayerIdentifiers(source)[1])) DropPlayer(source, _U('custom_kick')) cb(false) else print(('esx_advancedgarage: %s attempted to Cheat! Tried Storing: '..vehiclemodel..'. Original Vehicle: '..originalvehprops.model):format(GetPlayerIdentifiers(source)[1])) DropPlayer(source, 'You have been Kicked from the Server for Possible Garage Cheating!!!') cb(false) end else print(('esx_advancedgarage: %s attempted to Cheat! Tried Storing: '..vehiclemodel..'. Original Vehicle: '..originalvehprops.model):format(GetPlayerIdentifiers(source)[1])) cb(false) end end else print(('esx_advancedgarage: %s attempted to store an vehicle they don\'t own!'):format(GetPlayerIdentifiers(source)[1])) cb(false) end end) end) -- Fetch Pounded Aircrafts ESX.RegisterServerCallback('esx_advancedgarage:getOutOwnedAircrafts', function(source, cb) local ownedAircrafts = {} MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job AND `stored` = @stored', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'aircraft', ['@job'] = '', ['@stored'] = false }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedAircrafts, vehicle) end cb(ownedAircrafts) end) end) -- Fetch Pounded Boats ESX.RegisterServerCallback('esx_advancedgarage:getOutOwnedBoats', function(source, cb) local ownedBoats = {} MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job AND `stored` = @stored', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'boat', ['@job'] = '', ['@stored'] = false }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedBoats, vehicle) end cb(ownedBoats) end) end) -- Fetch Pounded Cars ESX.RegisterServerCallback('esx_advancedgarage:getOutOwnedCars', function(source, cb) local ownedCars = {} MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND Type = @Type AND job = @job AND `stored` = @stored', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@Type'] = 'car', ['@job'] = '', ['@stored'] = false }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedCars, vehicle) end cb(ownedCars) end) end) -- Fetch Pounded Policing Vehicles ESX.RegisterServerCallback('esx_advancedgarage:getOutOwnedPolicingCars', function(source, cb) local ownedPolicingCars = {} MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND job = @job AND `stored` = @stored', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@job'] = 'police', ['@stored'] = false }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedPolicingCars, vehicle) end cb(ownedPolicingCars) end) end) -- Fetch Pounded Ambulance Vehicles ESX.RegisterServerCallback('esx_advancedgarage:getOutOwnedAmbulanceCars', function(source, cb) local ownedAmbulanceCars = {} MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE owner = @owner AND job = @job AND `stored` = @stored', { ['@owner'] = GetPlayerIdentifiers(source)[1], ['@job'] = 'ambulance', ['@stored'] = false }, function(data) for _,v in pairs(data) do local vehicle = json.decode(v.vehicle) table.insert(ownedAmbulanceCars, vehicle) end cb(ownedAmbulanceCars) end) end) -- Check Money for Pounded Aircrafts ESX.RegisterServerCallback('esx_advancedgarage:checkMoneyAircrafts', function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) if xPlayer.get('money') >= Config.AircraftPoundPrice then cb(true) else cb(false) end end) -- Check Money for Pounded Boats ESX.RegisterServerCallback('esx_advancedgarage:checkMoneyBoats', function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) if xPlayer.get('money') >= Config.BoatPoundPrice then cb(true) else cb(false) end end) -- Check Money for Pounded Cars ESX.RegisterServerCallback('esx_advancedgarage:checkMoneyCars', function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) if xPlayer.get('money') >= Config.CarPoundPrice then cb(true) else cb(false) end end) -- Check Money for Pounded Policing ESX.RegisterServerCallback('esx_advancedgarage:checkMoneyPolicing', function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) if xPlayer.get('money') >= Config.PolicingPoundPrice then cb(true) else cb(false) end end) -- Check Money for Pounded Ambulance ESX.RegisterServerCallback('esx_advancedgarage:checkMoneyAmbulance', function(source, cb) local xPlayer = ESX.GetPlayerFromId(source) if xPlayer.get('money') >= Config.AmbulancePoundPrice then cb(true) else cb(false) end end) -- Pay for Pounded Aircrafts RegisterServerEvent('esx_advancedgarage:payAircraft') AddEventHandler('esx_advancedgarage:payAircraft', function() local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeMoney(Config.AircraftPoundPrice) TriggerClientEvent('esx:showNotification', source, _U('you_paid') .. Config.AircraftPoundPrice) TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mechanic', function(account) account.addMoney(Config.AircraftPoundPrice) end) end) -- Pay for Pounded Boats RegisterServerEvent('esx_advancedgarage:payBoat') AddEventHandler('esx_advancedgarage:payBoat', function() local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeMoney(Config.BoatPoundPrice) TriggerClientEvent('esx:showNotification', source, _U('you_paid') .. Config.BoatPoundPrice) TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mechanic', function(account) account.addMoney(Config.BoatPoundPrice) end) end) -- Pay for Pounded Cars RegisterServerEvent('esx_advancedgarage:payCar') AddEventHandler('esx_advancedgarage:payCar', function() local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeMoney(Config.CarPoundPrice) TriggerClientEvent('esx:showNotification', source, _U('you_paid') .. Config.CarPoundPrice) TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mechanic', function(account) account.addMoney(Config.CarPoundPrice) end) end) -- Pay for Pounded Policing RegisterServerEvent('esx_advancedgarage:payPolicing') AddEventHandler('esx_advancedgarage:payPolicing', function() local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeMoney(Config.PolicingPoundPrice) TriggerClientEvent('esx:showNotification', source, _U('you_paid') .. Config.PolicingPoundPrice) TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mechanic', function(account) account.addMoney(Config.PolicingPoundPrice) end) end) -- Pay for Pounded Ambulance RegisterServerEvent('esx_advancedgarage:payAmbulance') AddEventHandler('esx_advancedgarage:payAmbulance', function() local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeMoney(Config.AmbulancePoundPrice) TriggerClientEvent('esx:showNotification', source, _U('you_paid') .. Config.AmbulancePoundPrice) TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mechanic', function(account) account.addMoney(Config.AmbulancePoundPrice) end) end) -- Pay to Return Broken Vehicles RegisterServerEvent('esx_advancedgarage:payhealth') AddEventHandler('esx_advancedgarage:payhealth', function(price) local xPlayer = ESX.GetPlayerFromId(source) xPlayer.removeMoney(price) TriggerClientEvent('esx:showNotification', source, _U('you_paid') .. price) TriggerEvent('esx_addonaccount:getSharedAccount', 'society_mechanic', function(account) account.addMoney(price) end) end) -- Modify State of Vehicles --[[ RegisterServerEvent('esx_advancedgarage:setVehicleState') AddEventHandler('esx_advancedgarage:setVehicleState', function(plate, state) local xPlayer = ESX.GetPlayerFromId(source) MySQL.Async.execute('UPDATE owned_vehicles SET `stored` = @stored WHERE plate = @plate', { ['@stored'] = state, ['@plate'] = plate }, function(rowsChanged) if rowsChanged == 0 then print(('esx_advancedgarage: %s exploited the garage!'):format(xPlayer.identifier)) end end) end) --]] RegisterServerEvent('esx_advancedgarage:setVehicleState') AddEventHandler('esx_advancedgarage:setVehicleState', function(plate, state) local xPlayer = ESX.GetPlayerFromId(source) MySQL.Async.execute('UPDATE owned_vehicles SET `stored` = @stored WHERE plate = @plate', { ['@stored'] = state, ['@plate'] = plate }, function(rowsChanged) if rowsChanged == 0 then print(('esx_advancedgarage: %s exploited the garage!'):format(xPlayer.identifier)) end end) end) RegisterServerEvent('esx_advancedgarage:saveVehicleFuel') AddEventHandler('esx_advancedgarage:saveVehicleFuel', function(plate, fuelLevel) local xPlayer = ESX.GetPlayerFromId(source) MySQL.Async.execute('UPDATE owned_vehicles SET `fuel` = @fuel WHERE plate = @plate', { ['@fuel'] = fuelLevel, ['@plate'] = plate }, function(rowsChanged) if rowsChanged == 0 then print(('esx_advancedgarage: %s exploited the garage!'):format(xPlayer.identifier)) end end) end) RegisterServerEvent('esx_advancedgarage:setVehicleFuel') AddEventHandler('esx_advancedgarage:setVehicleFuel', function(plate, vehicle, estado) local source = source MySQL.Async.fetchAll('SELECT * FROM owned_vehicles WHERE plate = @plate', { ['@plate'] = plate }, function(result) --if result[1] then --print(result[1].fuel) local fuel = result[1].fuel if estado then --print(estado) GARAGE TriggerClientEvent( "setFuel", source, vehicle, plate, fuel ) else --print(estado) CORRAL TriggerClientEvent( "setFuel2", source, vehicle, plate, fuel ) end --end end) end)
Encontrar Diferença