Another version of this plugin. I want only take bomb with comand /take once per round.
Code:
#include < amxmodx >
#include < cstrike >
#include < fakemeta_util >
#include < colorchat >
#define PLUGIN_NAME "Take the bomb"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "author"
#define MAX_CLIENTS 32
#define MAX_LENGHT_NAME 32
new bool:g_bLimit;
public plugin_init( )
{
register_plugin
(
PLUGIN_NAME,
PLUGIN_VERSION,
PLUGIN_AUTHOR
);
register_event( "HLTV", "CEvent__Round_Start", "a", "1=0", "2=0" );
register_clcmd( "say /take", "ClCommand__TakeBomb" );
register_clcmd( "take", "ClCommand__TakeBomb" );
}
public CEvent__Round_Start( )
{
g_bLimit = false;
}
public ClCommand__TakeBomb( pPlayer )
{
if( !is_user_alive( pPlayer ) )
{
ColorChat( pPlayer, GREEN, "^1[^4Bomb^1] You have to be alive!" );
return PLUGIN_HANDLED;
}
if( cs_get_user_team( pPlayer ) != CS_TEAM_T )
{
ColorChat( pPlayer, GREEN, "^1[^4Bomb^1] You have to play for the team ^4Terrorists^1!" );
return PLUGIN_HANDLED;
}
if( g_bLimit )
{
ColorChat( pPlayer, GREEN, "^1[^4Bomb^1] Only ^4once ^1per round you can take the bomb!" );
return PLUGIN_HANDLED;
}
new bool:bHasBomb = false;
new aPlayers[ MAX_CLIENTS ], szName[ MAX_LENGHT_NAME ], iNum, i, iPlayer; get_players( aPlayers, iNum, "ae", "TERRORIST" );
for( i = 0; i < iNum; i++ )
{
iPlayer = aPlayers[ i ];
if( user_has_weapon( iPlayer, CSW_C4 ) )
{
bHasBomb = true;
g_bLimit = true;
fm_transfer_user_gun( iPlayer, pPlayer, CSW_C4 );
get_user_name( pPlayer, szName, charsmax ( szName ) );
ColorChat( 0, GREEN, "^1[^4Bomb^1] %s took a bomb!", szName );
}
}
if( !bHasBomb )
ColorChat( pPlayer, GREEN, "^1[^4Bomb^1] No players ^4with a bomb^1!" );
return PLUGIN_HANDLED;
}