slowed loops if you dont have a weapon#208
slowed loops if you dont have a weapon#208Mustachedom wants to merge 2 commits intoqbcore-framework:mainfrom
Conversation
I put a wait(1500) if unarmed and a 1000 if there isnt CurrentWeaponData this slows down the loops running while not using a weapon and gave less of a wait than a typical weapondraw animation so this should have minimal blowbacks for the 1.5 seconds it may miss on my personal computer it took client side resmon down from 0.04 to 0.00 on idle
client/main.lua
Outdated
| end | ||
| Wait(0) | ||
| else | ||
| Wait(1500) |
There was a problem hiding this comment.
Waiting on the else for this condition means that it'll only be checking if the control was released every 1500ms. If a ped is armed, the first condition will be true, but if they don't attack, the second condition will be false meaning it'll wait 1500ms before checking the control again.
You could break up the conditions to only wait 1500ms when they're unarmed alone, but only wait 0-7ms if IsPedArmed returns 1 and you're waiting 0-7ms for the control.
There was a problem hiding this comment.
Totally right and missed that
I'll edit it tomorrow with a if ped unarmed then Wait(1500) instead of :)
There was a problem hiding this comment.
@Qwerty1Verified patched and reworked :) does this look good?
There was a problem hiding this comment.
I don't think the Wait on 230 is necessary, and the single space on 235 was keeping the wait in line with the code, but that's not a big problem, just styling. Looks good to me
There was a problem hiding this comment.
Left it in because I crashed without it. May not be needed and could have just been a random crash but better safe than sorry
There was a problem hiding this comment.
Honestly when I loaded in before to test the new code I crashed too, before I had even brought in the new code.
I don't think it relates to that specific wait since there's one at the very bottom of the loop which always runs no matter what, but it must relate to something else.
I did test the code without the extra Wait and all seemed well so I'm not sure where the crash came from for us.
pogaroo should be good, checks now if you have a weapon then runs the loop if true
I put a wait(1500) if unarmed
and a 1000 if there isnt CurrentWeaponData
this slows down the loops running while not using a weapon and gave less of a wait than a typical weapondraw animation so this should have minimal blowbacks for the 1.5 seconds it may miss
on my personal computer it took client side resmon down from 0.04 to 0.00 on idle
Describe Pull request
stop making loops go brrrr and make them slower when not needed and kept original speed when needed
Questions (please complete the following information):