Diff
checker
텍스트
텍스트
이미지
문서
Excel
폴더
Legal
Enterprise
데스크톱
요금제
로그인
데스크톱 앱 다운로드
텍스트 비교
두 텍스트 파일의 차이점을 찾아보세요
도구
기록
표시
레이아웃
나란히 보기
합쳐 보기
실시간 편집
공백 변경 숨기기
변경 없는 행 숨기기
줄바꿈 비활성화
비교 단위
스마트
구문
없음
모양 변경
처리
제외
텍스트 변환
첫 변경으로
수정
Diffchecker Desktop
가장 안전하게 Diffchecker를 사용하는 방법. 데스크톱 앱을 사용하면 비교 데이터가 외부로 전송되지 않습니다!
데스크톱 앱 받기
AdvancedGarage Server
생성일
7년 전
비교 결과 만료 없음
초기화
내보내기
공유
설명
0 삭제
행
총
삭제
글자
총
삭제
이 기능을 계속 사용하려면 업그레이드해 주세요
Diff
checker
Pro
요금제 보기
403 행
복사
51 추가
행
총
추가
글자
총
추가
이 기능을 계속 사용하려면 업그레이드해 주세요
Diff
checker
Pro
요금제 보기
454 행
복사
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
저장된 비교 결과
원본
파일 열기
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)
수정본
파일 열기
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)
비교하기