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) == 0
Any reason for restricting to L4D2 only and using "SDKHook_PostThink" instead of "OnPlayerRunCmd"?
__________________