diff --git a/resources/[inventory]/cs_shops/config/config.lua b/resources/[inventory]/cs_shops/config/config.lua index dec1c076b..26fe3840b 100644 --- a/resources/[inventory]/cs_shops/config/config.lua +++ b/resources/[inventory]/cs_shops/config/config.lua @@ -2648,7 +2648,7 @@ CodeStudio.Shops = { }, Locations = { - vector4(392.7830, -831.9004, 28.2917, 244.7296), + vector4(-504.6979, 283.2023, 82.2940, 51.1149), }, Interaction = { diff --git a/resources/[inventory]/nordi_hookah/client/main.lua b/resources/[inventory]/nordi_hookah/client/main.lua new file mode 100644 index 000000000..a48794282 --- /dev/null +++ b/resources/[inventory]/nordi_hookah/client/main.lua @@ -0,0 +1,91 @@ +local Config = { + HookahProp = 'prop_bong_01', -- Eigenes Prop (ohne .ydr/.ytd) + TobaccoItem = 'shisha_tobacco', + Keybind = 'E', + Animation = { + dict = 'anim@amb@clubhouse@table@male@smoking@base', + anim = 'base', + prop = 'v_corp_lngestoolfd', + flag = 49, + bone = 57005 + }, + SmokeEffect = { + name = 'ent_anim_cig_exhale_mth', + scale = 0.2 + }, + UseDuration = 30 -- Sekunden +} + +local isSmoking = false +local smokeEffect = nil + +-- Preload Assets +CreateThread(function() + RequestModel(Config.HookahProp) + RequestAnimDict(Config.Animation.dict) + while not HasModelLoaded(Config.HookahProp) or not HasAnimDictLoaded(Config.Animation.dict) do + Wait(0) + end +end) + +-- Hookah Placement Logic +RegisterCommand('placehookah', function() + if isSmoking then return end + + local playerPed = PlayerPedId() + local coords = GetOffsetFromEntityInWorldCoords(playerPed, 0.0, 0.8, -0.4) + local heading = GetEntityHeading(playerPed) + + local hookah = CreateObject(Config.HookahProp, coords.x, coords.y, coords.z, true, true, true) + PlaceObjectOnGroundProperly(hookah) + SetEntityHeading(hookah, heading) + FreezeEntityPosition(hookah, true) + + exports['qb-target']:AddTargetEntity(hookah, { + options = { + { + type = 'client', + event = 'qb-hookah:startSmoking', + icon = 'fas fa-smoking', + label = 'Smoke Hookah', + targeticon = 'fas fa-eye', + item = Config.TobaccoItem + } + }, + distance = 2.5 + }) +end, false) + +-- Smoking Logic +RegisterNetEvent('qb-hookah:startSmoking', function(entity) + if isSmoking then return end + + QBCore.Functions.TriggerCallback('qb-hookah:removeTobacco', function(success) + if not success then + QBCore.Functions.Notify('You need hookah tobacco!', 'error') + return + end + + isSmoking = true + local playerPed = PlayerPedId() + local animDict = Config.Animation.dict + + -- Attach bong prop + local bong = CreateObject(Config.Animation.prop, GetEntityCoords(playerPed), true, true, true) + AttachEntityToEntity(bong, playerPed, Config.Animation.bone, 0.12, 0.018, -0.01, -80.0, -20.0, 180.0, true, true, false, true, 1, true) + + -- Play animation + TaskPlayAnim(playerPed, animDict, Config.Animation.anim, 8.0, -8.0, Config.UseDuration * 1000, Config.Animation.flag, 0, false, false, false) + + -- Smoke effect + UseParticleFxAssetNextCall('core') + smokeEffect = StartParticleFxLoopedOnEntityBone(Config.SmokeEffect.name, playerPed, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, GetPedBoneIndex(playerPed, 47419), Config.SmokeEffect.scale, 0.0, 0.0, 0.0) + + -- Auto stop + Wait(Config.UseDuration * 1000) + DeleteObject(bong) + StopParticleFxLooped(smokeEffect, 0) + ClearPedTasks(playerPed) + isSmoking = false + end) +end) diff --git a/resources/[inventory]/nordi_hookah/fxmanifest.lua b/resources/[inventory]/nordi_hookah/fxmanifest.lua new file mode 100644 index 000000000..133a7c7c4 --- /dev/null +++ b/resources/[inventory]/nordi_hookah/fxmanifest.lua @@ -0,0 +1,23 @@ +fx_version 'cerulean' +game 'gta5' + +name 'qb-hookah' +description 'Hookah Smoking System' +version '1.0.0' + +shared_script '@qb-core/import.lua' + +client_scripts { + '@qb-target/client.lua', + '@ox_lib/init.lua', + 'client/main.lua' +} + +server_script 'server/main.lua' + +files { + 'stream/props.ytyp', + 'stream/hookah_prop.*' +} + +data_file 'DLC_ITYP_REQUEST' 'stream/props.ytyp' diff --git a/resources/[inventory]/nordi_hookah/server/main.lua b/resources/[inventory]/nordi_hookah/server/main.lua new file mode 100644 index 000000000..b6da6edf8 --- /dev/null +++ b/resources/[inventory]/nordi_hookah/server/main.lua @@ -0,0 +1,13 @@ +QBCore = exports['qb-core']:GetCoreObject() + +QBCore.Functions.CreateCallback('qb-hookah:removeTobacco', function(source, cb) + local Player = QBCore.Functions.GetPlayer(source) + if not Player then return cb(false) end + + if Player.Functions.RemoveItem('shisha_tobacco', 1) then + TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items['shisha_tobacco'], "remove") + cb(true) + else + cb(false) + end +end) diff --git a/resources/[inventory]/nordi_hookah/stream/prop_bong_01.ydr b/resources/[inventory]/nordi_hookah/stream/prop_bong_01.ydr new file mode 100644 index 000000000..acdaf674c Binary files /dev/null and b/resources/[inventory]/nordi_hookah/stream/prop_bong_01.ydr differ diff --git a/resources/[inventory]/nordi_hookah/stream/props.ytyp b/resources/[inventory]/nordi_hookah/stream/props.ytyp new file mode 100644 index 000000000..aee427ae8 --- /dev/null +++ b/resources/[inventory]/nordi_hookah/stream/props.ytyp @@ -0,0 +1,18 @@ + + + + + + + + + prop_bong_01 + prop_x17_res_01 + + + + + + + + diff --git a/resources/[inventory]/nordi_hookah/stream/v_corp_lngestoolfd.ydr b/resources/[inventory]/nordi_hookah/stream/v_corp_lngestoolfd.ydr new file mode 100644 index 000000000..5240bed6c Binary files /dev/null and b/resources/[inventory]/nordi_hookah/stream/v_corp_lngestoolfd.ydr differ