structura foldere

mutat kq- folders in un singur folder [kq]
This commit is contained in:
2026-03-30 01:55:03 +03:00
parent af1286d583
commit c291b81f26
2319 changed files with 0 additions and 14 deletions
@@ -0,0 +1,89 @@
if Config.Garage ~= 'RxGarages' then
return
end
local function getTableName()
return Config.Framework == 'qb' and 'player_vehicles' or 'owned_vehicles'
end
local function getOwnerField()
return Config.Framework == 'qb' and 'citizenid' or 'owner'
end
local function determineGarageName(vehicleData)
local garageName = vehicleData.location or vehicleData.in_shared
if not garageName then
if vehicleData.parked_at == 'garage' then
garageName = 'Garage'
elseif vehicleData.parked_at == 'outside' then
garageName = 'Outside'
elseif vehicleData.parked_at == 'impound' then
garageName = 'Impound'
elseif vehicleData.parked_at == 'shared' then
garageName = 'Shared Garage'
else
garageName = vehicleData.parked_at
end
end
return garageName
end
RegisterNetEvent('phone:setVehicleToOutSide', function(plate)
local str = ([[
UPDATE %s
SET parked_at = 'outside'
WHERE plate = ?
]]):format(getTableName())
MySQL.Sync.execute(str, { plate })
end)
function getGarageData(identifier, plate)
local tableName = getTableName()
local ownerField = getOwnerField()
local str = ([[
SELECT * FROM %s WHERE %s = ? AND (type = 'vehicle' OR type = 'car')
]]):format(tableName, ownerField)
if plate then
str = str .. ([[
AND plate = "%s"
]]):format(plate)
end
local result = MySQL.Sync.fetchAll(str, { identifier })
if not result[1] then return false end
local data = {}
for k, v in pairs(result) do
if Config.Framework ~= 'qb' then
local vehicle = json.decode(v.vehicle)
if not vehicle then return end
table.insert(data, {
name = vehicle.model,
plate = v.plate,
inGarage = v.parked_at == 'garage' or v.parked_at == 'shared',
fuel = vehicle.fuel or 1000,
engine = vehicle.engine or 1000,
body = vehicle.body or 1000,
vehicle = vehicle,
garage = determineGarageName(v),
})
else
table.insert(data, {
name = v.vehicle,
plate = v.plate,
inGarage = v.parked_at == 'garage' or v.parked_at == 'shared',
fuel = v.fuel or 1000,
engine = v.engine or 1000,
body = v.body or 1000,
vehicle = json.decode(v.mods),
garage = determineGarageName(v),
})
end
end
return data
end
@@ -0,0 +1,95 @@
if Config.Garage ~= 'cd_garage' then
return
end
RegisterNetEvent('phone:setVehicleToOutSide', function(plate)
local str = [[
UPDATE owned_vehicles
SET in_garage = 0
WHERE plate = ?
]]
if Config.Framework == 'qb' then
str = [[
UPDATE player_vehicles
SET state = 0
WHERE plate = ?
]]
end
MySQL.Sync.execute(str, { plate })
end)
function getGarageData(identifier, plate)
local str = [[
SELECT * FROM owned_vehicles WHERE owner = ? AND (type = 'vehicle' OR type = 'car')
]]
if Config.Framework == 'qb' then
str = [[
SELECT * FROM player_vehicles WHERE citizenid = ?
]]
end
if plate then
str = str .. ([[
AND plate = "%s"
]]):format(plate)
end
local result = MySQL.Sync.fetchAll(str, { identifier })
if not result[1] then return false end
local data = {}
if Config.Framework == 'qb' then
for k, v in pairs(result) do
local inGarage = v.in_garage
local garageId = v.garage_id
local impound = v.impound
if not inGarage and impound == 0 then
garageId = 'OUT'
end
if impound == 1 then
garageId = 'IMPOUND'
inGarage = false
end
table.insert(data, {
name = v.vehicle,
plate = v.plate,
inGarage = inGarage,
fuel = v.fuel or 1000,
engine = v.engine or 1000,
body = v.body or 1000,
vehicle = json.decode(v.mods),
garage = garageId,
})
end
else
for k, v in pairs(result) do
local vehicle = json.decode(v.vehicle)
if not vehicle then return end
local inGarage = v.in_garage
local garageId = v.garage_id
local impound = v.impound
if not inGarage and impound == 0 then
garageId = 'OUT'
end
if impound == 1 then
garageId = 'IMPOUND'
inGarage = false
end
table.insert(data, {
name = vehicle.model,
plate = v.plate,
inGarage = inGarage,
fuel = vehicle.fuel or 1000,
engine = vehicle.engine or 1000,
body = vehicle.body or 1000,
vehicle = json.decode(v.vehicle),
garage = garageId,
})
end
end
return data
end
@@ -0,0 +1,81 @@
if Config.Garage ~= 'codem-garage' then
return
end
RegisterNetEvent('phone:setVehicleToOutSide', function(plate)
local str = [[
UPDATE owned_vehicles
SET parking = '', stored = 0
WHERE plate = ?
]]
if Config.Framework == 'qb' then
str = [[
UPDATE player_vehicles
SET parking = 0
WHERE plate = ?
]]
end
MySQL.Sync.execute(str, { plate })
end)
function getGarageData(identifier, plate)
local str = [[
SELECT * FROM owned_vehicles WHERE owner = ? AND (type = 'vehicle' OR type = 'car')
]]
if Config.Framework == 'qb' then
str = [[
SELECT * FROM player_vehicles WHERE citizenid = ?
]]
end
if plate then
str = str .. ([[
AND plate = "%s"
]]):format(plate)
end
local result = MySQL.Sync.fetchAll(str, { identifier })
if not result[1] then return false end
local data = {}
if Config.Framework == 'qb' then
for k, v in pairs(result) do
local garageId = v.parking
local inGarage = v.stored == 1 or v.stored == 2
if v.stored == 0 then
garageId = 'OUT'
end
table.insert(data, {
name = v.vehicle,
plate = v.plate,
inGarage = v.stored,
fuel = v.fuel or 1000,
engine = v.engine or 1000,
body = v.body or 1000,
vehicle = json.decode(v.mods),
garage = garageId,
})
end
else
for k, v in pairs(result) do
local vehicle = json.decode(v.vehicle)
if not vehicle then return end
local inGarage = v.stored
local garageId = v.parking
if not inGarage then
garageId = 'OUT'
end
table.insert(data, {
name = vehicle.model,
plate = v.plate,
inGarage = v.stored,
fuel = vehicle.fuel or 1000,
engine = vehicle.engine or 1000,
body = vehicle.body or 1000,
vehicle = json.decode(v.vehicle),
garage = garageId,
})
end
end
return data
end
@@ -0,0 +1,79 @@
if Config.Garage ~= 'default' then
return
end
RegisterNetEvent('phone:setVehicleToOutSide', function(plate)
local str = [[
UPDATE owned_vehicles
SET garage = 'OUT', stored = 0
WHERE plate = ?
]]
if Config.Framework == 'qb' then
str = [[
UPDATE player_vehicles
SET state = 0
WHERE plate = ?
]]
end
MySQL.Sync.execute(str, { plate })
end)
function getGarageData(identifier, plate)
local str = [[
SELECT * FROM owned_vehicles WHERE owner = ? AND (type = 'vehicle' OR type = 'car')
]]
if Config.Framework == 'qb' then
str = [[
SELECT * FROM player_vehicles WHERE citizenid = ?
]]
end
if plate then
str = str .. ([[
AND plate = "%s"
]]):format(plate)
end
local result = MySQL.Sync.fetchAll(str, { identifier })
if not result[1] then return false end
local data = {}
if Config.Framework == 'qb' then
for k, v in pairs(result) do
local garageId = v.garage or v.parking
local inGarage = v.state == 1 or v.state == 2
if v.state == 0 then
garageId = 'OUT'
end
table.insert(data, {
name = v.vehicle,
plate = v.plate,
inGarage = inGarage,
fuel = v.fuel or 1000,
engine = v.engine or 1000,
body = v.body or 1000,
vehicle = json.decode(v.mods),
garage = garageId,
})
end
else
for k, v in pairs(result) do
local vehicle = json.decode(v.vehicle)
if not vehicle then return end
local inGarage = v.stored == 1
local garageId = v.garage or v.parking
table.insert(data, {
name = vehicle.model,
plate = v.plate,
inGarage = inGarage,
fuel = vehicle.fuel or 1000,
engine = vehicle.engine or 1000,
body = vehicle.body or 1000,
vehicle = json.decode(v.vehicle),
garage = garageId,
})
end
end
return data
end
@@ -0,0 +1,95 @@
if Config.Garage ~= 'jg-advancedgarages' then
return
end
RegisterNetEvent('phone:setVehicleToOutSide', function(plate)
local str = [[
UPDATE owned_vehicles
SET in_garage = 0
WHERE plate = ?
]]
if Config.Framework == 'qb' then
str = [[
UPDATE player_vehicles
SET in_garage = 0
WHERE plate = ?
]]
end
MySQL.Sync.execute(str, { plate })
end)
function getGarageData(identifier, plate)
local str = [[
SELECT * FROM owned_vehicles WHERE owner = ? AND (type = 'vehicle' OR type = 'car')
]]
if Config.Framework == 'qb' then
str = [[
SELECT * FROM player_vehicles WHERE citizenid = ?
]]
end
if plate then
str = str .. ([[
AND plate = "%s"
]]):format(plate)
end
local result = MySQL.Sync.fetchAll(str, { identifier })
if not result[1] then return false end
local data = {}
if Config.Framework == 'qb' then
for k, v in pairs(result) do
local inGarage = v.in_garage
local garageId = v.garage_id
local impound = v.impound
if not inGarage then
garageId = v.impound == 1 and 'IMPOUND' or 'OUT'
end
if impound == 1 then
garageId = v.garage_id
inGarage = false
end
table.insert(data, {
name = v.vehicle,
plate = v.plate,
inGarage = inGarage,
fuel = v.fuel * 10 or 1000,
engine = v.engine or 1000,
body = v.body or 1000,
vehicle = json.decode(v.mods),
garage = garageId,
})
end
else
for k, v in pairs(result) do
local vehicle = json.decode(v.vehicle)
if not vehicle then return end
local inGarage = v.in_garage
local garageId = v.garage_id
local impound = v.impound
if not inGarage then
garageId = 'OUT'
end
if impound == 1 then
garageId = v.impound == 1 and 'IMPOUND' or 'OUT'
inGarage = false
end
table.insert(data, {
name = vehicle.model,
plate = v.plate,
inGarage = inGarage,
fuel = v.fuel * 10 or 1000,
engine = vehicle.engine or 1000,
body = vehicle.body or 1000,
vehicle = json.decode(v.vehicle),
garage = garageId,
})
end
end
return data
end
@@ -0,0 +1,79 @@
if Config.Garage ~= 'loaf_garage' then
return
end
RegisterNetEvent('phone:setVehicleToOutSide', function(plate)
local str = [[
UPDATE owned_vehicles
SET garage = 'OUT', stored = 0
WHERE plate = ?
]]
if Config.Framework == 'qb' then
str = [[
UPDATE player_vehicles
SET state = 0
WHERE plate = ?
]]
end
MySQL.Sync.execute(str, { plate })
end)
function getGarageData(identifier, plate)
local str = [[
SELECT * FROM owned_vehicles WHERE owner = ? AND (type = 'vehicle' OR type = 'car')
]]
if Config.Framework == 'qb' then
str = [[
SELECT * FROM player_vehicles WHERE citizenid = ?
]]
end
if plate then
str = str .. ([[
AND plate = "%s"
]]):format(plate)
end
local result = MySQL.Sync.fetchAll(str, { identifier })
if not result[1] then return false end
local data = {}
if Config.Framework == 'qb' then
for k, v in pairs(result) do
local garageId = v.garage or v.parking
local inGarage = v.state == 1 or v.state == 2
if v.state == 0 then
garageId = 'OUT'
end
table.insert(data, {
name = v.vehicle,
plate = v.plate,
inGarage = inGarage,
fuel = v.fuel or 1000,
engine = v.engine or 1000,
body = v.body or 1000,
vehicle = json.decode(v.mods),
garage = garageId,
})
end
else
for k, v in pairs(result) do
local vehicle = json.decode(v.vehicle)
if not vehicle then return end
local inGarage = v.stored
local garageId = v.garage or v.parking
table.insert(data, {
name = vehicle.model,
plate = v.plate,
inGarage = inGarage,
fuel = vehicle.fuel or 1000,
engine = vehicle.engine or 1000,
body = vehicle.body or 1000,
vehicle = json.decode(v.vehicle),
garage = garageId,
})
end
end
return data
end
@@ -0,0 +1,84 @@
if Config.Garage ~= 'lunar_garage' then
return
end
RegisterNetEvent('phone:setVehicleToOutSide', function(plate)
local str = [[
UPDATE owned_vehicles
SET stored = 0
WHERE plate = ?
]]
if Config.Framework == 'qb' then
str = [[
UPDATE player_vehicles
SET stored = 0
WHERE plate = ?
]]
end
MySQL.Sync.execute(str, { plate })
end)
function getGarageData(identifier, plate)
local str = [[
SELECT * FROM owned_vehicles WHERE owner = ? AND type = 'car' and job is NULL
]]
if Config.Framework == 'qb' then
str = [[
SELECT * FROM player_vehicles WHERE citizenid = ? and (type = 'car' OR type = 'automobile') and job is NULL
]]
end
if plate then
str = str .. ([[
AND plate = "%s"
]]):format(plate)
end
local result = MySQL.Sync.fetchAll(str, { identifier })
if not result[1] then return false end
local data = {}
if Config.Framework == 'qb' then
for k, v in pairs(result) do
local garageId = 'OUT'
local inGarage = v.stored == 1 or v.stored == true
if inGarage then
garageId = 'IN'
end
table.insert(data, {
name = v.vehicle,
plate = v.plate,
inGarage = inGarage,
fuel = v.fuel or 1000,
engine = v.engine or 1000,
body = v.body or 1000,
vehicle = json.decode(v.mods),
garage = garageId,
})
end
else
for k, v in pairs(result) do
local vehicle = json.decode(v.vehicle)
if not vehicle then return end
local garageId = 'OUT'
local inGarage = v.stored == 1 or v.stored == true
if inGarage then
garageId = 'IN'
end
table.insert(data, {
name = vehicle.model,
plate = v.plate,
inGarage = inGarage,
fuel = vehicle.fuel or 1000,
engine = vehicle.engine or 1000,
body = vehicle.body or 1000,
vehicle = json.decode(v.vehicle),
garage = garageId,
})
end
end
return data
end
@@ -0,0 +1,93 @@
if Config.Garage ~= 'okokGarage' then
return
end
RegisterNetEvent('phone:setVehicleToOutSide', function(plate)
local str = [[
UPDATE owned_vehicles
SET parking = '', stored = 0
WHERE plate = ?
]]
if Config.Framework == 'qb' then
str = [[
UPDATE player_vehicles
SET state = 0
WHERE plate = ?
]]
end
MySQL.Sync.execute(str, { plate })
end)
function getGarageData(identifier, plate)
local str = [[
SELECT *, cast(`stored` as signed) as `stored` FROM owned_vehicles WHERE owner = ? AND (type = 'vehicle' OR type = 'car')
]]
if Config.Framework == 'qb' then
str = [[
SELECT *, cast(`state` as signed) as `state` FROM player_vehicles WHERE citizenid = ?
]]
end
if plate then
str = str .. ([[
AND plate = "%s"
]]):format(plate)
end
local result = MySQL.Sync.fetchAll(str, { identifier })
if not result[1] then return false end
local data = {}
if Config.Framework == 'qb' then
for k, v in pairs(result) do
if type(v.state) ~= 'number' then
v.state = tonumber(v.state)
end
local garageId = v.garage or v.parking
local inGarage = v.state == 1
if v.state == 0 then
garageId = 'OUT'
if tonumber(v.state) == 2 then
garageId = 'IMPOUNDED'
end
end
table.insert(data, {
name = v.vehicle,
plate = v.plate,
inGarage = inGarage,
fuel = v.fuel or 1000,
engine = v.engine or 1000,
body = v.body or 1000,
vehicle = json.decode(v.mods),
garage = garageId,
})
end
else
for k, v in pairs(result) do
local vehicle = json.decode(v.vehicle)
if not vehicle then return end
if type(v.stored) ~= 'number' then
v.stored = tonumber(v.stored)
end
local inGarage = v.stored == 1
local garageId = v.garage or v.parking
if not inGarage then
garageId = 'OUT'
if tonumber(v.stored) == 2 then
garageId = 'IMPOUNDED'
end
end
table.insert(data, {
name = vehicle.model,
plate = v.plate,
inGarage = inGarage,
fuel = vehicle.fuel or 1000,
engine = vehicle.engine or 1000,
body = vehicle.body or 1000,
vehicle = json.decode(v.vehicle),
garage = garageId,
})
end
end
return data
end
@@ -0,0 +1,120 @@
if Config.Garage ~= 'qs-advancedgarages' then
return
end
RegisterNetEvent('phone:setVehicleToOutSide', function(plate)
local str = [[
UPDATE owned_vehicles
SET garage = 'OUT', stored = 0
WHERE plate = ?
]]
if Config.Framework == 'qb' then
str = [[
UPDATE player_vehicles
SET garage = 'OUT', state = 0
WHERE plate = ?
]]
end
MySQL.Sync.execute(str, { plate })
end)
function getGarageData(identifier, plate)
local str = [[
SELECT * FROM owned_vehicles WHERE owner = ? AND (type = 'vehicle' OR type = 'car')
]]
if Config.Framework == 'qb' then
str = [[
SELECT * FROM player_vehicles WHERE citizenid = ?
]]
end
if plate then
str = str .. ([[
AND plate = "%s"
]]):format(plate)
end
local result = MySQL.Sync.fetchAll(str, { identifier })
if not result[1] then return false end
local data = {}
if Config.Framework == 'qb' then
local impoundGarages = exports['qs-advancedgarages']:getImpoundGarages()
for k, v in pairs(result) do
local inImpound = false
if impoundGarages and impoundGarages[v.garage] then
inImpound = true
end
local garageId = v.garage or v.parking
local inGarage = (v.state == 1 or v.state == 2) and not inImpound
if v.state == 0 then
garageId = 'OUT'
end
table.insert(data, {
name = v.vehicle,
plate = v.plate,
inGarage = inGarage,
fuel = v.fuel or 1000,
engine = v.engine or 1000,
body = v.body or 1000,
vehicle = json.decode(v.mods),
garage = garageId,
})
end
else
local impoundGarages = exports['qs-advancedgarages']:getImpoundGarages()
for k, v in pairs(result) do
local vehicle = json.decode(v.vehicle)
if not vehicle then return end
local inImpound = false
if impoundGarages and impoundGarages[v.garage] then
inImpound = true
end
local inGarage = true
local garageId = v.garage
print('garageId', garageId)
print('inImpound', inImpound)
if v.garage == 'OUT' or inImpound then
inGarage = false
end
print('inGarage', inGarage)
table.insert(data, {
name = vehicle.model,
plate = v.plate,
inGarage = inGarage,
fuel = vehicle.fuel or 1000,
engine = vehicle.engine or 1000,
body = vehicle.body or 1000,
vehicle = json.decode(v.vehicle),
garage = garageId,
})
end
end
return data
end
RegisterNetEvent('qs-smartphone-pro:addToPersistent', function(plate, netId)
local src = source
local identifier = GetIdentifier(src)
local str = ([[
SELECT 1 FROM %s WHERE plate = ? AND %s = ? AND jobVehicle = ? LIMIT 1
]]):format(garageTable, garageIdentifierColumn)
local result = MySQL.Sync.fetchAll(str,
{ plate, identifier, '' })
if not result[1] then
return Error(src, 'Tried to exploit qs-smartphone-pro:addToPersistent')
end
local response = exports['qs-advancedgarages']:setVehicleToPersistent(netId)
if not response then
Error(plate, 'Failed to add vehicle to persistent')
return
end
Debug(plate, 'Added vehicle to persistent')
end)
@@ -0,0 +1,135 @@
if Config.Garage ~= 'vms_garagesv2' then
return
end
RegisterNetEvent('phone:setVehicleToOutSide', function(plate)
local plate = plate
local queryVehicleData = 'SELECT garage, garageSpotID FROM owned_vehicles WHERE plate = ? AND impound_data IS NULL AND impound_date IS NULL'
if Config.Framework == 'qb' then
queryVehicleData = 'SELECT garage, garageSpotID FROM player_vehicles WHERE plate = ? AND impound_data IS NULL AND impound_date IS NULL'
end
local vehicleData = MySQL.query.await(queryVehicleData, { plate })
if vehicleData and vehicleData[1] then
TriggerEvent('vms_garagesv2:vehicleTakenByPhone', vehicleData[1].garage, vehicleData[1].garageSpotID)
end
Citizen.CreateThread(function()
Citizen.Wait(3000)
local foundNetId = nil
local allVehicles = GetAllVehicles()
for i = 1, #allVehicles do
if DoesEntityExist(allVehicles[i]) then
local vehPlate = GetVehicleNumberPlateText(allVehicles[i])
local cleanedPlate = vehPlate:match('^%s*(.-)%s*$')
if cleanedPlate == plate then
foundNetId = NetworkGetNetworkIdFromEntity(allVehicles[i])
break
end
end
end
local str = [[
UPDATE owned_vehicles
SET garage = NULL, garageSpotID = NULL
]]
if Config.Framework == 'qb' then
str = [[
UPDATE player_vehicles
SET garage = NULL, garageSpotID = NULL
]]
end
if foundNetId then
str = str .. ', netid = ? WHERE plate = ?'
MySQL.Sync.execute(str, { foundNetId, plate })
else
str = str .. ' WHERE plate = ?'
MySQL.Sync.execute(str, { plate })
end
end)
end)
function getGarageData(identifier, plate)
local str = [[
SELECT * FROM owned_vehicles WHERE owner = ? AND (type = 'vehicle' OR type = 'car') AND impound_data IS NULL AND impound_date IS NULL
]]
if Config.Framework == 'qb' then
str = [[
SELECT * FROM player_vehicles WHERE citizenid = ? AND (type = 'vehicle' OR type = 'car' OR type = 'automobile') AND impound_data IS NULL AND impound_date IS NULL
]]
end
if plate then
str = str .. ([[
AND plate = "%s"
]]):format(plate)
end
print(str)
local result = MySQL.Sync.fetchAll(str, { identifier })
if not result[1] then
return false
end
local data = {}
if Config.Framework == 'qb' then
for k, v in pairs(result) do
local mods = json.decode(v.mods)
if not mods then
return
end
local inGarage = false
local garageId = 'OUT'
if v.garage then
local label, coords = exports['vms_garagesv2']:getGarageInfo(v.garage)
inGarage = true
garageId = label
elseif v.impound then
garageId = 'IMPOUND'
end
table.insert(data, {
name = mods.model,
plate = v.plate,
inGarage = inGarage,
fuel = mods.fuel or 1000,
engine = mods.engine or 1000,
body = mods.body or 1000,
vehicle = mods,
garage = garageId,
})
end
else
for k, v in pairs(result) do
local vehicle = json.decode(v.vehicle)
if not vehicle then
return
end
local inGarage = false
local garageId = 'OUT'
print(v.garage)
if v.garage then
local label, coords = exports['vms_garagesv2']:getGarageInfo(v.garage)
inGarage = true
garageId = label
elseif v.impound then
garageId = 'IMPOUND'
end
table.insert(data, {
name = vehicle.model,
plate = v.plate,
inGarage = inGarage,
fuel = vehicle.fuel or 1000,
engine = vehicle.engine or 1000,
body = vehicle.body or 1000,
vehicle = vehicle,
garage = garageId,
})
end
end
return data
end