1
0
Fork 0
forked from Simnation/Main
Main/resources/[inventory]/shisha/client.lua
2025-08-13 23:19:51 +02:00

238 lines
7.9 KiB
Lua

local QBCore = exports['qb-core']:GetCoreObject()
local Keys = {
["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
}
local shisha = {4037417364}
local shishaHasStarted = false
local distX, distY, distZ = 0, 0, 0
local buyad = false
local sessionStarted = false
local endCallback = false
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local ped = PlayerPedId()
local pos = GetEntityCoords(ped)
for i = 1, #shisha do
local closestShisha = GetClosestObjectOfType(pos.x, pos.y, pos.z, 1.0, shisha[i], false, false, false)
local shishaPos = GetEntityCoords(closestShisha)
local dist = #(pos - shishaPos)
if dist < 3.5 then
local loc = vector3(shishaPos.x, shishaPos.y, shishaPos.z)
if not buyad then
DrawText3D(vector3(shishaPos.x, shishaPos.y, shishaPos.z+1), "[~y~E~w~] Shisha Rauchen", 0.7)
end
-- Start Session
if not sessionStarted then
if IsControlJustReleased(0, 38) then
buyad = true
sessionStarted = true
endCallback = true
ShishaFunctions()
TriggerEvent("chema_shisha:anim")
local playerPed = GetPlayerPed(-1)
local coords = GetEntityCoords(playerPed)
local x,y,z = table.unpack(GetEntityCoords(ped))
local prop_name = "v_corp_lngestoolfd"
VapeMod = CreateObject(GetHashKey(prop_name), x, y, z+0.2, true, true, true)
AttachEntityToEntity(VapeMod, ped, GetPedBoneIndex(ped, 18905), 0.08, -0.00, 0.03, -150.0, 90.0, -10.0, true, true, false, true, 1, true)
helmet = true
Citizen.CreateThread(function()
while true do
if sessionStarted == true then
DrawText3D(vector3(shishaPos.x, shishaPos.y, shishaPos.z+0.4), "~b~\"E\"~c~ Rauchen.", 0.7)
DrawText3D(loc, "~b~\"F\"~c~ Sitzung beenden.", 0.7)
end
Citizen.Wait(0)
end
end)
end
end
else
Citizen.Wait(500)
end
end
end
end)
function ShishaFunctions()
Citizen.CreateThread(function()
while true do
local ped = GetPlayerPed(-1)
Citizen.Wait(0)
if IsControlJustPressed(0, 38) then -- E statt H
TriggerEvent("chema_shisha:Drag", PedToNet(ped))
TriggerEvent("chema_shisha:Drag", 0)
end
if IsControlJustReleased(0, 23) then -- Normal: F
if endCallback == true then
sessionStarted = false
buyad = false
DeleteObject(VapeMod)
DeleteObject(VapeMod)
ClearPedTasksImmediately(ped)
ClearPedSecondaryTask(ped)
TriggerEvent("chema_shisha:delete", -1, entity)
endCallback = false
end
end
end
end)
end
AddEventHandler("chema_shisha:anim", function(source)
local ped = GetPlayerPed(-1)
local ad = "anim@heists@humane_labs@finale@keycards"
local anim = "ped_a_enter_loop"
while (not HasAnimDictLoaded(ad)) do
RequestAnimDict(ad)
Wait(1)
end
TaskPlayAnim(ped, ad, anim, 8.00, -8.00, -1, (2 + 16 + 32), 0.00, 0, 0, 0)
end)
p_smoke_location = {
20279,
}
p_smoke_particle = "exp_grd_bzgas_smoke"
p_smoke_particle_asset = "core"
RegisterNetEvent("c_eff_smokes")
AddEventHandler("c_eff_smokes", function(c_ped)
for _,bones in pairs(p_smoke_location) do
if DoesEntityExist(NetToPed(c_ped)) and not IsEntityDead(NetToPed(c_ped)) then
createdSmoke = UseParticleFxAssetNextCall(p_smoke_particle_asset)
createdPart = StartParticleFxLoopedOnEntityBone(p_smoke_particle, NetToPed(c_ped), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, GetPedBoneIndex(NetToPed(c_ped), bones), 0.2, 0.0, 0.0, 0.0)
Wait(2800)
--Wait(250)
while DoesParticleFxLoopedExist(createdSmoke) do
StopParticleFxLooped(createdSmoke, 1)
Wait(0)
end
while DoesParticleFxLoopedExist(createdPart) do
StopParticleFxLooped(createdPart, 1)
Wait(0)
end
while DoesParticleFxLoopedExist(p_smoke_particle) do
StopParticleFxLooped(p_smoke_particle, 1)
Wait(0)
end
while DoesParticleFxLoopedExist(p_smoke_particle_asset) do
StopParticleFxLooped(p_smoke_particle_asset, 1)
Wait(0)
end
Wait(2800*3)
RemoveParticleFxFromEntity(NetToPed(c_ped))
break
end
end
end)
RegisterNetEvent("chema_shisha:Drag")
AddEventHandler("chema_shisha:Drag", function()
local ped = GetPlayerPed(-1)
local PedPos = GetEntityCoords(ped)
local ad = "mp_player_inteat@burger"
local anim = "mp_player_int_eat_burger"
if (DoesEntityExist(ped) and not IsEntityDead(ped)) then
while (not HasAnimDictLoaded(ad)) do
RequestAnimDict(ad)
Wait(1)
end
local VapeFailure = math.random(1,99999)
if VapeFailure == 1 then
TaskPlayAnim(ped, ad, anim, 8.00, -8.00, -1, (2 + 16 + 32), 0.00, 0, 0, 0)
PlaySoundFrontend(-1, "Beep_Red", "DLC_HEIST_HACKING_SNAKE_SOUNDS", 1)
Wait(250)
AddExplosion(PedPos.x, PedPos.y, PedPos.z+1.00, 34, 0.00, true, false, 1.00)
ApplyDamageToPed(ped, 200, false)
TriggerServerEvent("Vape:Failure", 0)
else
TaskPlayAnim(ped, ad, anim, 8.00, -8.00, -1, (2 + 16 + 32), 0.00, 0, 0, 0)
PlaySoundFrontend(-1, "Beep_Red", "DLC_HEIST_HACKING_SNAKE_SOUNDS", 1)
Wait(950)
TriggerServerEvent("eff_smokes", PedToNet(ped))
Wait(1000)
TriggerEvent("Vape:VapeAnimFix", 0)
end
end
end)
RegisterNetEvent("chema_shisha:delete")
AddEventHandler("chema_shisha:delete", function(source)
for i = 1, #shisha do
local ped = PlayerPedId()
local pos = GetEntityCoords(ped)
local closestShisha = GetClosestObjectOfType(pos.x, pos.y, pos.z, 1.0, shisha[i], false, false, false)
local shishaPos = GetEntityCoords(closestShisha)
local dist = #(pos - shishaPos)
if dist < 3.5 then
local loc = vector3(shishaPos.x, shishaPos.y, shishaPos.z)
DeleteObject(mobilehooka)
else
Citizen.Wait(500)
end
end
end)
RegisterNetEvent("chema_shisha:spawn")
AddEventHandler("chema_shisha:spawn", function(source, xPlayer)
local playerPed = GetPlayerPed(-1)
local coords = GetEntityCoords(playerPed)
local model = GetHashKey('prop_bong_01')
RequestModel(model)
while not HasModelLoaded(model) do
Wait(0)
end
mobilehooka = CreateObject(model, coords.x+0.5, coords.y+0.1, coords.z-0.7, true, true, false)
end)
-- Helper function for 3D text
function DrawText3D(coords, text, size)
local onScreen, x, y = World3dToScreen2d(coords.x, coords.y, coords.z)
local camCoords = GetGameplayCamCoords()
local dist = #(camCoords - coords)
local scale = (1 / dist) * 2
local fov = (1 / GetGameplayCamFov()) * 100
local scale = scale * fov
if onScreen then
SetTextScale(0.0 * scale, size * scale)
SetTextFont(0)
SetTextProportional(1)
SetTextColour(255, 255, 255, 255)
SetTextDropshadow(0, 0, 0, 0, 255)
SetTextEdge(2, 0, 0, 0, 150)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(text)
DrawText(x, y)
end
end