Trying to make a toggle when IN_RELOAD is pressed to switch a networked boolean between true and false. No matter how I coded it, it seems to just spaz out and repeat itself three our four times. Which makes coding a toggle next to impossible because it rapidly switches between true and false a couple times whenever the key is pressed. Any ideas how to prevent this?
I tried input.IsKeyDown but it won’t broadcast a networked boolean from a HUDPaint hook, and input.IsKeyDown returns a “Attempt to index global ‘input’ a nil value” error when on a Think hook.
Corner… I am painted into one. :<
function toggle(pl,key) if key == IN_RELOAD then pl:SetNWBool("delete", false) pl:ChatPrint("0") end end hook.Add("KeyRelease", "toggle", toggle)
OUTPUT: 0 0 0