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

Give the Bomb!


Post New Thread Reply   
 
Thread Tools Display Modes
wer1K
Member
Join Date: Jan 2011
Old 07-23-2015 , 21:04   Re: Give the Bomb!
Reply With Quote #11

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;
}

Last edited by wer1K; 09-30-2015 at 20:47.
wer1K is offline
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 16:41.


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