AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Some help to block flashbangs spam (https://forums.alliedmods.net/showthread.php?t=193946)

dark_style 08-24-2012 03:50

Some help to block flashbangs spam
 
Example code:

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <cl_buy>

const g_iFlash_Max_Carry 2// max boughts per round

new g_iFlash33 ];

new 
b_Blocked33 ];

public 
client_buyiditem )
{
    if( 
item == CSW_FLASHBANG )
    {
        
g_iFlashid ]++
        
        
g_iFlashid ] = cs_get_user_bpammoidCSW_FLASHBANG );
        
        if( 
g_iFlashid ] == g_iFlash_Max_Carry )
        {
            
b_Blockedid ] = true;
            
client_printidprint_center"You can't buy more flashbangs this round!" );
            return 
PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_CONTINUE;


I have used grenade_throw from csx and blocked the flash but this way I can't make sure he had bought 2 flashes... any ideas?

What I mean is - I can block the flashbang in grenade_throw, but the player should have bought 1 grenade so he wouldn't be able to buy another one until the new round, I hope you got what I want to say.


I res the bool's value at new round.

lucas_7_94 08-24-2012 08:00

Re: Some help to block flashbangs spam
 
Spoiler

dark_style 08-24-2012 08:07

Re: Some help to block flashbangs spam
 
Eh, thanks lucas. I thought I should make checks about the currently ammo etc .. and at the same time it should be created that simple... :oops:


All times are GMT -4. The time now is 05:44.

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