shisha
This commit is contained in:
parent
1f3154bce7
commit
873f9b15f7
10 changed files with 316 additions and 104 deletions
38
resources/[inventory]/nordi_hookah/server.lua
Normal file
38
resources/[inventory]/nordi_hookah/server.lua
Normal file
|
@ -0,0 +1,38 @@
|
|||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
-- Debug Print Funktion
|
||||
local function Debug(msg)
|
||||
print("^2[Shisha Debug] ^7" .. msg)
|
||||
end
|
||||
|
||||
RegisterNetEvent('shisha-script:consumeTobacco')
|
||||
AddEventHandler('shisha-script:consumeTobacco', function(requirements)
|
||||
Debug("Consume tobacco event triggered")
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
|
||||
if Player then
|
||||
-- Überprüfe nochmal die Zutaten
|
||||
local hasAllItems = true
|
||||
for _, requirement in ipairs(requirements) do
|
||||
if not Player.Functions.HasItem(requirement.item, requirement.amount) then
|
||||
hasAllItems = false
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if hasAllItems then
|
||||
Debug("Player has all required items")
|
||||
-- Entferne die benötigten Items
|
||||
for _, requirement in ipairs(requirements) do
|
||||
Player.Functions.RemoveItem(requirement.item, requirement.amount)
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[requirement.item], "remove")
|
||||
end
|
||||
|
||||
TriggerClientEvent('QBCore:Notify', src, "Du hast die Shisha vorbereitet!", "success")
|
||||
else
|
||||
Debug("Player missing required items")
|
||||
TriggerClientEvent('QBCore:Notify', src, "Du hast nicht alle benötigten Zutaten!", "error")
|
||||
end
|
||||
end
|
||||
end)
|
Loading…
Add table
Add a link
Reference in a new issue