Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ESX = nil
- local IsDead = false
- local IsAnimated = false
- Citizen.CreateThread(function()
- while ESX == nil do
- TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
- Citizen.Wait(0)
- end
- end)
- AddEventHandler('esx_basicneeds:resetStatus', function()
- TriggerEvent('esx_status:set', 'hunger', 500000)
- TriggerEvent('esx_status:set', 'thirst', 500000)
- TriggerEvent('esx_status:set', 'stress', 1)
- end)
- RegisterNetEvent('esx_basicneeds:healPlayer')
- AddEventHandler('esx_basicneeds:healPlayer', function()
- -- restore hunger & thirst
- TriggerEvent('esx_status:set', 'hunger', 1000000)
- TriggerEvent('esx_status:set', 'thirst', 1000000)
- TriggerEvent('esx_status:set', 'stress', 1)
- -- restore hp
- local playerPed = PlayerPedId()
- SetEntityHealth(playerPed, GetEntityMaxHealth(playerPed))
- end)
- AddEventHandler('esx:onPlayerDeath', function()
- IsDead = true
- end)
- AddEventHandler('playerSpawned', function(spawn)
- if IsDead then
- TriggerEvent('esx_basicneeds:resetStatus')
- end
- IsDead = false
- end)
- AddEventHandler('esx_status:loaded', function(status)
- TriggerEvent('esx_status:registerStatus', 'hunger', 1000000, '#FFFF00',
- function(status)
- return true
- end, function(status)
- status.remove(100)
- end)
- TriggerEvent('esx_status:registerStatus', 'thirst', 1000000, '#0099FF',
- function(status)
- return true
- end, function(status)
- status.remove(75)
- end)
- TriggerEvent('esx_status:registerStatus', 'stress', 1000000, '#cadfff',
- function(status)
- return true
- end, function(status)
- status.add(100)
- end)
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(1000)
- local playerPed = PlayerPedId()
- local prevHealth = GetEntityHealth(playerPed)
- local health = prevHealth
- TriggerEvent('esx_status:getStatus', 'hunger', function(status)
- if status.val == 0 then
- if prevHealth <= 150 then
- health = health - 5
- else
- health = health - 1
- end
- end
- end)
- TriggerEvent('esx_status:getStatus', 'thirst', function(status)
- if status.val == 0 then
- if prevHealth <= 150 then
- health = health - 5
- else
- health = health - 1
- end
- end
- end)
- TriggerEvent('esx_status:getStatus', 'stress', function(status) -- Bu eventi stressi hudda göstermek için de kullanabilirsiniz // you can also use this event to show stress on your hud
- stress = status.val
- end)
- if health ~= prevHealth then
- SetEntityHealth(playerPed, health)
- end
- if stress == 1000000 then -- max stress
- SetTimecycleModifier("WATER_silty") -- hafif blurlanır ve görüş düşer // a bit blur and vision distance reduce
- SetTimecycleModifierStrength(1)
- else
- ClearExtraTimecycleModifier()
- end
- if stress >= 900000 then
- local veh = GetVehiclePedIsUsing(playerPed)
- if IsPedInAnyVehicle(playerPed) and GetPedInVehicleSeat(veh, -1) == playerPed then -- eğer oyuncu araçtaysa ve ayrıca o aracı kullanıyorsa // if ped "driving" a vehicle
- Citizen.Wait(1000)
- ShakeGameplayCam('MEDIUM_EXPLOSION_SHAKE', 0.15) -- kamera sallanmaları // cam shake
- TaskVehicleTempAction(playerPed, veh, 7, 500) -- aracı hafif sola kırma // turn left a bit
- Citizen.Wait(500)
- TaskVehicleTempAction(playerPed, veh, 8, 500) -- aracı hafif sağa kırma // turn right a bit
- ShakeGameplayCam('MEDIUM_EXPLOSION_SHAKE', 0.15)
- Citizen.Wait(500)
- ShakeGameplayCam('MEDIUM_EXPLOSION_SHAKE', 0.15)
- else
- Citizen.Wait(1500)
- ShakeGameplayCam('MEDIUM_EXPLOSION_SHAKE', 0.15)
- end
- elseif stress >= 800000 then
- local veh = GetVehiclePedIsUsing(playerPed)
- if IsPedInAnyVehicle(playerPed) and GetPedInVehicleSeat(veh, -1) == playerPed then
- Citizen.Wait(1000)
- ShakeGameplayCam('MEDIUM_EXPLOSION_SHAKE', 0.10)
- TaskVehicleTempAction(playerPed, veh, 7, 300)
- Citizen.Wait(500)
- TaskVehicleTempAction(playerPed, veh, 8, 300)
- ShakeGameplayCam('MEDIUM_EXPLOSION_SHAKE', 0.10)
- Citizen.Wait(500)
- ShakeGameplayCam('MEDIUM_EXPLOSION_SHAKE', 0.10)
- else
- Citizen.Wait(2000)
- ShakeGameplayCam('MEDIUM_EXPLOSION_SHAKE', 0.10)
- end
- elseif stress >= 700000 then
- local veh = GetVehiclePedIsUsing(playerPed)
- if IsPedInAnyVehicle(playerPed) and GetPedInVehicleSeat(veh, -1) == playerPed then
- Citizen.Wait(1000)
- ShakeGameplayCam('MEDIUM_EXPLOSION_SHAKE', 0.07)
- TaskVehicleTempAction(playerPed, veh, 7, 100)
- Citizen.Wait(500)
- TaskVehicleTempAction(playerPed, veh, 8, 100)
- ShakeGameplayCam('MEDIUM_EXPLOSION_SHAKE', 0.07)
- Citizen.Wait(500)
- ShakeGameplayCam('MEDIUM_EXPLOSION_SHAKE', 0.07)
- else
- Citizen.Wait(2500)
- ShakeGameplayCam('MEDIUM_EXPLOSION_SHAKE', 0.07)
- end
- elseif stress >= 600000 then -- %60 altındayken araç sürüşüne bir etkisi olmuyor // Below ½60 no effect to driving
- Citizen.Wait(3500) -- sıklık // frequency
- ShakeGameplayCam('MEDIUM_EXPLOSION_SHAKE', 0.07) -- efekt // effect
- elseif stress >= 500000 then
- Citizen.Wait(4500)
- ShakeGameplayCam('MEDIUM_EXPLOSION_SHAKE', 0.07)
- elseif stress >= 350000 then
- Citizen.Wait(5500)
- ShakeGameplayCam('MEDIUM_EXPLOSION_SHAKE', 0.05)
- elseif stress >= 200000 then
- Citizen.Wait(6500)
- ShakeGameplayCam('MEDIUM_EXPLOSION_SHAKE', 0.03)
- end
- end
- end)
- end)
- AddEventHandler('esx_basicneeds:isEating', function(cb)
- cb(IsAnimated)
- end)
- RegisterNetEvent('esx_basicneeds:onEat')
- AddEventHandler('esx_basicneeds:onEat', function(prop_name)
- if not IsAnimated then
- prop_name = prop_name or 'prop_cs_burger_01'
- IsAnimated = true
- Citizen.CreateThread(function()
- local playerPed = PlayerPedId()
- local x,y,z = table.unpack(GetEntityCoords(playerPed))
- local prop = CreateObject(GetHashKey(prop_name), x, y, z + 0.2, true, true, true)
- local boneIndex = GetPedBoneIndex(playerPed, 18905)
- AttachEntityToEntity(prop, playerPed, boneIndex, 0.12, 0.028, 0.001, 10.0, 175.0, 0.0, true, true, false, true, 1, true)
- ESX.Streaming.RequestAnimDict('mp_player_inteat@burger', function()
- TaskPlayAnim(playerPed, 'mp_player_inteat@burger', 'mp_player_int_eat_burger_fp', 8.0, -8, -1, 49, 0, 0, 0, 0)
- exports['progressBars']:startUI(2700, "Yemek tüketiliyor.")
- Citizen.Wait(3000)
- IsAnimated = false
- ClearPedSecondaryTask(playerPed)
- DeleteObject(prop)
- end)
- end)
- end
- end)
- RegisterNetEvent('esx_basicneeds:onDrink')
- AddEventHandler('esx_basicneeds:onDrink', function(prop_name)
- if not IsAnimated then
- prop_name = prop_name or 'prop_ld_flow_bottle'
- IsAnimated = true
- Citizen.CreateThread(function()
- local playerPed = PlayerPedId()
- local x,y,z = table.unpack(GetEntityCoords(playerPed))
- local prop = CreateObject(GetHashKey(prop_name), x, y, z + 0.2, true, true, true)
- local boneIndex = GetPedBoneIndex(playerPed, 18905)
- AttachEntityToEntity(prop, playerPed, boneIndex, 0.12, 0.028, 0.001, 10.0, 175.0, 0.0, true, true, false, true, 1, true)
- ESX.Streaming.RequestAnimDict('mp_player_intdrink', function()
- TaskPlayAnim(playerPed, 'mp_player_intdrink', 'loop_bottle', 8.0, -8, -1, 49, 0, 0, 0, 0)
- exports['progressBars']:startUI(3100, "Yemek tüketiliyor.")
- Citizen.Wait(3000)
- IsAnimated = false
- ClearPedSecondaryTask(playerPed)
- DeleteObject(prop)
- end)
- end)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement