Raised This Month: $12 Target: $400
 3% 

Grenade Buying Limit (Block Nade Spam)


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Gameplay       
K.Nk
Junior Member
Join Date: Mar 2012
Old 03-01-2012 , 01:17   Grenade Buying Limit (Block Nade Spam)
Reply With Quote #1

Credit:
AMXX Dev Team: Restrict Weapons
hoboman313: Hobo Nade Management (offsets, etc.)
OT: Flashbang Remote Control (gravity check)

Description:
Limit the number of grenades a player can buy/use
Block limited action before they can be performed instead of taking away hp from players afterward

Compatibility:
Tested to work with all known weapon drop plugins: Real Nade Drops, Real Weapon Drop, Weapons Drop Ability, etc.

CVars:
nl_limit_buy 1:
nl_limit_use 0:
0: no limit
1: enabled
nl_buy_flash 3:
nl_buy_hegren 2:
nl_buy_sgren 2:
nl_buy_all 5:
nl_use_flash 3:
nl_use_hegren 2:
nl_use_sgren 2:
nl_use_all 5:
0: no limit
positive values: limit amount
nl_early_msg 1:
0: message when exceeding limit
1: message when reaching limit

Command:
nl_reset:
Reset count for all players

Client commands:
say /nl:
say_team /nl:
Display limits in chat

Changelog:
0.5.2:
Minor optimization: no longer uses add string native
0.5.1:
Minor code optimization
Reorganized some code; added comments
0.5:
Improved compatibility of grenade throw detection
Improved behavior when switching to last weapon
Added primary attack check (optional)
Added ML support
Added say /nl command, report limits set by the server
Removed many loops; uses trie in some part
Removed dependency on csx module
CVar changes:
Changed nbl prefix to nl
Removed nbl_limit_type, now always per respawn
Renamed nbl_limit_msg to nl_early_msg
Removed nade-specific limit cvars
Added nade-specific limit cvars for each action type
Added nl_limit_buy, works similarly to nl_limit_use
Negative values no longer have any effect
Changed some default values (see CVars section for details)
0.4:
Added nbl_limit_use cvar
Added nbl_limit_msg cvar
Added nbl_all cvar
Setting a limit to 0 now disables that specific limit
Various bug fixes
Reorganized some code
Fixed tag mismatch compiler warnings
0.3:
Bug fix for rebuy/autobuy
0.2:
Bug fix
Added nbl_reset command
0.1:
Initial release
Attached Files
File Type: txt nadelimit.txt (603 Bytes, 1546 views)
File Type: sma Get Plugin or Get Source (nadelimit.sma - 3453 views - 13.5 KB)

Last edited by K.Nk; 03-10-2012 at 08:59.
K.Nk is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-01-2012 , 04:55   Re: Grenade Buying Limit (Block Nade Spam)
Reply With Quote #2

You forgot the rebuy/autobuy feature that can only be accessed with cstrike module forward CS_InternalCommand.

Also, for buy detection, i suggest you to use client_buy forward, or its method, you can also find orpheu way at #6, code is shorter.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-01-2012 , 05:02   Re: Grenade Buying Limit (Block Nade Spam)
Reply With Quote #3

The plugin linked is more complete, can be configured by max number of grenades per round and by time between two grenades thrown. Also, it hooks GiveAmmo which would be more reliable and would catch all the case whatever grenade bought or given.

Therefore, your plugin is kind of redundant.
__________________

Last edited by Arkshine; 03-01-2012 at 05:04.
Arkshine is offline
K.Nk
Junior Member
Join Date: Mar 2012
Old 03-01-2012 , 09:42   Re: Grenade Buying Limit (Block Nade Spam)
Reply With Quote #4

Quote:
Originally Posted by ConnorMcLeod View Post
You forgot the rebuy/autobuy feature that can only be accessed with cstrike module forward CS_InternalCommand.

Also, for buy detection, i suggest you to use client_buy forward, or its method, you can also find orpheu way at #6, code is shorter.
Thanks for the reference. I actually looked at restmenu.amxx and saw that cstrike.inc wasn't included so I thought CS_InternalCommand wan't needed anyway. Apparently I should've tested this code more thoroughly. The first post has been updated.


Quote:
Originally Posted by Arkshine View Post
The plugin linked is more complete, can be configured by max number of grenades per round and by time between two grenades thrown. Also, it hooks GiveAmmo which would be more reliable and would catch all the case whatever grenade bought or given.

Therefore, your plugin is kind of redundant.
That's the point though. This plugin place restriction on the number of nades you can *buy* and is designed to not interfere with players picking up dropped grenades, or using grenades given by admins, just like how restmenu.amxx does not prevent admin from giving everyone a restricted weapon. The description of Hobo Nade Management gives you the impression of that, but it actually does something quite different.

Looking at the source code for Hobo Nade Management, it has a whole function dedicated to ensure that players won't get slapped around when they try to pickup some dropped grenade. However that function fails to deal with any custom nade drop plugin. The function itself is also not written correctly - the plugin allows you to specific nade limit for each team, but the function pulls the number from ct's limit only.

Also, Hobo Nade Management does not limit the frequency in which you can throw grenades like you mentioned. It does allow nades from being thown near the beginning of a round, but that's an entirely separate feature. I can make another plugin for it if you'd like (there's no reason this feature should be restricted to nades only).

Last edited by K.Nk; 03-01-2012 at 19:41.
K.Nk is offline
K.Nk
Junior Member
Join Date: Mar 2012
Old 03-02-2012 , 06:02   Re: Grenade Buying Limit (Block Nade Spam)
Reply With Quote #5

Plug-in updated.
- Can now limit the number of times a player can use a certain type of grenade instead of the number of times they can buy
- Option to inform player when they've reached the limit instead of when they tries to exceed it.
- New nbl_all cvar to limit total nade count.
- Various bug fixes; now this plug-in actually works properly (or at least I believe it to be the case)

Btw, could someone change the title of this thread to
Grenade Buy/Use Limit (Block Nade Spam) please? I think it better describes what this plugin tries to do, thanks!
K.Nk is offline
K.Nk
Junior Member
Join Date: Mar 2012
Old 03-09-2012 , 09:14   Re: Grenade Buying Limit (Block Nade Spam)
Reply With Quote #6

*Updated.

Likely the the last version for a while. Nothing really left to change.
K.Nk is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-09-2012 , 09:17   Re: Grenade Buying Limit (Block Nade Spam)
Reply With Quote #7

Could you avoid to glue all together ? Right now, the plugin is fairly unreadable and make difficult the task of reviewing.
__________________

Last edited by Arkshine; 03-09-2012 at 09:18.
Arkshine is offline
K.Nk
Junior Member
Join Date: Mar 2012
Old 03-09-2012 , 20:10   Re: Grenade Buying Limit (Block Nade Spam)
Reply With Quote #8

Sorry about all the mess. I took a few minutes to reorganize all of the code, merged some functions, added coments etc. It should now be much more readable. (At least most lines now fall under 80 columns haha)

Please let me know if there's any other problem with the code. Thanks!

Also updated description. (say /nl -> client commands)

Last edited by K.Nk; 03-09-2012 at 21:16.
K.Nk is offline
aganfitra
Junior Member
Join Date: Nov 2011
Old 10-30-2012 , 23:13   Re: Grenade Buying Limit (Block Nade Spam)
Reply With Quote #9

can u make it for primary and secondary weapon?

i need plugin to buy only 1 gun in every round, 1 gun primary and 1 gun secondary
aganfitra is offline
radudiabolic
Junior Member
Join Date: Nov 2012
Old 12-21-2012 , 19:21   Re: Grenade Buying Limit (Block Nade Spam)
Reply With Quote #10

won't work with Furien mod can you make it for Furien mod? please

Last edited by radudiabolic; 12-21-2012 at 19:22.
radudiabolic is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode