forked from Simnation/Main
resources/[jobs]/[civ]/mh_jobgarage/server/server.lua aktualisiert
This commit is contained in:
parent
89bb935685
commit
631e808a91
1 changed files with 6 additions and 5 deletions
|
@ -43,19 +43,20 @@ AddEventHandler('mh_jobgarage:DeleteFromList', function(plate)
|
||||||
local _source = source
|
local _source = source
|
||||||
local Player = QBCore.Functions.GetPlayer(_source)
|
local Player = QBCore.Functions.GetPlayer(_source)
|
||||||
local pedid = Player.PlayerData.citizenid
|
local pedid = Player.PlayerData.citizenid
|
||||||
local veh_opt = MySQL.query("SELECT * FROM mh_jobgarage WHERE plate = ?", {plate})
|
local veh_optt = MySQL.query("SELECT * FROM mh_jobgarage WHERE plate = ?", {plate})
|
||||||
|
local veh_opt = json.encode(veh_optt)
|
||||||
|
|
||||||
MySQL.query("SELECT * FROM vehicle_keys WHERE plate = ? and owner = ?", {plate, pedid}, function(rs)
|
MySQL.query("SELECT * FROM vehicle_keys WHERE plate = ? and owner = ?", {plate, pedid}, function(rs)
|
||||||
if rs ~= nil and rs[1] ~= nil then
|
if rs ~= nil and rs[1] ~= nil then
|
||||||
MySQL.query("UPDATE vehicle_keys SET count = count + ? WHERE plate = ? and owner = ?", {rs[1].count, plate, pedid},function(rowsChange)
|
MySQL.query("UPDATE vehicle_keys SET count = count + ? WHERE plate = ? and owner = ?", {veh_opt.count, plate, pedid},function(rowsChange)
|
||||||
if rowsChange then
|
if rowsChange then
|
||||||
TriggerClientEvent('mh_jobgarage:notify', _source, "Schlüsselkasten", "Du hast "..rs[1].count.."x Schlüssel bekommen.", "success")
|
TriggerClientEvent('mh_jobgarage:notify', _source, "Schlüsselkasten", "Du hast "..veh_opt.count.."x Schlüssel bekommen.", "success")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
MySQL.query("INSERT INTO vehicle_keys(owner, plate, count) VALUES (?, ?, ?)", {pedid, plate, rs[1].count}, function(rowsChange)
|
MySQL.query("INSERT INTO vehicle_keys(owner, plate, count) VALUES (?, ?, ?)", {pedid, plate, veh_opt.count}, function(rowsChange)
|
||||||
if rowsChange then
|
if rowsChange then
|
||||||
TriggerClientEvent('mh_jobgarage:notify', _source, "Schlüsselkasten", "Du hast "..rs[1].count.."x Schlüssel bekommen.", "success")
|
TriggerClientEvent('mh_jobgarage:notify', _source, "Schlüsselkasten", "Du hast "..veh_opt.count.."x Schlüssel bekommen.", "success")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue