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.
while true do
local ped = GetPlayerPed(-1)
local veh = GetVehiclePedIsIn(ped)
local speed = GetEntitySpeed(GetVehiclePedIsIn(ped,true)) * 2.6
if IsPedInAnyVehicle(ped,false) and speed >= 120 then
elseif IsPedInMeleeCombat(ped) then
elseif IsPedSwimming(ped) then