Garage
Script
Status
function saveVIPVehicleToDB(xPlayer, plate, model, color)
local hash = GetHashKey(model)
if Config.Framework == "esx" then
local identifier = xPlayer.getIdentifier()
local baseVehicle = {
model = hash,
plate = plate,
fuelLevel = 100,
engineHealth = 1000,
bodyHealth = 1000,
color1 = { r = color[1], g = color[2], b = color[3] },
color2 = { r = color[1], g = color[2], b = color[3] }
}
if Config.GarajeSystem == "esx-default" or Config.GarajeSystem == "" then
exports.oxmysql:insert(
'INSERT INTO owned_vehicles (owner, plate, vehicle, type, stored) VALUES (?, ?, ?, ?, ?)',
{ identifier, plate, json.encode(baseVehicle), 'car', 1 }
)
return
end
if Config.GarajeSystem == "cd_garage" then
exports.oxmysql:insert([[
INSERT INTO owned_vehicles
(owner, plate, vehicle, type, stored, in_garage, garage_id, garage_type, impound, adv_stats)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
]],
{
identifier,
plate,
json.encode(baseVehicle),
"car",
1,
1,
"A",
"car",
0,
json.encode({
plate = plate,
mileage = 0.0,
maxhealth = 1000.0
})
})
return
end
if Config.GarajeSystem == "lunar_garaje" then
exports.oxmysql:insert(
'INSERT INTO owned_vehicles (owner, plate, vehicle, type, stored) VALUES (?, ?, ?, ?, ?)',
{ identifier, plate, json.encode(baseVehicle), 'car', 1 }
)
return
end
if Config.GarajeSystem == "qs-garage" then
exports.oxmysql:insert([[
INSERT INTO owned_vehicles
(owner, plate, vehicle, type, garage, stored)
VALUES (?, ?, ?, ?, ?, ?)
]],
{
identifier,
plate,
json.encode(baseVehicle),
"vehicle",
"pillboxgarage",
1
})
return
end
if Config.GarajeSystem == "jg-advancedgarages" then
exports.oxmysql:insert([[
INSERT INTO owned_vehicles
(owner, plate, vehicle, garage, stored, impounded, mileage)
VALUES (?, ?, ?, ?, ?, ?, ?)
]],
{
identifier,
plate,
json.encode(baseVehicle),
"pillboxgarage",
1,
0,
0
})
return
end
end
if Config.Framework ~= "qb" then return end
local src = xPlayer.PlayerData.source
local citizenid = xPlayer.PlayerData.citizenid
local license = QBCore.Functions.GetIdentifier(src, "license")
local qbMods = {
model = hash,
plate = plate,
fuelLevel = 100,
engineHealth = 1000,
bodyHealth = 1000,
color1 = color[1],
color2 = color[2]
}
if Config.GarajeSystem == "qb-garages" or Config.GarajeSystem == "" then
exports.oxmysql:insert([[
INSERT INTO player_vehicles
(license, citizenid, vehicle, hash, mods, plate, garage, fuel, engine, body, state)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
]],
{
license, citizenid, model, tostring(hash),
json.encode(qbMods), plate,
"pillboxgarage", 100, 1000, 1000, 1
})
return
end
if Config.GarajeSystem == "cd_garage" then
exports.oxmysql:insert([[
INSERT INTO player_vehicles
(license, citizenid, vehicle, hash, mods, plate,
state, in_garage, garage_id, garage_type, impound, adv_stats)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
]],
{
license,
citizenid,
model,
tostring(hash),
json.encode(qbMods),
plate,
1,
1,
"A",
"car",
0,
json.encode({
plate = plate,
mileage = 0.0,
maxhealth = 1000.0
})
})
return
end
if Config.GarajeSystem == "lunar_garaje" then
exports.oxmysql:insert([[
INSERT INTO player_vehicles
(license, citizenid, vehicle, hash, mods, plate, garage, fuel, engine, body, state, type, stored)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
]],
{
license, citizenid, model, tostring(hash),
json.encode(qbMods), plate,
"lunar_garaje", 100, 1000, 1000, 1, "car", 1
})
return
end
if Config.GarajeSystem == "qs-garage" then
exports.oxmysql:insert([[
INSERT INTO player_vehicles
(license, citizenid, vehicle, hash, mods, plate,
garage, state, stored, type)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
]],
{
license,
citizenid,
model,
tostring(hash),
json.encode(qbMods),
plate,
"pillboxgarage",
1,
1,
"vehicle"
})
return
end
if Config.GarajeSystem == "jg-advancedgarages" then
exports.oxmysql:insert([[
INSERT INTO player_vehicles
(license, citizenid, vehicle, hash, mods, plate,
garage, state, in_garage, impound, mileage)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
]],
{
license,
citizenid,
model,
tostring(hash),
json.encode(qbMods),
plate,
"pillboxgarage",
1,
1,
0,
0
})
return
end
endLast updated