Thread: Grenade Drop
View Single Post
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-10-2015 , 05:26   Re: Grenade Drop
Reply With Quote #9

I have more suggestions

1.As I said, static is misused in fwHamItemCanDrop_Pre.
2.Name your vars correctly. g_fIsFlashbangActive f stands from float, but the var is a bool, so it should be b.
3.Do you think you can add support for all nades ? Just change g_nRestoreFlashbangCount and g_fIsFlashbangActive into array like g_nRestoreNadeCount[3], g_fIsNadeActive[3], then you can index by the enum you already created. Check entity CSW_* index and decide if you index by HEGRENADE/FLASHBANG/SMOKEGRENADE. That way your code will be more dynamic. If you are not sure how to design this tell me.
4.FM_ClientCommand is called for other commands than "drop". Register it in fwHamItemCanDrop_Pre(instead of init) and unregister the hook right after you do your checks and set bpammo. You could also make sure it's called for drop command(read_argv(0, cmd, charsmax(cmd)) and see if it's "drop").

If you don't understand something ask, don't forget that everything I said can be discussed.
__________________

Last edited by HamletEagle; 09-10-2015 at 05:26.
HamletEagle is offline