forked from Simnation/Main
Merge branch 'master' of https://git.evolution-state-life.de/Evolution-State-Life/Main
This commit is contained in:
commit
dec2a584df
1 changed files with 27 additions and 14 deletions
|
@ -43,24 +43,37 @@ AddEventHandler('mh_jobgarage:DeleteFromList', function(plate)
|
|||
local _source = source
|
||||
local Player = QBCore.Functions.GetPlayer(_source)
|
||||
local pedid = Player.PlayerData.citizenid
|
||||
local veh_opt = MySQL.query("SELECT * FROM mh_jobgarage WHERE plate = ?", {plate})
|
||||
|
||||
MySQL.query("SELECT * FROM vehicle_keys WHERE plate = ? and owner = ?", {plate, pedid}, function(rs)
|
||||
if rs[1] ~= nil then
|
||||
MySQL.query("UPDATE vehicle_keys SET count = count + ? WHERE plate = ? and owner = ?", {rs[1].count, plate, pedid},function(rowsChange)
|
||||
if rowsChange then
|
||||
TriggerClientEvent('mh_jobgarage:notify', _source, "Schlüsselkasten", "Du hast "..rs[1].count.."x Schlüssel bekommen.", "success")
|
||||
end
|
||||
end)
|
||||
local keycounter = nil
|
||||
MySQL.query("SELECT value FROM mh_jobgarage WHERE plate = ?", {plate}, function(rs)
|
||||
if rs ~= nil and rs[1] ~= nil then
|
||||
keycounter = rs[1].value
|
||||
else
|
||||
MySQL.query("INSERT INTO vehicle_keys(owner, plate, count) VALUES (?, ?, ?)", {pedid, plate, rs[1].count}, function(rowsChange)
|
||||
if rowsChange then
|
||||
TriggerClientEvent('mh_jobgarage:notify', _source, "Schlüsselkasten", "Du hast "..rs[1].count.."x Schlüssel bekommen.", "success")
|
||||
end
|
||||
end)
|
||||
keycounter = 0
|
||||
end
|
||||
end)
|
||||
|
||||
if keycounter == nil then
|
||||
TriggerClientEvent('mh_jobgarage:notify', _source, "Schlüsselkasten", "Fehler, versuche es Später erneut.", "inform")
|
||||
end
|
||||
|
||||
if keycounter ~= 0 then
|
||||
MySQL.query("SELECT * FROM vehicle_keys WHERE plate = ? and owner = ?", {plate, pedid}, function(rs)
|
||||
if rs ~= nil and rs[1] ~= nil then
|
||||
MySQL.query("UPDATE vehicle_keys SET count = count + ? WHERE plate = ? and owner = ?", {keycounter, plate, pedid},function(rowsChange)
|
||||
if rowsChange then
|
||||
TriggerClientEvent('mh_jobgarage:notify', _source, "Schlüsselkasten", "Du hast "..keycounter.."x Schlüssel bekommen.", "success")
|
||||
end
|
||||
end)
|
||||
else
|
||||
MySQL.query("INSERT INTO vehicle_keys(owner, plate, count) VALUES (?, ?, ?)", {pedid, plate, keycounter}, function(rowsChange)
|
||||
if rowsChange then
|
||||
TriggerClientEvent('mh_jobgarage:notify', _source, "Schlüsselkasten", "Du hast "..keycounter.."x Schlüssel bekommen.", "success")
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
MySQL.query("UPDATE player_vehicles SET citizenid = ? WHERE plate = ?", {pedid, plate})
|
||||
|
||||
MySQL.query("DELETE FROM mh_jobgarage WHERE plate = ?", {plate})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue