Raised This Month: $ Target: $400
 0% 

Blocking Buy Commands (Basic)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
fezh
Veteran Member
Join Date: Dec 2008
Location: BANNED
Old 09-04-2009 , 12:09   Blocking Buy Commands (Basic)
Reply With Quote #1

PHP Code:
#include <amxmodx>

// Here is the name of all "buy weapons" commands of CS, took from CS Weapons Information (AM Wiki).
// Is a tridimensional array because I'm going to use it in a loop, but actually this is not necessary,
// you can register all commands separately, but I think this is the easier & clean way to do it.
new gBuyCommands[][] = 
{
     
"usp""glock""deagle""p228""elites""fn57""m3""xm1014""mp5""tmp""p90""mac10""ump45""ak47"
    
"galil""famas""sg552""m4a1""aug""scout""awp""g3sg1""sg550""m249""vest""vesthelm""flash""hegren",
    
"sgren""defuser""nvgs""shield""primammo""secammo""km45""9x19mm""nighthawk""228compact""12gauge",
    
"autoshotgun""smg""mp""c90""cv47""defender""clarion""krieg552""bullpup""magnum""d3au1""krieg550",
    
"buyammo1""buyammo2"
}

// Variable that I'm going to use to register the pCVAR.
new gCvarPluginToggle

public plugin_init()
{
    
// I think there is no need for explain this.
    
register_plugin("Block Buy Example""0.1.0""fezh")

    
// Toggle CVAR
    
gCvarPluginToggle register_cvar("amx_block_buy""1")

    
// Registering commands. As I said before, there is no need for creating a loop, but I like it anyways :P
    
for (new isizeof gBuyCommandsi++)
        
register_clcmd(gBuyCommands[i], "BlockBuyCommands")
}

public 
BlockBuyCommands(id)
{
    
// If the plugin don't get the CVAR, it makes you buy normally.
    
if (!get_pcvar_num(gCvarPluginToggle))
        return 
PLUGIN_CONTINUE;

    
// Block the buy commands.
    
return PLUGIN_HANDLED;
}

// Final comments: I did the "tutorial" since I saw that there are some weirds (and not actually functional) ways to do it, 
// like in the plugin called "Block Commands". 
__________________
"There is no knowledge, that is not power"

Last edited by fezh; 01-23-2010 at 11:38.
fezh is offline
 



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 21:44.


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