local firstspawn = 0 AddEventHandler('playerSpawned', function(spawn) if firstspawn == 0 then firstspawn = 1 else TriggerServerEvent('player_state:setdefaultneeds') end end) RegisterNetEvent('player_state:death') AddEventHandler('player_state:death', function() SetEntityHealth(GetPlayerPed(-1), 0) end) -- FOOD RegisterNetEvent('player_state:set') AddEventHandler('player_state:set', function(state) SendNUIMessage({ state = json.encode({food = state.food, water = state.water, needs = state.needs}) }) end) ------------------------------------------------------------------------- ------------------------------------------------------------------------- -- EMOTES ------------------------------------------------------------------------- ------------------------------------------------------------------------- RegisterNetEvent('player_state:drink') AddEventHandler('player_state:drink', function() local bone = GetPedBoneIndex(GetPlayerPed(-1), 28422) local bottleProp = 0 local bottleModel = "prop_ld_flow_bottle" function newBottleProp() local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true)) RequestModel(bottleModel) while not HasModelLoaded(bottleModel) do Citizen.Wait(100) end return CreateObject(bottleModel, 1.0, 1.0, 1.0, 1, 1, 0) end bottleProp = newBottleProp() TriggerEvent("player:looseItem", item, 1) AttachEntityToEntity(bottleProp, GetPlayerPed(-1), bone, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 1, 0, 0, 2, 1) RequestModel("prop_ld_flow_bottle") ped = GetPlayerPed(-1) if ped then Citizen.CreateThread(function() RequestAnimDict('amb@world_human_drinking_fat@beer@male@idle_a') local pedid = PlayerPedId() TaskPlayAnim(pedid, 'amb@world_human_drinking_fat@beer@male@idle_a', 'idle_a', 8.0, -8, -1, 16, 0, 0, 0, 0) Citizen.Wait(300) TaskPlayAnim(pedid, 'amb@world_human_drinking_fat@beer@male@idle_a', 'idle_b', 8.0, -8, -1, 16, 0, 0, 0, 0) Citizen.Wait(300) TaskPlayAnim(pedid, 'amb@world_human_drinking_fat@beer@male@idle_a', 'idle_c', 8.0, -8, -1, 16, 0, 0, 0, 0) end) end Citizen.Wait(3000) ClearPedTasks(ped) DeleteEntity(bottleProp) end) --////////////// RegisterNetEvent('player_state:eat') AddEventHandler('player_state:eat', function() local bone = GetPedBoneIndex(GetPlayerPed(-1), 28422) local tacosProp = 0 local tacosModel = "prop_food_bs_burger2" function newTacosProp() local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true)) RequestModel(tacosModel) while not HasModelLoaded(tacosModel) do Citizen.Wait(100) end return CreateObject(tacosModel, 1.0, 1.0, 1.0, 1, 1, 0) end tacosProp = newTacosProp() AttachEntityToEntity(tacosProp, GetPlayerPed(-1), bone, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 1, 0, 0, 2, 1) RequestModel("prop_food_bs_burger2") ped = GetPlayerPed(-1) if ped then Citizen.CreateThread(function() RequestAnimDict('amb@code_human_wander_eating_donut@male@idle_a') local pedid = PlayerPedId() TaskPlayAnim(pedid, 'amb@code_human_wander_eating_donut@male@idle_a', 'idle_c', 8.0, -8, -1, 16, 0, 0, 0, 0) Citizen.Wait(5000) ClearPedTasks(ped) end) end Citizen.Wait(5000) DeleteEntity(tacosProp) end) ------------------------------------------------------------------------- ------------------------------------------------------------------------- -- EMOTES END ------------------------------------------------------------------------- ------------------------------------------------------------------------- RegisterNetEvent('player_state:pee') AddEventHandler('player_state:pee', function() ped = GetPlayerPed(-1) local hashSkin = GetHashKey("mp_m_freemode_01") if IsPedInAnyVehicle(GetPlayerPed(-1), true) == false then if ped then if(GetEntityModel(GetPlayerPed(-1)) ~= hashSkin) then Citizen.CreateThread(function() RequestAnimDict('missfbi3ig_0') local pedid = PlayerPedId() TaskPlayAnim(pedid, 'missfbi3ig_0', 'shit_loop_trev', 8.0, 8, -1, 0, 0, 0, 0, 0) ClearPedTasks(ped) end) else Citizen.CreateThread(function() RequestAnimDict('misscarsteal2peeing') local pedid = PlayerPedId() TaskPlayAnim(pedid, 'misscarsteal2peeing', 'peeing_intro', 8.0, -8, -1, 0, 0, 0, 0, 0) Citizen.Wait(GetAnimDuration('misscarsteal2peeing', 'peeing_intro')) TaskPlayAnim(pedid, 'misscarsteal2peeing', 'peeing_loop', 8.0, -8, -1, 0, 0, 0, 0, 0) Citizen.Wait(GetAnimDuration('misscarsteal2peeing', 'peeing_loop')) TaskPlayAnim(pedid, 'misscarsteal2peeing', 'peeing_outro', 8.0, -8, -1, 0, 0, 0, 0, 0) ClearPedTasks(ped) end) end end else --TriggerEvent("es_freeroam:notify", "CHAR_MP_STRIPCLUB_PR", 1, "Mairie", false, "ca serai pas mieux en dehors du vehicule?") end end) Citizen.CreateThread(function() while true do Citizen.Wait(0) if IsPauseMenuActive() then SendNUIMessage({ pause = true }) else SendNUIMessage({ pause = false }) end end end) Citizen.CreateThread(function() while true do Citizen.Wait(120000) TriggerServerEvent('player_state:check') end end)