Update server.lua

This commit is contained in:
Miho931 2025-06-09 17:31:06 +02:00
parent a700576bb0
commit 8aacce219b

View file

@ -3,27 +3,12 @@ local test_vari = {}
RegisterServerEvent('mh_garage:setMods')
AddEventHandler('mh_garage:setMods', function(mods)
if test_vari then
for k, v in pairs(test_vari) do
if v.plate ~= mods.plate then
MySQL.query("SELECT * FROM player_vehicles WHERE plate = ?", {mods.plate}, function(rs)
print("1: "..json.encode(rs))
if rs[1].mods == nil then
MySQL.query("UPDATE player_vehicles SET mods = ? WHERE plate = ?", {mods, mods.plate})
table.insert(test_vari, {plate = mods.plate})
print("2: ")
end
end)
end
end
print(mods.plate)
if test_vari[mods.plate] = true then
Print("Fahrzeug hat bereits ein Eintrag")
else
MySQL.query("SELECT * FROM player_vehicles WHERE plate = ?", {mods.plate}, function(rs)
print("3: "..json.encode(rs))
if rs[1].mods == nil then
MySQL.query("UPDATE player_vehicles SET mods = ? WHERE plate = ?", {mods, mods.plate})
table.insert(test_vari, {plate = mods.plate})
print("4")
end
MySQL.query("SELECT mods FROM player_vehicles WHERE plate = ?", {mods.plate}, function(rs)
print(json.encode(rs[1]))
end)
end
end)