forked from Simnation/Main
GARAGE
This commit is contained in:
parent
449faaa020
commit
5dcd987ab7
2 changed files with 5 additions and 1 deletions
|
@ -19,7 +19,7 @@ Citizen.CreateThread(function()
|
||||||
if IsPedInAnyVehicle(ped, false) then
|
if IsPedInAnyVehicle(ped, false) then
|
||||||
local veh = GetVehiclePedIsUsing(ped)
|
local veh = GetVehiclePedIsUsing(ped)
|
||||||
local mods = QBCore.Functions.GetVehicleProperties(vehicle)
|
local mods = QBCore.Functions.GetVehicleProperties(vehicle)
|
||||||
|
print("Triggert setMods")
|
||||||
TriggerServerEvent('mh_garage:setMods', mods)
|
TriggerServerEvent('mh_garage:setMods', mods)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,18 +7,22 @@ AddEventHandler('mh_garage:setMods', function(mods)
|
||||||
for k, v in pairs(test_vari) do
|
for k, v in pairs(test_vari) do
|
||||||
if v.plate ~= mods.plate then
|
if v.plate ~= mods.plate then
|
||||||
MySQL.query("SELECT * FROM player_vehicles WHERE plate = ?", {mods.plate}, function(rs)
|
MySQL.query("SELECT * FROM player_vehicles WHERE plate = ?", {mods.plate}, function(rs)
|
||||||
|
print("1: "..json.encode(rs))
|
||||||
if rs[1].mods == nil then
|
if rs[1].mods == nil then
|
||||||
MySQL.query("UPDATE player_vehicles SET mods = ? WHERE plate = ?", {mods, mods.plate})
|
MySQL.query("UPDATE player_vehicles SET mods = ? WHERE plate = ?", {mods, mods.plate})
|
||||||
table.insert(test_vari, {plate = mods.plate})
|
table.insert(test_vari, {plate = mods.plate})
|
||||||
|
print("2: ")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
MySQL.query("SELECT * FROM player_vehicles WHERE plate = ?", {mods.plate}, function(rs)
|
MySQL.query("SELECT * FROM player_vehicles WHERE plate = ?", {mods.plate}, function(rs)
|
||||||
|
print("3: "..json.encode(rs))
|
||||||
if rs[1].mods == nil then
|
if rs[1].mods == nil then
|
||||||
MySQL.query("UPDATE player_vehicles SET mods = ? WHERE plate = ?", {mods, mods.plate})
|
MySQL.query("UPDATE player_vehicles SET mods = ? WHERE plate = ?", {mods, mods.plate})
|
||||||
table.insert(test_vari, {plate = mods.plate})
|
table.insert(test_vari, {plate = mods.plate})
|
||||||
|
print("4")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue