RegisterNetEvent('esx_basicneeds:onDrink')
AddEventHandler('esx_basicneeds:onDrink', function(prop_name, posx, posy, posz, rotx, roty, rotz)
local ped = GetPlayerPed(-1)
if not IsPedInVehicle(ped, false, false) then
if not IsAnimated then
local playerPed = PlayerPedId()
local x,y,z = table.unpack(GetEntityCoords(playerPed))
if prop_name ~= nil then
RequestModel(GetHashKey(prop_name))
while not HasModelLoaded(GetHashKey(prop_name)) do
Citizen.Wait(1)
end
prop = CreateObject(GetHashKey(prop_name), x, y, z + 0.2, true, true, true)
local boneIndex = GetPedBoneIndex(playerPed, 18905)
AttachEntityToEntity(prop, playerPed, boneIndex, posx or 0.12, posy or 0.006, posz or 0.03, rotx or 240.0, roty or -65.0, rotz or 0.0, true, true, false, true, 1, true)
end
-- prop_name = prop_name or 'prop_ld_flow_bottle'
IsAnimated = true
exports['mythic_progbar']:Progress({
name = "drink",
duration = 10000,
label = 'İçiliyor...',
useWhileDead = false,
canCancel = false,
controlDisables = {
disableMovement = false,
disableCarMovement = false,
disableMouse = false,
disableCombat = true,
},
animation = {
animDict = "friends@frl@ig_1",
anim = "drink_lamar",
flags = 49,
},
}, function(cancelled)
if not cancelled then
DeleteObject(prop)
prop = nil
IsAnimated = false
end
end)
end
else
exports['mythic_progbar']:Progress({
name = "eat",
duration = 7000,
label = 'İçiliyor...',
useWhileDead = false,
canCancel = false,
controlDisables = {
disableMovement = false,
disableCarMovement = false,
disableMouse = false,
disableCombat = true,
},
})
end
end)