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

Feature Request - cl_autowepswitch - Disable/Enable Automatic Weapon Switch #525

Open
Blackgrowl opened this issue Dec 28, 2024 · 8 comments

Comments

@Blackgrowl
Copy link

Hello, "Opposing Force" has a console command called "cl_autowepswitch", what it does is enable/disable the automatic weapon switch feature.

I am not sure if GoldSrc (Original Half Life, not OpFor) ever had it, before and after the 25th Anniversary Update, however, it seems that they will be no longer updating it so I thought my best chance is in here.

Could this command be added into MetaHook so all GoldSrc games and mods can have it? It's especially needed in a mod like "Brutal Half Life", where there's about 50 weapons or more, you just ALWAYS switch non-stop, it gets very annoying.

@hzqst
Copy link
Owner

hzqst commented Dec 28, 2024

According to the reversed-engineered code, the _cl_autowepswitch appears to be a server-side feature, which means it's the server that changes your current weapon when you pickup a better one. MetaHook can do nothing to prevent this from happening because MetaHook is for client-side modding not server-side modding. You better looking for sth. like amxx or metamod.

see:

https://github.com/hzqst/CS16ND/blob/8f7d43d88cbaa953a1cfd074c57a7a4b974ef70c/dlls/player.cpp#L6839

and

https://github.com/hzqst/CS16ND/blob/8f7d43d88cbaa953a1cfd074c57a7a4b974ef70c/dlls/multiplay_gamerules.cpp#L2171C16-L2171C32

@Blackgrowl
Copy link
Author

Damn, that's very sad to know, just another incompetence from Valve it seems. Thanks for the information.

Can I actually use AMXX/MetaMod in HL1 without making a server or so? Also is there a short guide on how to set it up?

@di57inct
Copy link

it's actually client sided and there even is an option in the multiplayer tab under the "more"(or something like that) button where you set your decal limit, radar type, etc. it's a checkbox named "switch to picked up weapon if more powerful".

@hzqst
Copy link
Owner

hzqst commented Dec 29, 2024

it's actually client sided and there even is an option in the multiplayer tab under the "more"(or something like that) button where you set your decal limit, radar type, etc. it's a checkbox named "switch to picked up weapon if more powerful".

it's just a userinfo key that tells server "hey, remember to change to the new weapon for me when it's better than the current one"

the client itself never sends command like switching weapon or sth.

ofc the server-side code (i.e. dlls/multiplay_gamerules.cpp) has to do all jobs.

it's listed on client-side GameUI optiondialog doesn't mean it's a client-side feature.

@di57inct
Copy link

so it's a sort of client preference since it can be requested even if it's handled server side

@Blackgrowl
Copy link
Author

it's actually client sided and there even is an option in the multiplayer tab under the "more"(or something like that) button where you set your decal limit, radar type, etc. it's a checkbox named "switch to picked up weapon if more powerful".

Does that mean using AMXX/Metamod won't actually help?

I'm still not sure on how to use these two just to switch the Automatic Weapon Switch function off.

@hzqst
Copy link
Owner

hzqst commented Dec 31, 2024

it's actually client sided and there even is an option in the multiplayer tab under the "more"(or something like that) button where you set your decal limit, radar type, etc. it's a checkbox named "switch to picked up weapon if more powerful".

Does that mean using AMXX/Metamod won't actually help?

I'm still not sure on how to use these two just to switch the Automatic Weapon Switch function off.

amxx/metamod is the way to implement the actual "auto-wep-switching logic" if you don't have access to the source code. just like what those cstrike community modders does to cstrike.

ofc the best way to do so is to ask the author of "Brutal Half Life" to update to latest halflife-updated code base, which has already implement all shits.

@Blackgrowl
Copy link
Author

it's actually client sided and there even is an option in the multiplayer tab under the "more"(or something like that) button where you set your decal limit, radar type, etc. it's a checkbox named "switch to picked up weapon if more powerful".

Does that mean using AMXX/Metamod won't actually help?
I'm still not sure on how to use these two just to switch the Automatic Weapon Switch function off.

amxx/metamod is the way to implement the actual "auto-wep-switching logic" if you don't have access to the source code. just like what those cstrike community modders does to cstrike.

ofc the best way to do so is to ask the author of "Brutal Half Life" to update to latest halflife-updated code base, which has already implement all shits.

Very well, I have asked the BHL author to update his mod to use HL1 Update as his base instead of 25th Anniversary HL1. Since it adds more than just a "Weapon Auto Switch", he might be interested, here's hoping.

For the rest of the mods, I'll have to figure out how to use it through MetaMod, I'll try asking around in HL1 forums or so.
Thanks for the info.

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

No branches or pull requests

3 participants