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,23 +43,36 @@ 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 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
|
||||||
|
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)
|
MySQL.query("SELECT * FROM vehicle_keys WHERE plate = ? and owner = ?", {plate, pedid}, function(rs)
|
||||||
if 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 = ?", {keycounter, 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 "..keycounter.."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, keycounter}, 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 "..keycounter.."x Schlüssel bekommen.", "success")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
MySQL.query("UPDATE player_vehicles SET citizenid = ? WHERE plate = ?", {pedid, plate})
|
MySQL.query("UPDATE player_vehicles SET citizenid = ? WHERE plate = ?", {pedid, plate})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue