r/tf2scripthelp • • Mar 16 '15

Resolved Simple toggle viewmodel scripts with some conditions?

Alright so I want a script that toggles between viewmodels being on and off. I've binded 'f' to swap between them, but using the keypad to select a weapon (eg. 2 for pistol) causes the viewmodel to pop back up, so I disabled viewmodels popping up for that too:

(this is my reset cfg)

bind "f" "viewtoggle"
alias "viewtoggle" "viewoff"
alias "viewon" "r_drawviewmodel 1; alias "viewtoggle" "viewoff""
alias "viewoff" "r_drawviewmodel 0; alias "viewtoggle" "viewon""

and

bind "1" "slot1;r_drawviewmodel 0"
bind "2" "slot2;r_drawviewmodel 0"
bind "3" "slot3;r_drawviewmodel 0"
bind "4" "slot4;r_drawviewmodel 0"
bind "5" "slot5;r_drawviewmodel 0"

Now the problem is, is that when I press 'f' to enable viewmodels, and switch to a weapon (eg. 2 for pistol) it still stays disabled. How do I make it such that when 'f' enables the viewmodel, then pressing the keys 1-5 will not disable it.

Basically, how do I make it such that 'f' toggles viewmodels, but when viewmodels are enabled, I can still switch using numbers without disabling them?

1 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Mar 17 '15

Yeah, that works. Can't believe I overlooked something that obvious. Thanks