So I need help to figure out how to make a new status. So i wanna make a new status that is called sleep. But need some help how to do it. Anybody that knows how to do it?
A what? Can you give some context of what you’re actually talking about.
Make a new status? Try Facebook… I guess? Or Twitter…
Ok but cant you just modify esx_basicneeds? Because that is a status I think?
I have no idea, you probably can, ask them?
Ok so you know thirst and hunger those are statuses. I wanna add one more status but dont know how.
Do you have knowledge of writing code or no…
I mean, you can do anything you want if you can code it… from what I’m gathering you don’t know how to code so you have two options - figure out how to code or contact the person who makes esx and ask them to do it.
Ok I modefied basicneeds for pee and poo so my question is know will this work?
The code:
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_Coffes_needs:resetStatus', function()
TriggerEvent('esx_status:set', 'poop', 500000)
TriggerEvent('esx_status:set', 'pee', 500000)
end)
AddEventHandler('playerSpawned', function()
if IsDead then
TriggerEvent('esx_Coffes_needs:resetStatus')
end
IsDead = false
end)
AddEventHandler('esx_status:loaded', function(status)
TriggerEvent('esx_status:registerStatus', 'poop', 1000000, '#92640E',
function(status)
return true
end,
function(status)
status.remove(95)
end
)
TriggerEvent('esx_status:registerStatus', 'pee', 1000000, '#F05C0B',
function(status)
return true
end,
function(status)
status.remove(95)
end
)
Citizen.CreateThread(function()
while true do
Wait(1000)
local playerPed = GetPlayerPed(-1)
local prevHealth = GetEntityHealth(playerPed)
local health = prevHealth
TriggerEvent('esx_status:getStatus', 'poop', 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', 'pee', function(status)
if status.val == 0 then
if prevHealth <= 150 then
health = health - 5
else
health = health - 1
end
end
end)
if health ~= prevHealth then
SetEntityHealth(playerPed, health)
end
end
end)
Citizen.CreateThread(function()
while true do
Wait(0)
local playerPed = GetPlayerPed(-1)
if IsEntityDead(playerPed) and not IsDead then
IsDead = true
end
end
end)
end)
RegisterNetEvent('poop')
AddEventHandler('poop', function()
local particleDictionary = "scr_amb_chop"
local particleName = "ent_anim_dog_poo"
local animDictionary = 'switch@trevor@on_toilet'
local animName = 'trev_on_toilet_exit'
RequestNamedPtfxAsset(particleDictionary)
while not HasNamedPtfxAssetLoaded(particleDictionary) do
Citizen.Wait(0)
end
RequestAnimDict(animDictionary)
while not HasAnimDictLoaded(animDictionary) do
Citizen.Wait(0)
end
SetPtfxAssetNextCall(particleDictionary)
bone = GetPedBoneIndex(GetPlayerPed(-1), 11816)
TaskPlayAnim(GetPlayerPed(-1), animDictionary, animName, 8.0, -8.0, -1, 0, 0, false, false, false)
effect = StartParticleFxLoopedOnPedBone(particleName, GetPlayerPed(-1), 0.0, -0.9, -0.5, 0.0, 0.0, 20.0, bone, 2.0, false, false, false);
Wait(2000)
StopParticleFxLooped(effect, 0)
end)
RegisterNetEvent('pee')
AddEventHandler('pee', function()
local particleDictionary = "scr_amb_chop"
local particleName = "ent_anim_dog_peeing"
local animDictionary = 'missbigscore1switch_trevor_piss'
local animName = 'piss_loop'
RequestNamedPtfxAsset(particleDictionary)
while not HasNamedPtfxAssetLoaded(particleDictionary) do
Citizen.Wait(0)
end
RequestAnimDict(animDictionary)
while not HasAnimDictLoaded(animDictionary) do
Citizen.Wait(0)
end
SetPtfxAssetNextCall(particleDictionary)
bone = GetPedBoneIndex(GetPlayerPed(-1), 11816)
TaskPlayAnim(GetPlayerPed(-1), animDictionary, animName, 8.0, -8.0, -1, 0, 0, false, false, false)
effect = StartParticleFxLoopedOnPedBone(particleName, GetPlayerPed(-1), 0.0, 0.0, -0.1, 90.0, 90.0, 20.0, bone, 2.0, false, false, false);
Wait(5500)
StopParticleFxLooped(effect, 0)
end)
I’m going to say, no one knows and the fact that you haven’t tested it to know if it works yourself means you don’t know what you’re doing…
If you want to learn, that’s fine - but it’s probably not best to go ripping apart codes without the inkling of an idea of how it functions / works.
Ask on the original topic of the resource you need help with.
Exactly what he said, If your not Familiar with basic code and native lua probably not best to go ripping stuff apart to suit your needs, you will probably end up breaking something
Next time you post something make sure it
1 Makes Sense
2 Gives enough Information So Help can be given
Yea that is true should probably learn to code first. The hard part dont know where to start .
Put a mod on your server. See what it does do. Look at the code and try to understand what each line means.