[RELEASE] [UPDATED 19.12.2019] Stress System with logs by utku, esx_status

how is that?

here is a simple quick example: (not resource friendly tho)

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(1)
        local pedcoord = GetEntityCoords(PlayerPedId())
        local location = vector3(154.20, 224.15, 42.0) -- this is random
        
        if GetDistanceBetweenCoords(pedcoord, location, true) <= 50 then -- radius
            exports['stress_utk']:RemoveStress('slow', 300000, 25)
            Citizen.Wait(25000)
        end
    end
end)

thank you very much for your help so fast.

That Citizen.Wait(1) makes me wonder…this would be a little consuming…maybe make it 500 instead of 1 so it’s checked twice a second? so it’s like a little more scheduler-friendly maybe?

You’re really a damn boss, but a question. to change the speeds of rise and fall of stress, how would it be?

Oh I get it. Now my question is how to change the camera vibration for the animation of limping

I have a problem, when people enter the server for the first time they have maximum stress, how could I change it so that they have 0 stress when they first enter?

you need same database?

you don’t need any extra database thing, it only requires esx_status

i added it and i follow all the steps but when i eat something with stress add it dont get up, and when i shoot and everithing nothing happend, i check my status field from user in database but seems dont put stress in the field, i can see in the log.txt im getting stress but ingame i dont, u need to add manually something in status or what im doing wrong?, thanks

and then how is the script supposed to store the stress?

it stores at status in table"users", automatically done by esx_status

Hi, do you have any idea how i can add and remove stress by zones ? For exapmle, if i go to the vanila club, the stress goes down


this is your answer, find a center coordinate and determine the effective radius and implement it

Thanks, if i want to do that but with basic stress system, what i have to chage ? Basic= stress system with basicneeds and status.
It will work if i change the export part for TriggerServerEvent ?

yes that would work only if you register a stress status in esx_basicneeds but if you are using my script then exports are the best way

Thanks for helping :slight_smile: !

1 Like

When someone enters the first time, stress has it to the maximum, any idea why?

1 Like
AddEventHandler('esx_status:loaded', function(status)
    TriggerEvent('esx_status:registerStatus', 'stress', 1000000, '#cadfff', function(status)
		return false
	end, function(status)
		status.add(1)
	end)

ESX is loading you at max stress level according to this to the above and below.

if StressVal == 1000000 then -- max StressVal

You need to make to change the TriggerEvent stress value to 0.
TriggerEvent('esx_status:registerStatus', 'stress', 0, '#cadfff', function(status) Like so.

You also need to go into your users table, under the status row, change your character’s stress value to 0 and or set your status to: (NULL)

this should fix the issue of spawning into an earthquake, unless i am wrong

2 Likes

SCRIPT ERROR: @stress_utk/server.lua:29: attempt to index a nil value (local 'xPlayer')
Anybody got this?