forked from Simnation/Main
[GARAGE] Fill Mods
This commit is contained in:
parent
0a9cc08fc8
commit
4a0c8c282e
2 changed files with 38 additions and 0 deletions
|
@ -11,6 +11,20 @@ Citizen.CreateThread(function()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Citizen.CreateThread(function()
|
||||||
|
while true do
|
||||||
|
Wait(5000)
|
||||||
|
local ped = PlayerPedId()
|
||||||
|
|
||||||
|
if PedIsInAnyVehicle(ped) then
|
||||||
|
local veh = GetVehiclePedIsUsing(ped)
|
||||||
|
local mods = QBCore.Functions.GetVehicleProperties(vehicle)
|
||||||
|
|
||||||
|
TriggerServerEvent('mh_garage:setMods', mods)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
-- Funktion zum Spawnen des NPCs
|
-- Funktion zum Spawnen des NPCs
|
||||||
function SpawnGuardNPC(npc)
|
function SpawnGuardNPC(npc)
|
||||||
-- Ped Model laden
|
-- Ped Model laden
|
||||||
|
|
|
@ -1,4 +1,28 @@
|
||||||
QBCore = exports['qb-core']:GetCoreObject()
|
QBCore = exports['qb-core']:GetCoreObject()
|
||||||
|
local test_vari = {}
|
||||||
|
|
||||||
|
RegisterServerEvent('mh_garage:setMods')
|
||||||
|
AddEventHandler('mh_garage:setMods', function(mods)
|
||||||
|
if test_vari ~= nil 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)
|
||||||
|
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})
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
MySQL.query("SELECT * FROM player_vehicles WHERE plate = ?", {mods.plate}, function(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})
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
QBCore.Functions.CreateCallback('mh_garage:storedVehicle', function(source, cb, veh, zone)
|
QBCore.Functions.CreateCallback('mh_garage:storedVehicle', function(source, cb, veh, zone)
|
||||||
local Player = QBCore.Functions.GetPlayer(source)
|
local Player = QBCore.Functions.GetPlayer(source)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue