You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The standard HL2 weapon 9mm pistolweapon_pistol resets his m_flNextPrimaryAttack every frame. It sets the variable to -0.1s (CurTime() - 0.1) after Lua call. So the weapon will always shoot, despite of the SetNextPrimaryFire.
Steps to reproduce
Call weapon:SetNextPrimaryFire(CurTime() + 60) on weapon_pistol
Call print(weapon:GetNextPrimaryFire() - CurTime()) or print(weapon:GetInternalVariable("m_flNextPrimaryAttack")) and you will see that it has been reset.
You still can shoot.
hook.Add(
"Think",
"5373_test",
function()
local weapon = Entity(1):GetActiveWeapon()
print(
weapon,
weapon:GetNextPrimaryFire(),
weapon:GetInternalVariable("m_flNextPrimaryAttack"),
weapon:GetNextPrimaryFire() - CurTime()
)
end
)
Protocol version 24
Exe version 2022.06.08 (garrysmod)
Exe build: 10:53:50 May 30 2022 (8605) (4000)
GMod version 2022.07.13, branch: x86-64, multicore: 1
Windows 64bit
The text was updated successfully, but these errors were encountered:
I tried weapon:SetSaveValue("m_flSoonestPrimaryAttack", CurTime() + 60) but it does nothing on SV, also weapon:GetInternalVariable("m_flSoonestPrimaryAttack") returns nil on SV
Details
The standard HL2 weapon 9mm pistol
weapon_pistol
resets hism_flNextPrimaryAttack
every frame. It sets the variable to -0.1s (CurTime() - 0.1
) after Lua call. So the weapon will always shoot, despite of theSetNextPrimaryFire
.Steps to reproduce
weapon:SetNextPrimaryFire(CurTime() + 60)
onweapon_pistol
print(weapon:GetNextPrimaryFire() - CurTime())
orprint(weapon:GetInternalVariable("m_flNextPrimaryAttack"))
and you will see that it has been reset.The text was updated successfully, but these errors were encountered: