Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add _toggleweapon command #233

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

rtxa
Copy link

@rtxa rtxa commented Jul 20, 2024

The _toggleweapon command allows the player to quickly switch to a specific weapon if it is available in their inventory. If the requested weapon is not available, the command will switch to a default weapon specified.

Usage

_toggleweapon <weapon_name> <default_weapon>

Where:

  • <weapon_name>: The primary weapon the player wants to switch to, if available.
  • <default_weapon>: The default weapon to switch to if <weapon_name> is not available.

Example

bind q "_toggleweapon weapon_shotgun weapon_crowbar"

In this example, if you press Q, the command will first try to switch to the shotgun (weapon_shotgun). If the shotgun is not available in the player's inventory, it will switch to the crowbar (weapon_crowbar) as the default weapon.

Benefits:

  • Provides a fallback option if the primary weapon is not available, ensuring the player always has a suitable weapon.
    • For players who have all the weapons binded to the keyboard (which can be quite a few), the _toggleweapon command can help reduce the number of key bindings needed, making weapon switching more efficient and also having a nearby key for faster switching.

@tmp64
Copy link
Owner

tmp64 commented Aug 10, 2024

bind q "weapon_crowbar;weapon_shotgun" seems to do the same. It first switches to the crowbar and immediately switches to the shotgun. If the shotgun isn't available, the crowbar stays as the active weapon.

@rtxa
Copy link
Author

rtxa commented Aug 10, 2024

True, but you have to wait to the server to answer those commands to do the switching, it's faster if you check it from client-side if the gun is available for better response and send one command instead of two. Besides I've already test that before and it's slower.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants