forked from Simnation/Main
Update server.lua
This commit is contained in:
parent
a700576bb0
commit
8aacce219b
1 changed files with 5 additions and 20 deletions
|
@ -3,27 +3,12 @@ local test_vari = {}
|
||||||
|
|
||||||
RegisterServerEvent('mh_garage:setMods')
|
RegisterServerEvent('mh_garage:setMods')
|
||||||
AddEventHandler('mh_garage:setMods', function(mods)
|
AddEventHandler('mh_garage:setMods', function(mods)
|
||||||
if test_vari then
|
print(mods.plate)
|
||||||
for k, v in pairs(test_vari) do
|
if test_vari[mods.plate] = true then
|
||||||
if v.plate ~= mods.plate then
|
Print("Fahrzeug hat bereits ein Eintrag")
|
||||||
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
|
|
||||||
else
|
else
|
||||||
MySQL.query("SELECT * FROM player_vehicles WHERE plate = ?", {mods.plate}, function(rs)
|
MySQL.query("SELECT mods FROM player_vehicles WHERE plate = ?", {mods.plate}, function(rs)
|
||||||
print("3: "..json.encode(rs))
|
print(json.encode(rs[1]))
|
||||||
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
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue