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

Disable smoke grenade?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GBLTeam
Senior Member
Join Date: Mar 2012
Location: Republic of Macedonia
Old 02-10-2020 , 16:15   Disable smoke grenade?
Reply With Quote #1

How i can remove or disable smoke grenade so no one can get it? Thanks !
GBLTeam is offline
Send a message via MSN to GBLTeam Send a message via Skype™ to GBLTeam
Vancold
Member
Join Date: Jan 2015
Old 02-11-2020 , 08:52   Re: Disable smoke grenade?
Reply With Quote #2

Hey,

it's rather simple.
All you have to use is the forward CS_OnBuyAttempt(id,item) and check if the item is a CSW_SMOKEGRENADE (constant)

That way you can block out anyone from buying smoke grenades.


What is important is that you have to write the code this way:

Return
PLUGIN_CONTINUE to let the buy attempt continue
PLUGIN_HANDLED to block the buy attempt

That means if the player is trying to buy a smokegrenade (which you check with an if-condition) you just return plugin_handled. IF the player buys something else you return plugin_continue.


Have fun
Vancold

Last edited by Vancold; 02-11-2020 at 08:54.
Vancold is offline
thEsp
BANNED
Join Date: Aug 2017
Old 02-11-2020 , 12:52   Re: Disable smoke grenade?
Reply With Quote #3

AMXX provides a weapon restriction system by default. If I remember correctly you can configure it from "amxmodxmenu" command.
thEsp is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-11-2020 , 13:37   Re: Disable smoke grenade?
Reply With Quote #4

Quote:
Originally Posted by Vancold View Post
Hey,

it's rather simple.
All you have to use is the forward CS_OnBuyAttempt(id,item) and check if the item is a CSW_SMOKEGRENADE (constant)

That way you can block out anyone from buying smoke grenades.


What is important is that you have to write the code this way:

Return
PLUGIN_CONTINUE to let the buy attempt continue
PLUGIN_HANDLED to block the buy attempt

That means if the player is trying to buy a smokegrenade (which you check with an if-condition) you just return plugin_handled. IF the player buys something else you return plugin_continue.


Have fun
Vancold
Remember that this works only in AMXX 1.9 or above.
__________________

Last edited by OciXCrom; 02-11-2020 at 13:37.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply



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 02:53.


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