View Single Post
MasterMind420
BANNED
Join Date: Nov 2010
Old 03-21-2020 , 12:41   Re: [L4D2] Weapon Fire Modes
Reply With Quote #3

Quote:
Originally Posted by Silvers View Post
Excellent, thank you! This will be fun to play with.

Some suggestions:
  • IsValidClient not required.
  • Delete line 186 (getting weapon classname) is already called at function start.
  • StrContains is inefficient. It would be better to do:
PHP Code:
// Skip "weapon_" and compare.
strcmp(sClsName[7], "rifle_desert") == 0

// Only compare the "pistol" part matching "weapon_pistol_magnum" too.
strncmp(sClsName[7], "pistol"6) == 
Any reason for restricting to L4D2 only and using "SDKHook_PostThink" instead of "OnPlayerRunCmd"?
No problem, always wanted fire modes for weapons...Thanks for the suggestions i'll definitely update later today when i have time. I only restricted to L4D2 because I don't use L4D1 anymore and haven't tested it. Although codewise there is no restriction, anyone can test that it works in L4D1 and i'll update the post. I originally used Onplayerruncmd...which works fine...however lux recommended using postthink because that's when the weapons fire I believe...regardless both methods work fine, but if you think it would be better to use onplayerruncmd let me know, u me and lux can collaborate on this and see whats best Thanks again for your advice, always appreciated.

Last edited by MasterMind420; 03-21-2020 at 12:42.
MasterMind420 is offline