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,11 +8,21 @@ AddEventHandler('mh_garage:setMods', function(mods)
|
|||
print("Fahrzeug hat bereits ein Eintrag")
|
||||
else
|
||||
MySQL.query("SELECT mods FROM player_vehicles WHERE plate = ?", {mods.plate}, function(rs)
|
||||
if next(rs[1].mods) == nil then
|
||||
MySQL.query("UPDATE player_vehicles SET mods = ? WHERE plate = ?", {mods.plate})
|
||||
test_vari[mods.plate] = true
|
||||
-- Prüfen ob rs überhaupt Daten enthält
|
||||
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
|
||||
else
|
||||
test_vari[mods.plate] = true
|
||||
end
|
||||
else
|
||||
test_vari[mods.plate] = true
|
||||
-- Keine Ergebnisse gefunden
|
||||
print("Keine Daten für Kennzeichen " .. mods.plate .. " gefunden")
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue