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')
|
||||
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue