forked from Simnation/Main
Update server.lua
This commit is contained in:
parent
21750cd1fd
commit
e80c3e0e75
1 changed files with 14 additions and 4 deletions
|
@ -8,12 +8,22 @@ AddEventHandler('mh_garage:setMods', function(mods)
|
||||||
print("Fahrzeug hat bereits ein Eintrag")
|
print("Fahrzeug hat bereits ein Eintrag")
|
||||||
else
|
else
|
||||||
MySQL.query("SELECT mods FROM player_vehicles WHERE plate = ?", {mods.plate}, function(rs)
|
MySQL.query("SELECT mods FROM player_vehicles WHERE plate = ?", {mods.plate}, function(rs)
|
||||||
if next(rs[1].mods) == nil then
|
-- Prüfen ob rs überhaupt Daten enthält
|
||||||
MySQL.query("UPDATE player_vehicles SET mods = ? WHERE plate = ?", {mods.plate})
|
if rs and rs[1] then
|
||||||
|
-- Wenn mods ein String ist, konvertieren wir es zu einem Table
|
||||||
|
local modsData = type(rs[1].mods) == "string" and json.decode(rs[1].mods) or rs[1].mods
|
||||||
|
|
||||||
|
if not modsData or next(modsData) == nil then
|
||||||
|
-- Hier sollten Sie wahrscheinlich auch die mods-Daten übergeben, nicht nur plate
|
||||||
|
MySQL.query("UPDATE player_vehicles SET mods = ? WHERE plate = ?", {json.encode(mods), mods.plate})
|
||||||
test_vari[mods.plate] = true
|
test_vari[mods.plate] = true
|
||||||
else
|
else
|
||||||
test_vari[mods.plate] = true
|
test_vari[mods.plate] = true
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
-- Keine Ergebnisse gefunden
|
||||||
|
print("Keine Daten für Kennzeichen " .. mods.plate .. " gefunden")
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue