Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ CreateThread(function()
SetWeaponsNoAutoswap(true)
end)


CreateThread(function()
while true do
local ped = PlayerPedId()
Expand All @@ -194,8 +195,10 @@ CreateThread(function()
TriggerServerEvent('qb-weapons:server:UpdateWeaponQuality', CurrentWeaponData, MultiplierAmount)
MultiplierAmount = 0
end
Wait(0)
else
Wait(1500)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally right and missed that

I'll edit it tomorrow with a if ped unarmed then Wait(1500) instead of :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Qwerty1Verified patched and reworked :) does this look good?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

@Qwerty1Verified Qwerty1Verified Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

end
Wait(0)
end
end)

Expand All @@ -222,9 +225,11 @@ CreateThread(function()
end
end
end
Wait(0)
else
Wait(1000)
end
end
Wait(0)
end
end)

Expand Down