[Release] [ESX]MrNewbStress

Here is a simple stress script. This covers some stress relif and gun stress, im releasing this because it needs improved and a few friends of mine use it and like it. This isnt great/complex or complicated and it runs well while still needing optomizations. Hopefully this helps someone or someone does a pull to help improve it. Esx is required as well as a modification to your basic needs such as this [RELEASE] Stress System with basicneeds

Will add a screenshot of shooting a gun after im off work. Unless someone cares to send me one.

5 Likes

:heart::v: used this script for a while! Absolutely love it and recommend it to anyone that runs a server

2 Likes

Really good piece of script. I loved it. hoping for more from you man! Very compact and does not slow you server down!!! :slightly_smiling_face: :+1: :+1:

2 Likes

I feel like most of this code could’ve been done in a single thread, no? Opening this many threads seems pretty unoptimised.

Overall though, a good idea for people who use stress.

Essentially, swimming reduces stress, driving over 120mph increases it, being in melee combat increases it, being on any bicycle (or motorbike, the native includes motorbikes) decreases it, shooting increases it (depending on the weapon type.)

Great idea, love to see some improvements to the code though.

Didn’t test this but this should merge 3 of the threads into 1. You could of course remove the elseifs and do separate if statements but I think this way is better personally.

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(100)
        local ped = GetPlayerPed(-1)
		local veh = GetVehiclePedIsIn(ped)
		local speed = GetEntitySpeed(GetVehiclePedIsIn(ped,true)) * 2.6
		if IsPedInAnyVehicle(ped,false)	and speed >= 120 then
		  TriggerEvent('esx_status:add','stress',300)
		  print(speed)
		  Citizen.Wait(3000)
		elseif IsPedInMeleeCombat(ped) then
			TriggerEvent('esx_status:add','stress',300)
			Citizen.Wait(3000)
		elseif IsPedSwimming(ped) then
			TriggerEvent('esx_status:remove','stress',200)
		end
	end
end)
3 Likes

This is similar to how I use it atm, I wanted to make it more of a template for people. Currently it runs very well as it is from every test I’ve done, the speed check has to have the delay it had because of some fivem anticheat stuff and it’s overall just better his way. Solid feedback and I greatly appreciate it :). My main reason for releasing is I know someone is selling a similar system and from what I’ve heard it’s overly complex for newcomers to adapt to needs. Plus spike thought me how to use arrays and I think having that fully customizable is just the coolest. So many natives could be used in something like this and it’s a blast.

1 Like

Everything works but I get this error in console…

have you modified esx_basic needs to support the stress? also the weapon you are using is it listed in the table at the top or the stressarray file? Try and delete the values in the table and see is that makes a different on the user.

Ey! i tried to download the file but the link is broken. Is there another way to download it?

Thanks! It will really help me!