Cerere Plugin simplu

Modificari necesare ale pluginurilor

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Post Reply
User avatar
Te-am_prins2013
Membru, skill 0
Membru, skill 0
Posts: 52
Joined: 24 Sep 2013, 14:41
Detinator Steam: Da
CS Status: Nu e aim, nu e bulan, e Talentu.exe
Detinator server CS: Dr.Europacs.Ro
Has thanked: 10 times
Been thanked: 2 times
Contact:

02 Dec 2013, 22:51

Salut am si eu acest plugin
| Afiseaza codul
/***
 * Link to the plugin
 *
 *	http://forums.alliedmods.net/showthread.php?t=78197
 */

#include < amxmodx >
#include < engine >
#include < cstrike >
#include < fun >
#include < fakemeta >
#include < hamsandwich >

#pragma semicolon 1

// Comment this line if you do not want to have fake player !
#define FAKE_PLAYER

// Bot name
#if defined FAKE_PLAYER
	new const g_szBotName[ ] = "DRM Fake Player";
#endif

// Messages prefix
new const g_szPrefix[ ] = "[ Deathrun ]";

// Global Variables
new bool:g_bHauntedHouse, bool:g_bGamerFun, bool:g_bRandromized, bool:g_bStarting, bool:g_bFirstRound;
new bool:g_bEnabled, bool:g_bRestart, bool:g_bConnected[ 33 ];

new g_pRemoveBuyZone, g_pHideHuds, g_pBlockMoney, g_pLifeSystem, g_pSvRestart, g_pAutoBalance, g_pLimitTeams;
new g_pNoFallDmg, g_pGameName, g_pToggle, g_pBlockSpray, g_pBlockRadio, g_pSemiclip, g_pGiveUsp, g_pBlockKill;

new g_iMsgHideWeapon, g_iMsgCrosshair, g_iMsgMoney, g_iMsgTeamInfo, g_iMsgSayText;
new g_iMaxplayers, g_iHudSync, g_iHudSync2, g_iLastTerr, g_iThinker;
new g_iSemiClip[ 33 ], g_Lifes[ 33 ];

#if defined FAKE_PLAYER
	new g_iFakeplayer;
#endif

// Macros
#if cellbits == 32
	#define OFFSET_BZ 235
#else
	#define OFFSET_BZ 268
#endif

// Colorchat
enum Color {
	NORMAL = 1,
	GREEN,
	RED,
	BLUE
};

new TeamName[ ][ ] = {
	"",
	"TERRORIST",
	"CT",
	"SPECTATOR"
};

// =======================================================================================

public plugin_init( ) {
	new const VERSION[ ] = "3.0.3";
	
	register_plugin( "Deathrun Manager", VERSION, "xPaw" );
	
	g_pToggle        = register_cvar( "deathrun_toggle",     "1" );
	g_pBlockSpray    = register_cvar( "deathrun_spray",      "1" );
	g_pBlockRadio    = register_cvar( "deathrun_radio",      "1" );
	g_pBlockKill     = register_cvar( "deathrun_blockkill",  "1" );
	g_pBlockMoney    = register_cvar( "deathrun_blockmoney", "1" );
	g_pSemiclip      = register_cvar( "deathrun_semiclip",   "1" );
	g_pGiveUsp       = register_cvar( "deathrun_giveusp",    "1" );
	g_pHideHuds      = register_cvar( "deathrun_hidehud",    "1" );
	g_pLifeSystem    = register_cvar( "deathrun_lifesystem", "1" );
	g_pGameName      = register_cvar( "deathrun_gamename",   "1" );
	g_pNoFallDmg     = register_cvar( "deathrun_terrnfd",    "1" );
	g_pRemoveBuyZone = register_cvar( "deathrun_removebz",   "1" );
	
	// Lets get map name...
	new szMapName[ 64 ];
	get_mapname( szMapName, 63 );
	
	if( contain( szMapName, "deathrun_" ) != -1 ) {
		set_pcvar_num( g_pToggle, 1 );
		
		if( contain( szMapName, "hauntedhouse" ) != -1 )
			g_bHauntedHouse = true;
		else {
			g_bHauntedHouse = false;
			
			if( equal( szMapName, "deathrun_gamerfun" ) )
				g_bGamerFun = true;
			else
				g_bGamerFun = false;
		}
	} else
		set_pcvar_num( g_pToggle, 0 );
	
	g_pSvRestart   = get_cvar_pointer( "sv_restart" );
	g_pAutoBalance = get_cvar_pointer( "mp_autoteambalance" );
	g_pLimitTeams  = get_cvar_pointer( "mp_limitteams" );
	
	register_cvar( "deathrun_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY );
	set_cvar_string( "deathrun_version", VERSION );
	
	// Registering Language file
	register_dictionary( "deathrun.txt" );
	
	// Logging Events
	register_logevent( "EventRoundStart", 2, "1=Round_Start" );
	register_logevent( "EventRandromize", 2, "1=Round_End" );
	register_event( "SendAudio", "EventTerrsWin",   "a", "2&%!MRAD_terwin" );
	register_event( "TextMsg",	 "EventRandromize", "a", "2&#Game_w" );
	register_event( "DeathMsg",	 "EventDeath",      "a");
	register_event( "Money",	 "EventMoney",      "b" );
	register_event( "ResetHUD",	 "EventResetHud",   "be" );
	
	g_bFirstRound    = true;
	g_iMaxplayers    = get_maxplayers( );
	g_iMsgHideWeapon = get_user_msgid( "HideWeapon" );
	g_iMsgCrosshair  = get_user_msgid( "Crosshair" );
	g_iMsgMoney      = get_user_msgid( "Money" );
	g_iMsgSayText    = get_user_msgid( "SayText" );
	g_iMsgTeamInfo   = get_user_msgid( "TeamInfo" );
	
	g_iHudSync       = CreateHudSyncObj( );
	g_iHudSync2      = CreateHudSyncObj( );
	
	if( get_pcvar_num( g_pToggle ) ) {
		RegisterHam( Ham_TakeDamage, "player", "FwdHamPlayerDamage" );
		RegisterHam( Ham_Spawn,      "player", "FwdHamPlayerSpawn", 1 );
		register_forward( FM_ClientKill,       "FwdClientKill" );
		register_impulse( 201, "FwdImpulse_201" );
		
		if( get_pcvar_num( g_pGameName ) )
			register_forward( FM_GetGameDescription, "FwdGameDesc" );
		
		register_clcmd( "say /lifes", "CmdShowlifes" );
		register_clcmd( "say /lives", "CmdShowlifes" );
		
		register_clcmd( "radio1", "CmdRadio" );
		register_clcmd( "radio2", "CmdRadio" );
		register_clcmd( "radio3", "CmdRadio" );
		
		// Terrorist Check
		g_iThinker= create_entity( "info_target" );
		
		if( is_valid_ent( g_iThinker ) ) {
			entity_set_string( g_iThinker, EV_SZ_classname, "DeathrunThinker" );
			entity_set_float( g_iThinker, EV_FL_nextthink, get_gametime( ) + 20.0 );
			
			g_bRestart = true;
			
			// First think will happen in 20.0, Restart will be done there.
			
			register_think( "DeathrunThinker", "FwdThinker" );
		} else {
			set_task( 15.0, "CheckTerrorists", _, _, _, "b" );
			
			// Lets make restart after 20 seconds from map start.
			set_task( 20.0, "RestartRound" );
		}
		
		if( get_pcvar_num( g_pRemoveBuyZone ) ) {
			register_message( get_user_msgid( "StatusIcon" ), "MsgStatusIcon" ); // BuyZone Icon
			
			// Remove buyzone on map
			remove_entity_name( "info_map_parameters" );
			remove_entity_name( "func_buyzone" );
			
			// Create own entity to block buying
			new iEntity = create_entity( "info_map_parameters" );
			
			DispatchKeyValue( iEntity, "buying", "3" );
			DispatchSpawn( iEntity );
		}
		
		if( get_pcvar_num( g_pSemiclip ) ) {
			register_forward( FM_StartFrame,	"FwdStartFrame", 0 );
			register_forward( FM_AddToFullPack,	"FwdFullPack",   1 );
		}
		
		g_bEnabled = true;
		
	#if defined FAKE_PLAYER
		new iEntity, iCount;
		
		while( ( iEntity = find_ent_by_class( iEntity, "info_player_deathmatch" ) ) > 0 )
			if( iCount++ > 1 )
				break;
		
		if( iCount <= 1 )
			g_iFakeplayer = -1;
		
		set_task( 5.0, "UpdateBot" );
		
		register_message( get_user_msgid( "DeathMsg" ), "MsgDeathMsg" );
	#endif
	} else
		g_bEnabled = false;
}

// FAKEPLAYER
///////////////////////////////////////////
#if defined FAKE_PLAYER
	public UpdateBot( ) {
		if( g_iFakeplayer == -1 )
			return;
		
		new id = find_player( "i" );
		
		if( !id ) {
			id = engfunc( EngFunc_CreateFakeClient, g_szBotName );
			if( pev_valid( id ) ) {
				engfunc( EngFunc_FreeEntPrivateData, id );
				dllfunc( MetaFunc_CallGameEntity, "player", id );
				set_user_info( id, "rate", "3500" );
				set_user_info( id, "cl_updaterate", "25" );
				set_user_info( id, "cl_lw", "1" );
				set_user_info( id, "cl_lc", "1" );
				set_user_info( id, "cl_dlmax", "128" );
				set_user_info( id, "cl_righthand", "1" );
				set_user_info( id, "_vgui_menus", "0" );
				set_user_info( id, "_ah", "0" );
				set_user_info( id, "dm", "0" );
				set_user_info( id, "tracker", "0" );
				set_user_info( id, "friends", "0" );
				set_user_info( id, "*bot", "1" );
				set_pev( id, pev_flags, pev( id, pev_flags ) | FL_FAKECLIENT );
				set_pev( id, pev_colormap, id );
				
				new szMsg[ 128 ];
				dllfunc( DLLFunc_ClientConnect, id, g_szBotName, "127.0.0.1", szMsg );
				dllfunc( DLLFunc_ClientPutInServer, id );
				
				cs_set_user_team( id, CS_TEAM_T );
				ExecuteHamB( Ham_CS_RoundRespawn, id );
				
				set_pev( id, pev_effects, pev( id, pev_effects ) | EF_NODRAW );
				set_pev( id, pev_solid, SOLID_NOT );
				dllfunc( DLLFunc_Think, id );
				
				g_iFakeplayer = id;
			}
		}
	}
	
	public MsgDeathMsg( const iMsgId, const iMsgDest, const id ) {
		if( get_msg_arg_int( 2 ) == g_iFakeplayer )
			return PLUGIN_HANDLED;
		
		return PLUGIN_CONTINUE;
	}
#endif

// NEW TERRORIST
///////////////////////////////////////////
public EventRandromize( ) {
	if( !g_bEnabled || g_bFirstRound || g_bRandromized )
		return PLUGIN_CONTINUE;
	
	g_bRandromized = true;
	
	new i, iPlayers[ 32 ], iNum, iPlayer;
	get_players( iPlayers, iNum, "c" );
	
	if( iNum <= 1 )
		return PLUGIN_CONTINUE;
	
	for( i = 0; i < iNum; i++ ) {
		iPlayer = iPlayers[ i ];
		
		if( cs_get_user_team( iPlayer ) == CS_TEAM_T )
			cs_set_user_team( iPlayer, CS_TEAM_CT );
	}
	
	new iRandomPlayer, CsTeams:iTeam;
	
	while( ( iRandomPlayer = iPlayers[ random_num( 0, iNum - 1 ) ] ) == g_iLastTerr ) { }
	
	g_iLastTerr = iRandomPlayer;
	
	iTeam = cs_get_user_team( iRandomPlayer );
	
	if( iTeam == CS_TEAM_T || iTeam == CS_TEAM_CT ) {
		cs_set_user_team(iRandomPlayer, CS_TEAM_T);
		
		new szName[ 32 ];
		get_user_name( iRandomPlayer, szName, 31 );
		
		for( i = 0; i < iNum; i++ )
			ColorChat(iPlayers[ i ], RED, "%s^4 %L", g_szPrefix, iPlayers[ i ], "DR_NOW_TERR", szName);
		
		if( !g_bRestart && is_valid_ent( g_iThinker ) )
			entity_set_float( g_iThinker, EV_FL_nextthink, get_gametime( ) + 15.0 );
	} else {
		g_bRandromized = false;
		EventRandromize( );
	}
	
	return PLUGIN_CONTINUE;
}

// NEW ROUND
///////////////////////////////////////////
public EventRoundStart( ) {
	if( !g_bEnabled )
		return PLUGIN_CONTINUE;
	
	g_bRandromized	= false;
	g_bStarting	= false;
	
	new i, iPlayers[ 32 ], iNum, iRealPlayers, CsTeams:iTeam;
	get_players( iPlayers, iNum, "c" );
	
	if( iNum <= 1 )
		return PLUGIN_CONTINUE;
	
	for( i = 0; i < iNum; i++ ) {
		iTeam = cs_get_user_team( iPlayers[ i ] );
		
		if( iTeam == CS_TEAM_T || iTeam == CS_TEAM_CT )
			iRealPlayers++;
	}
	
	if( iRealPlayers <= 1 ) {
		set_hudmessage( 0, 128, 0, -1.0, 0.1, 0, 4.0, 4.0, 0.5, 0.5, 4 );
		
		for( i = 0; i < iNum; i++ )
			ShowSyncHudMsg( iPlayers[ i ], g_iHudSync, "%L", iPlayers[ i ], "DR_NOT_ENOUGH" );
		
		return PLUGIN_CONTINUE;
	}
	
	set_pcvar_num( g_pAutoBalance, 0 );
	set_pcvar_num( g_pLimitTeams, 0 );
	
	if( g_bFirstRound ) {
		set_hudmessage( 0, 128, 0, -1.0, 0.1, 0, 4.0, 4.0, 0.5, 0.5, 4 );
		
		for( i = 0; i < iNum; i++ ) {
			ShowSyncHudMsg( iPlayers[ i ], g_iHudSync, "%L", iPlayers[ i ], "DR_STARTING" );
			
			ColorChat( iPlayers[ i ], RED, "%s^1 %L", g_szPrefix, iPlayers[ i ], "DR_STARTING_CC" );
		}
		
		if( is_valid_ent( g_iThinker ) ) {
			g_bRestart = true;
			
			entity_set_float( g_iThinker, EV_FL_nextthink, get_gametime( ) + 9.0 );
		} else
			set_task( 9.0, "RestartRound" );
		
		g_bStarting = true;
		g_bFirstRound = false;
	}
	
	return PLUGIN_CONTINUE;
}

// CHECK TERRORIST
///////////////////////////////////////////
public FwdThinker( iEntity ) {
	if( g_bRestart ) {
		g_bRestart = false;
		
		RestartRound( );
	} else
		CheckTerrorists( );
	
	entity_set_float( iEntity, EV_FL_nextthink, get_gametime( ) + 15.0 );
}

public CheckTerrorists( ) {
	if( !g_bEnabled || g_bFirstRound || g_bStarting )
		return PLUGIN_CONTINUE;
	
	new i, iPlayers[ 32 ], iTerrors, iNum, iRealPlayers, CsTeams:iTeam;
	get_players( iPlayers, iNum, "c" );
	
	if( iNum <= 1 )
		return PLUGIN_CONTINUE;
	
	for( i = 0; i < iNum; i++ ) {
		iTeam = cs_get_user_team( iPlayers[ i ] );
		
		if( iTeam == CS_TEAM_T )
			iTerrors++;
		
		if( iTeam == CS_TEAM_T || iTeam == CS_TEAM_CT )
			iRealPlayers++;
	}
	
	if( iRealPlayers <= 1 ) {
		set_hudmessage( 0, 128, 0, -1.0, 0.1, 0, 4.0, 4.0, 0.5, 0.5, 4 );
		
		for( i = 0; i < iNum; i++ )
			ShowSyncHudMsg( iPlayers[ i ], g_iHudSync, "%L", iPlayers[ i ], "DR_NOT_ENOUGH" );
		
		return PLUGIN_CONTINUE;
	}
	
	if( iTerrors == 0 ) {
		for( i = 0; i < iNum; i++ ) {
			ColorChat(iPlayers[ i ], RED, "%s^1 %L", g_szPrefix, iPlayers[ i ], "DR_NO_DETECT");
			
			if( is_user_alive( iPlayers[ i ] ) && cs_get_user_team( iPlayers[ i ] ) == CS_TEAM_CT )
				user_silentkill( iPlayers[ i ] );
		}
		
		set_task( 0.5, "EventRandromize" );
	}
	
	return PLUGIN_CONTINUE;
}

// LIFE SYSTEM
///////////////////////////////////////////
public EventTerrsWin( ) {
	if( !g_bEnabled || g_bFirstRound )
		return PLUGIN_CONTINUE;
	
	new iPlayers[ 32 ], iNum, iPlayer;
	get_players( iPlayers, iNum, "c" );
	
	if( iNum <= 1 )
		return PLUGIN_CONTINUE;
	
	new iLifeCvar = get_pcvar_num( g_pLifeSystem );
	
	for( new i = 0; i < iNum; i++ ) {
		iPlayer = iPlayers[ i ];
		
		if( cs_get_user_team( iPlayer ) == CS_TEAM_T ) {
			set_user_frags( iPlayer, get_user_frags( iPlayer ) + 3 );
			
			if( iLifeCvar == 2 )
				g_Lifes[ iPlayer ]++;
		}
	}
	
	return PLUGIN_CONTINUE;
}

public EventDeath( ) {
	if( !g_bEnabled )
		return PLUGIN_CONTINUE;
	
#if defined FAKE_PLAYER
	new iVictim = read_data( 2 );
	new iTeam = get_user_team( iVictim );
	
	if( iTeam == 1 && is_user_alive( g_iFakeplayer ) )
		fakedamage( g_iFakeplayer, "worldspawn", 100.0, DMG_GENERIC );
	
	if( !get_pcvar_num( g_pLifeSystem ) )
		return PLUGIN_CONTINUE;
#else
	if( !get_pcvar_num( g_pLifeSystem ) )
		return PLUGIN_CONTINUE;
	
	new iVictim = read_data( 2 );
	new iTeam = get_user_team( iVictim );
#endif
	
	new iKiller = read_data( 1 );
	
	if( iKiller != iVictim && get_user_team(iKiller) != iTeam )
		g_Lifes[iKiller]++;
	
	if( cs_get_user_team( iVictim ) == CS_TEAM_CT && g_Lifes[ iVictim ] > 0 ) {
		new iCTcount;
		for( new i = 1; i <= g_iMaxplayers; i++ ) {
			if( is_user_alive( i ) && cs_get_user_team( i ) == CS_TEAM_CT )
				iCTcount++;
		}
		
		if( iCTcount > 1 ) {
			set_task(3.2, "fnRevivePlayer", iVictim);
			
			ColorChat( iVictim, RED, "%s^1 %L", g_szPrefix, iVictim, "DR_LIFE_RESPAWN" );
		}
		/*else
			ColorChat( iVictim, RED, "%s^1 %L", g_szPrefix, iVictim, "DR_LIFE_CANT" );*/
	}
	
	return PLUGIN_CONTINUE;
}

public fnRevivePlayer( id ) {
	if( g_bConnected[ id ] ) {
		if( cs_get_user_team( id ) == CS_TEAM_CT ) {
			new iCTcount;
			for( new i = 1; i <= g_iMaxplayers; i++ )
				if( is_user_alive( i ) && cs_get_user_team( i ) == CS_TEAM_CT )
					iCTcount++;
			
			if( iCTcount > 1 ) {
				ExecuteHamB( Ham_CS_RoundRespawn, id );
				
				g_Lifes[ id ]--;
			}
		}
	}
}

public CmdShowlifes( id ) {
	if( get_pcvar_num( g_pLifeSystem ) == 0 ) {
		ColorChat( id, RED, "%s^1 %L", g_szPrefix, id, "DR_LIFE_DISABLE" );
		return PLUGIN_HANDLED;
	}
	
	if( g_Lifes[ id ] > 0 )
		ColorChat( id, RED, "%s^1 %L", g_szPrefix, id, "DR_LIFE_CC_COUNT", g_Lifes[ id ] );
	else
		ColorChat( id, RED, "%s^1 %L", g_szPrefix, id, "DR_LIFE_CC_NO" );
	
	return PLUGIN_HANDLED;
}

public Showlifes( id ) {
	set_hudmessage( 0, 128, 0, 0.04, 0.71, 0, 2.5, 2.5, 0.5, 0.5, 3 );
	
	if( g_Lifes[ id ] > 0 )
		ShowSyncHudMsg( id, g_iHudSync2, "%L", id, "DR_LIFE_COUNT", g_Lifes[ id ] );
	else
		ShowSyncHudMsg( id, g_iHudSync2, "%L", id, "DR_LIFE_NO" );
}

// EVENTS
///////////////////////////////////////////
public EventResetHud( id ) {
	if( g_bEnabled && get_pcvar_num( g_pHideHuds ) && !is_user_bot( id ) ) {
		message_begin( MSG_ONE_UNRELIABLE, g_iMsgHideWeapon, _, id );
		write_byte( ( 1<<4 | 1<<5 ) );
		message_end( );
		
		message_begin( MSG_ONE_UNRELIABLE, g_iMsgCrosshair, _, id );
		write_byte( 0 );
		message_end( );
	}
}

public EventMoney( id ) {
	if( g_bEnabled && get_pcvar_num( g_pBlockMoney ) ) {
		set_pdata_int( id, 115, 0 );
		
		message_begin( MSG_ONE_UNRELIABLE, g_iMsgMoney, _, id );
		write_long ( 0 );
		write_byte ( 1 );
		message_end( );
	}
}

public client_putinserver( id )
	g_bConnected[ id ] = true;

public client_disconnect( id ) {
	g_bConnected[ id ] = false;
	CheckTerrorists( );
	
	if( !g_bRestart && is_valid_ent( g_iThinker ) )
		entity_set_float( g_iThinker, EV_FL_nextthink, get_gametime( ) + 15.0 );
	
#if defined FAKE_PLAYER
	if( g_iFakeplayer == id ) {
		set_task( 1.5, "UpdateBot" );
		
		g_iFakeplayer = 0;
	}
#endif
}

// SEMICLIP
///////////////////////////////////////////
public FwdFullPack( es, e, ent, host, flags, player, pSet ) {
	if( !g_bEnabled )
		return FMRES_IGNORED;
	
	if( player && g_iSemiClip[ ent ] && g_iSemiClip[ host ] ) {
		set_es( es, ES_Solid, SOLID_NOT );
		set_es( es, ES_RenderMode, kRenderTransAlpha );
		set_es( es, ES_RenderAmt, 85 );
	}
	
	return FMRES_IGNORED;
}

public FwdStartFrame( ) {
	if( !g_bEnabled )
		return FMRES_IGNORED;
	
	static iPlayers[ 32 ], iNum, iPlayer, iPlayer2, i, j;
	get_players( iPlayers, iNum, "ache", "CT" );
	
	arrayset( g_iSemiClip, 0, 32 );
	
	if( iNum <= 1 )
		return FMRES_IGNORED;
	
	for( i = 0; i < iNum; i++ ) {
		iPlayer = iPlayers[ i ];
		
		for( j = 0; j < iNum; j++ ) {
			iPlayer2 = iPlayers[ j ];
			
			if( iPlayer == iPlayer2 )
				continue;
			
			if( g_iSemiClip[ iPlayer ] && g_iSemiClip[ iPlayer2 ] )
				continue;
			
			if( entity_range( iPlayer, iPlayer2 ) < 128 ) {
				g_iSemiClip[ iPlayer ]	= true;
				g_iSemiClip[ iPlayer2 ]	= true;
			}
		}
	}
	
	for( i = 0; i < iNum; i++ ) {
		iPlayer = iPlayers[ i ];
		
		set_pev( iPlayer, pev_solid, g_iSemiClip[ iPlayer ] ? SOLID_NOT : SOLID_SLIDEBOX );
	}
	
	return FMRES_IGNORED;
}

// FORWARDS
///////////////////////////////////////////
public FwdHamPlayerSpawn( id ) {
	if( !g_bEnabled || !is_user_alive( id ) )
		return HAM_IGNORED;
	
	if( get_pcvar_num( g_pBlockRadio ) ) // thanks to ConnorMcLeod for this good way :)
		set_pdata_int( id, 192, 0 );
	
#if defined FAKE_PLAYER
	if( g_iFakeplayer == id ) {
		set_pev( id, pev_frags, -1000.0 );
		cs_set_user_deaths( id, -1000 );
		
		set_pev( id, pev_effects, pev( id, pev_effects ) | EF_NODRAW );
		set_pev( id, pev_solid, SOLID_NOT );
		entity_set_origin( id, Float:{ 999999.0, 999999.0, 999999.0 } );
		dllfunc( DLLFunc_Think, id );
	} else {
#endif
		new CsTeams:iTeam = cs_get_user_team( id );
		
		// An small delay for message
		if( get_pcvar_num( g_pLifeSystem ) != 0 && iTeam == CS_TEAM_CT )
			set_task( 0.8, "Showlifes", id );
		
		strip_user_weapons( id );
		give_item( id, "weapon_knife" );
		
		set_pdata_int( id, 116, 0 ); // Pickup fix by ConnorMcLeod
		
		if( g_bGamerFun && iTeam == CS_TEAM_CT )
			give_item( id, "weapon_smokegrenade" );
		
		if( get_pcvar_num( g_pGiveUsp ) && iTeam == CS_TEAM_CT && !g_bHauntedHouse )
			set_task( 1.0, "GiveUsp", id );

#if defined FAKE_PLAYER
	}
#endif
	
	return HAM_IGNORED;
}

public GiveUsp( const id ) {
	if( is_user_alive( id ) ) {
		give_item( id, "weapon_usp" );
		cs_set_user_bpammo( id, CSW_USP, 100 );
	}
}

public FwdGameDesc( ) {
	static const GameName[ ] = "Deathrun v3.0";
	
	forward_return( FMV_STRING, GameName );
	
	return FMRES_SUPERCEDE;
}

public FwdClientKill( const id ) {
	if( !g_bEnabled || !is_user_alive(id) )
		return FMRES_IGNORED;
	
	if( get_pcvar_num( g_pBlockKill ) || cs_get_user_team( id ) == CS_TEAM_T ) {
		client_print( id, print_center, "%L", id, "DR_BLOCK_KILL" );
		client_print( id, print_console, "%L", id, "DR_BLOCK_KILL" );
		
		return FMRES_SUPERCEDE;
	}
	
	return FMRES_IGNORED;
}

public FwdImpulse_201( const id ) {
	if( g_bEnabled && get_pcvar_num( g_pBlockSpray ) ) {
		if( is_user_alive( id ) )
			client_print( id, print_center, "%L", id, "DR_BLOCK_SPRAY" );
		
		return PLUGIN_HANDLED_MAIN;
	}
	
	return PLUGIN_CONTINUE;
}

public FwdHamPlayerDamage( id, idInflictor, idAttacker, Float:flDamage, iDamageBits ) {
	if( get_pcvar_num( g_pNoFallDmg ) )
		if( iDamageBits & DMG_FALL )
			if( get_user_team( id ) == 1 )
				return HAM_SUPERCEDE;
	
	return HAM_IGNORED;
}

public MsgStatusIcon( msg_id, msg_dest, id ) {
	new szIcon[ 8 ];
	get_msg_arg_string( 2, szIcon, 7 );
	
	static const BuyZone[ ] = "buyzone";
	
	if( equal( szIcon, BuyZone ) ) {
		set_pdata_int( id, OFFSET_BZ, get_pdata_int( id, OFFSET_BZ, 5 ) & ~( 1 << 0 ), 5 );
		
		return PLUGIN_HANDLED;
	}
	
	return PLUGIN_CONTINUE;
}

public CmdRadio( id ) {
	if( get_pcvar_num( g_pBlockRadio ) )
		return PLUGIN_HANDLED_MAIN;
	
	return PLUGIN_CONTINUE;
}

public RestartRound( )
	set_pcvar_num( g_pSvRestart, 1 );

// COLORCHAT
/////////////////////////////////////////////
ColorChat( id, Color:type, const szMessage[], {Float,Sql,Result,_}:... ) {
	if( !get_playersnum( ) ) return;
	
	new message[ 256 ];
	
	switch( type ) {
		case NORMAL: message[0] = 0x01;
		case GREEN: message[0] = 0x04;
		default: message[0] = 0x03;
	}
	
	vformat( message[ 1 ], 251, szMessage, 4 );
	
	message[ 192 ] = '^0';
	
	replace_all( message, 191, "\YEL", "^1" );
	replace_all( message, 191, "\GRN", "^4" );
	replace_all( message, 191, "\TEM", "^3" );
	
	new iTeam, ColorChange, index, MSG_Type;
	
	if( id ) {
		MSG_Type = MSG_ONE_UNRELIABLE;
		index = id;
	} else {
		index = CC_FindPlayer();
		MSG_Type = MSG_BROADCAST;
	}
	
	iTeam = get_user_team( index );
	ColorChange = CC_ColorSelection(index, MSG_Type, type);

	CC_ShowColorMessage(index, MSG_Type, message);
	
	if( ColorChange )
		CC_Team_Info(index, MSG_Type, TeamName[iTeam]);
}

CC_ShowColorMessage( id, type, message[] ) {
	message_begin( type, g_iMsgSayText, _, id );
	write_byte( id );	
	write_string( message );
	message_end( );	
}

CC_Team_Info( id, type, team[] ) {
	message_begin( type, g_iMsgTeamInfo, _, id );
	write_byte( id );
	write_string( team );
	message_end( );
	
	return 1;
}

CC_ColorSelection( index, type, Color:Type ) {
	switch( Type ) {
		case RED: return CC_Team_Info( index, type, TeamName[ 1 ] );
		case BLUE: return CC_Team_Info( index, type, TeamName[ 2 ] );
	}
	
	return 0;
}

CC_FindPlayer( ) {
	for( new i = 1; i <= g_iMaxplayers; i++ )
		if( g_bConnected[ i ] )
			return i;
	
	return -1;
}
vreau sa imi adaugati in acest plugin
| Afiseaza codul
#include <amxmodx>

enum
{
	TEAM_NONE = 0,
	TEAM_T,
	TEAM_CT,
	TEAM_SPEC,
	
	MAX_TEAMS
};
new const g_cTeamChars[MAX_TEAMS] =
{
	'U',
	'T',
	'C',
	'S'
};
new const g_sTeamNums[MAX_TEAMS][] =
{
	"0",
	"1",
	"2",
	"3"
};
new const g_sClassNums[MAX_TEAMS][] =
{
	"1",
	"2",
	"3",
	"4"
};

// Old Style Menus
stock const FIRST_JOIN_MSG[] =		"#Team_Select";
stock const FIRST_JOIN_MSG_SPEC[] =	"#Team_Select_Spect";
stock const INGAME_JOIN_MSG[] =		"#IG_Team_Select";
stock const INGAME_JOIN_MSG_SPEC[] =	"#IG_Team_Select_Spect";
const iMaxLen = sizeof(INGAME_JOIN_MSG_SPEC);

// New VGUI Menus
stock const VGUI_JOIN_TEAM_NUM =		2;

new g_iTeam[33];
new g_iPlayers[MAX_TEAMS];

new tjm_join_team;
new tjm_switch_team;
new tjm_class[MAX_TEAMS];
new tjm_block_change;

public plugin_init()
{
	register_plugin("Team Join Management", "0.3", "Exolent");
	register_event("TeamInfo", "event_TeamInfo", "a");
	register_message(get_user_msgid("ShowMenu"), "message_ShowMenu");
	register_message(get_user_msgid("VGUIMenu"), "message_VGUIMenu");
	tjm_join_team = register_cvar("tjm_join_team", "1");
	tjm_switch_team = register_cvar("tjm_switch_team", "1");
	tjm_class[TEAM_T] = register_cvar("tjm_class_t", "2");
	tjm_class[TEAM_CT] = register_cvar("tjm_class_ct", "4");
	tjm_block_change = register_cvar("tjm_block_change", "1");
}

public plugin_cfg()
{
	set_cvar_num("mp_limitteams", 32);
	set_cvar_num("sv_restart", 1);
}

public client_disconnect(id)
{
	remove_task(id);
}

public event_TeamInfo()
{
	new id = read_data(1);
	new sTeam[32], iTeam;
	read_data(2, sTeam, sizeof(sTeam) - 1);
	for(new i = 0; i < MAX_TEAMS; i++)
	{
		if(g_cTeamChars == sTeam[0])
		{
			iTeam = i;
			break;
		}
	}
	
	if(g_iTeam[id] != iTeam)
	{
		g_iPlayers[g_iTeam[id]]--;
		g_iTeam[id] = iTeam;
		g_iPlayers[iTeam]++;
	}
}

public message_ShowMenu(iMsgid, iDest, id)
{
	static sMenuCode[iMaxLen];
	get_msg_arg_string(4, sMenuCode, sizeof(sMenuCode) - 1);
	if(equal(sMenuCode, FIRST_JOIN_MSG) || equal(sMenuCode, FIRST_JOIN_MSG_SPEC))
	{
		if(should_autojoin(id))
		{
			set_autojoin_task(id, iMsgid);
			return PLUGIN_HANDLED;
		}
	}
	else if(equal(sMenuCode, INGAME_JOIN_MSG) || equal(sMenuCode, INGAME_JOIN_MSG_SPEC))
	{
		if(should_autoswitch(id))
		{
			set_autoswitch_task(id, iMsgid);
			return PLUGIN_HANDLED;
		}
		else if(get_pcvar_num(tjm_block_change))
		{
			return PLUGIN_HANDLED;
		}
	}
	return PLUGIN_CONTINUE;
}

public message_VGUIMenu(iMsgid, iDest, id)
{
	if(get_msg_arg_int(1) != VGUI_JOIN_TEAM_NUM)
	{
		return PLUGIN_CONTINUE;
	}
	
	if(should_autojoin(id))
	{
		set_autojoin_task(id, iMsgid);
		return PLUGIN_HANDLED;
	}
	else if(should_autoswitch(id))
	{
		set_autoswitch_task(id, iMsgid);
		return PLUGIN_HANDLED;
	}
	else if((TEAM_NONE < g_iTeam[id] < TEAM_SPEC) && get_pcvar_num(tjm_block_change))
	{
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}

public task_Autojoin(iParam[], id)
{
	new iTeam = get_new_team(get_pcvar_num(tjm_join_team));
	if(iTeam != -1)
	{
		handle_join(id, iParam[0], iTeam);
	}
}

public task_Autoswitch(iParam[], id)
{
	new iTeam = get_switch_team(id);
	if(iTeam != -1)
	{
		handle_join(id, iParam[0], iTeam);
	}
}

stock handle_join(id, iMsgid, iTeam)
{
	new iMsgBlock = get_msg_block(iMsgid);
	set_msg_block(iMsgid, BLOCK_SET);
	
	engclient_cmd(id, "jointeam", g_sTeamNums[iTeam]);
	
	new iClass = get_team_class(iTeam);
	if(1 <= iClass <= 4)
	{
		engclient_cmd(id, "joinclass", g_sClassNums[iClass - 1]);
	}
	set_msg_block(iMsgid, iMsgBlock);
}

stock get_new_team(iCvar)
{
	switch(iCvar)
	{
		case 1:
		{
			return TEAM_T;
		}
		case 2:
		{
			return TEAM_CT;
		}
		case 3:
		{
			return TEAM_SPEC;
		}
		case 4:
		{
			new iTCount = g_iPlayers[TEAM_T];
			new iCTCount = g_iPlayers[TEAM_CT];
			if(iTCount < iCTCount)
			{
				return TEAM_T;
			}
			else if(iTCount > iCTCount)
			{
				return TEAM_CT;
			}
			else
			{
				return random_num(TEAM_T, TEAM_CT);
			}
		}
	}
	return -1;
}

stock get_switch_team(id)
{
	new iTeam;
	
	new iTCount = g_iPlayers[TEAM_T];
	new iCTCount = g_iPlayers[TEAM_CT];
	switch(g_iTeam[id])
	{
		case TEAM_T: iTCount--;
		case TEAM_CT: iCTCount--;
	}
	if(iTCount < iCTCount)
	{
		iTeam = TEAM_T;
	}
	else if(iTCount > iCTCount)
	{
		iTeam = TEAM_CT;
	}
	else
	{
		iTeam = random_num(TEAM_T, TEAM_CT);
	}
	
	if(iTeam != g_iTeam[id])
	{
		return iTeam;
	}
	
	return -1;
}

stock get_team_class(iTeam)
{
	new iClass;
	if(TEAM_NONE < iTeam < TEAM_SPEC)
	{
		iClass = get_pcvar_num(tjm_class[iTeam]);
		if(iClass < 1 || iClass > 4)
		{
			iClass = random_num(1, 4);
		}
	}
	return iClass;
}

stock set_autojoin_task(id, iMsgid)
{
	new iParam[2];
	iParam[0] = iMsgid;
	set_task(0.1, "task_Autojoin", id, iParam, sizeof(iParam));
}

stock set_autoswitch_task(id, iMsgid)
{
	new iParam[2];
	iParam[0] = iMsgid;
	set_task(0.1, "task_Autoswitch", id, iParam, sizeof(iParam));
}

stock bool:should_autojoin(id)
{
	return ((5 > get_pcvar_num(tjm_join_team) > 0) && is_user_connected(id) && !(TEAM_NONE < g_iTeam[id] < TEAM_SPEC) && !task_exists(id));
}

stock bool:should_autoswitch(id)
{
	return (get_pcvar_num(tjm_switch_team) && is_user_connected(id) && (TEAM_NONE < g_iTeam[id] < TEAM_SPEC) && !task_exists(id));
}

si
| Afiseaza codul
#include < amxmodx >
#include < engine >

public plugin_init( ) {
	register_plugin( "Reset Buttons", "1.2", "xPaw" );
	
	register_event( "HLTV", "EventNewRound", "a", "1=0", "2=0" );
}

public EventNewRound( ) {
	new iEntity;
	
	while( ( iEntity = find_ent_by_class( iEntity, "func_button" ) ) > 0 )
		call_think( iEntity );
}

si ultimu
| Afiseaza codul
/*
 *
 *	Author:		Cheesy Peteza
 *	Date:		22-Apr-2004 (updated 2-March-2005)
 *
 *
 *	Description:	Enable bunny hopping in Counter-Strike.
 *
 *	Cvars:
 *			bh_enabled		1 to enable this plugin, 0 to disable.
 *			bh_autojump		If set to 1 players just need to hold down jump to bunny hop (no skill required)
 *			bh_showusage		If set to 1 it will inform joining players that bunny hopping has been enabled
 *						and how to use it if bh_autojump enabled.
 *
 *	Requirements:	AMXModX 0.16 or greater
 *
 *
 */

#include <amxmodx>
#include <engine>

#define	FL_WATERJUMP	(1<<11)	// player jumping out of water
#define	FL_ONGROUND	(1<<9)	// At rest / on the ground

public plugin_init() {
	register_plugin("Super Bunny Hopper", "1.2", "Cheesy Peteza")
	register_cvar("sbhopper_version", "1.2", FCVAR_SERVER)

	register_cvar("bh_enabled", "1")
	register_cvar("bh_autojump", "1")
	register_cvar("bh_showusage", "1")
}

public client_PreThink(id) {
	if (!get_cvar_num("bh_enabled"))
		return PLUGIN_CONTINUE

	entity_set_float(id, EV_FL_fuser2, 0.0)		// Disable slow down after jumping

	if (!get_cvar_num("bh_autojump"))
		return PLUGIN_CONTINUE

// Code from CBasePlayer::Jump (player.cpp)		Make a player jump automatically
	if (entity_get_int(id, EV_INT_button) & 2) {	// If holding jump
		new flags = entity_get_int(id, EV_INT_flags)

		if (flags & FL_WATERJUMP)
			return PLUGIN_CONTINUE
		if ( entity_get_int(id, EV_INT_waterlevel) >= 2 )
			return PLUGIN_CONTINUE
		if ( !(flags & FL_ONGROUND) )
			return PLUGIN_CONTINUE

		new Float:velocity[3]
		entity_get_vector(id, EV_VEC_velocity, velocity)
		velocity[2] += 250.0
		entity_set_vector(id, EV_VEC_velocity, velocity)

		entity_set_int(id, EV_INT_gaitsequence, 6)	// Play the Jump Animation
	}
	return PLUGIN_CONTINUE
}

public client_authorized(id)
	set_task(30.0, "showUsage", id)

public showUsage(id) {
	if ( !get_cvar_num("bh_enabled") || !get_cvar_num("bh_showusage") )
		return PLUGIN_HANDLED

	if ( !get_cvar_num("bh_autojump") ) {
		client_print(id, print_chat, "[AMX] Bunny hopping is enabled on this server. You will not slow down after jumping.")
	} else {
		client_print(id, print_chat, "[AMX] Auto bunny hopping is enabled on this server. Just hold down jump to bunny hop.")
	}
	return PLUGIN_HANDLED
}

toate acestea le vreau intr-un singur plugin va rog mult !
Last edited by Mădălin on 05 Dec 2013, 17:01, edited 1 time in total.
Reason: Mutat în: Modificari pluginuri
Image
Rapidserver
User avatar
Adventx
Membru, skill +4
Membru, skill +4
Posts: 1785
Joined: 17 Sep 2013, 20:44
Detinator Steam: Da
Reputatie: Fost moderator ajutator
Has thanked: 125 times
Been thanked: 142 times
Contact:

03 Dec 2013, 14:29

Care-i problema ca le adaugi in parte?
User avatar
Te-am_prins2013
Membru, skill 0
Membru, skill 0
Posts: 52
Joined: 24 Sep 2013, 14:41
Detinator Steam: Da
CS Status: Nu e aim, nu e bulan, e Talentu.exe
Detinator server CS: Dr.Europacs.Ro
Has thanked: 10 times
Been thanked: 2 times
Contact:

03 Dec 2013, 17:37

Tu ai raspuns aici doar ca sa faci posturi ? :-/ uite nu vreau eu sa le adaug ti greu daca ma ajuti ? :-j
Image
User avatar
Te-am_prins2013
Membru, skill 0
Membru, skill 0
Posts: 52
Joined: 24 Sep 2013, 14:41
Detinator Steam: Da
CS Status: Nu e aim, nu e bulan, e Talentu.exe
Detinator server CS: Dr.Europacs.Ro
Has thanked: 10 times
Been thanked: 2 times
Contact:

04 Dec 2013, 21:25

UP!
Chiar nu raspunde nimeni ? ! :-w
Image
User avatar
GhosT ***
Membru, skill +2
Membru, skill +2
Posts: 604
Joined: 04 Dec 2013, 21:52
Detinator Steam: Da
CS Status: Morphin . [ Retras ]
SteamID: Mutulica1428
Reputatie: Fost Moderator ajutator
Location: Dumesti.
Has thanked: 40 times
Been thanked: 99 times
Contact:

04 Dec 2013, 22:39

Stai ca nu am inteles , deci vrei toate pluginurile alea intr-un singur plugin?
Last edited by GhosT *** on 05 Dec 2013, 14:16, edited 1 time in total.
User avatar
mixatu
Membru, skill +2
Membru, skill +2
Posts: 660
Joined: 26 Apr 2012, 14:47
Detinator Steam: Da
Detinator server CS: ★ PLAY.USP.RO ★
SteamID: kzu1337
Reputatie: Membru Club eXtreamCS (1 luna)
Location: cstrike
Has thanked: 59 times
Been thanked: 28 times
Contact:

04 Dec 2013, 23:35

E inutil. Asa risti sa iti ai erori in server si sa pice ;))
ImageImage
Fondator: ★ PLAY.USP.RO ★ Competitive CS:GO Server [!ws !gloves !knife FREEVIP!]
User avatar
eNd.
Membru, skill +1
Membru, skill +1
Posts: 236
Joined: 19 Jan 2013, 21:18
Detinator Steam: Da
CS Status: Whoa...
SteamID: skitaila03
Has thanked: 18 times
Been thanked: 79 times

07 Dec 2013, 12:19

| Afiseaza codul
[code]/***
 * Link to the plugin
 *
 *	http://forums.alliedmods.net/showthread.php?t=78197
 */
/*
 *
 *	Author:		Cheesy Peteza
 *	Date:		22-Apr-2004 (updated 2-March-2005)
 *
 *
 *	Description:	Enable bunny hopping in Counter-Strike.
 *
 *	Cvars:
 *			bh_enabled		1 to enable this plugin, 0 to disable.
 *			bh_autojump		If set to 1 players just need to hold down jump to bunny hop (no skill required)
 *			bh_showusage		If set to 1 it will inform joining players that bunny hopping has been enabled
 *						and how to use it if bh_autojump enabled.
 *
 *	Requirements:	AMXModX 0.16 or greater
 *
 *
 */

#include < amxmodx >
#include < engine >
#include < cstrike >
#include < fun >
#include < fakemeta >
#include < hamsandwich >

#pragma semicolon 1

// Comment this line if you do not want to have fake player !
#define FAKE_PLAYER
#define	FL_WATERJUMP	(1<<11)	// player jumping out of water
#define	FL_ONGROUND	(1<<9)	// At rest / on the ground
// Bot name
#if defined FAKE_PLAYER
	new const g_szBotName[ ] = "DRM Fake Player";
#endif
enum
{
	TEAM_NONE = 0,
	TEAM_T,
	TEAM_CT,
	TEAM_SPEC,
	
	MAX_TEAMS
};
new const g_cTeamChars[MAX_TEAMS] =
{
	'U',
	'T',
	'C',
	'S'
};
new const g_sTeamNums[MAX_TEAMS][] =
{
	"0",
	"1",
	"2",
	"3"
};
new const g_sClassNums[MAX_TEAMS][] =
{
	"1",
	"2",
	"3",
	"4"
};

// Messages prefix
new const g_szPrefix[ ] = "[ Deathrun ]";
// Old Style Menus
stock const FIRST_JOIN_MSG[] =		"#Team_Select";
stock const FIRST_JOIN_MSG_SPEC[] =	"#Team_Select_Spect";
stock const INGAME_JOIN_MSG[] =		"#IG_Team_Select";
stock const INGAME_JOIN_MSG_SPEC[] =	"#IG_Team_Select_Spect";
const iMaxLen = sizeof(INGAME_JOIN_MSG_SPEC);

// New VGUI Menus
stock const VGUI_JOIN_TEAM_NUM =		2;

new g_iTeam[33];
new g_iPlayers[MAX_TEAMS];

new tjm_join_team;
new tjm_switch_team;
new tjm_class[MAX_TEAMS];
new tjm_block_change;
// Global Variables
new bool:g_bHauntedHouse, bool:g_bGamerFun, bool:g_bRandromized, bool:g_bStarting, bool:g_bFirstRound;
new bool:g_bEnabled, bool:g_bRestart, bool:g_bConnected[ 33 ];

new g_pRemoveBuyZone, g_pHideHuds, g_pBlockMoney, g_pLifeSystem, g_pSvRestart, g_pAutoBalance, g_pLimitTeams;
new g_pNoFallDmg, g_pGameName, g_pToggle, g_pBlockSpray, g_pBlockRadio, g_pSemiclip, g_pGiveUsp, g_pBlockKill;

new g_iMsgHideWeapon, g_iMsgCrosshair, g_iMsgMoney, g_iMsgTeamInfo, g_iMsgSayText;
new g_iMaxplayers, g_iHudSync, g_iHudSync2, g_iLastTerr, g_iThinker;
new g_iSemiClip[ 33 ], g_Lifes[ 33 ];

#if defined FAKE_PLAYER
	new g_iFakeplayer;
#endif

// Macros
#if cellbits == 32
	#define OFFSET_BZ 235
#else
	#define OFFSET_BZ 268
#endif

// Colorchat
enum Color {
	NORMAL = 1,
	GREEN,
	RED,
	BLUE
};

new TeamName[ ][ ] = {
	"",
	"TERRORIST",
	"CT",
	"SPECTATOR"
};

// =======================================================================================

public plugin_init( ) {
	new const VERSION[ ] = "3.0.3";
	
	register_plugin( "Deathrun Manager", VERSION, "xPaw" );
	
	g_pToggle        = register_cvar( "deathrun_toggle",     "1" );
	g_pBlockSpray    = register_cvar( "deathrun_spray",      "1" );
	g_pBlockRadio    = register_cvar( "deathrun_radio",      "1" );
	g_pBlockKill     = register_cvar( "deathrun_blockkill",  "1" );
	g_pBlockMoney    = register_cvar( "deathrun_blockmoney", "1" );
	g_pSemiclip      = register_cvar( "deathrun_semiclip",   "1" );
	g_pGiveUsp       = register_cvar( "deathrun_giveusp",    "1" );
	g_pHideHuds      = register_cvar( "deathrun_hidehud",    "1" );
	g_pLifeSystem    = register_cvar( "deathrun_lifesystem", "1" );
	g_pGameName      = register_cvar( "deathrun_gamename",   "1" );
	g_pNoFallDmg     = register_cvar( "deathrun_terrnfd",    "1" );
	g_pRemoveBuyZone = register_cvar( "deathrun_removebz",   "1" );
	tjm_join_team = register_cvar("tjm_join_team", "1");
	tjm_switch_team = register_cvar("tjm_switch_team", "1");
	tjm_class[TEAM_T] = register_cvar("tjm_class_t", "2");
	tjm_class[TEAM_CT] = register_cvar("tjm_class_ct", "4");
	tjm_block_change = register_cvar("tjm_block_change", "1");
	register_cvar("sbhopper_version", "1.2", FCVAR_SERVER);

	register_cvar("bh_enabled", "1");
	register_cvar("bh_autojump", "1");
	register_cvar("bh_showusage", "1");
	// Lets get map name...
	new szMapName[ 64 ];
	get_mapname( szMapName, 63 );
	
	if( contain( szMapName, "deathrun_" ) != -1 ) {
		set_pcvar_num( g_pToggle, 1 );
		
		if( contain( szMapName, "hauntedhouse" ) != -1 )
			g_bHauntedHouse = true;
		else {
			g_bHauntedHouse = false;
			
			if( equal( szMapName, "deathrun_gamerfun" ) )
				g_bGamerFun = true;
			else
				g_bGamerFun = false;
		}
	} else
		set_pcvar_num( g_pToggle, 0 );
	
	g_pSvRestart   = get_cvar_pointer( "sv_restart" );
	g_pAutoBalance = get_cvar_pointer( "mp_autoteambalance" );
	g_pLimitTeams  = get_cvar_pointer( "mp_limitteams" );
	
	register_cvar( "deathrun_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY );
	set_cvar_string( "deathrun_version", VERSION );
	
	// Registering Language file
	register_dictionary( "deathrun.txt" );
	
	// Logging Events
	register_logevent( "EventRoundStart", 2, "1=Round_Start" );
	register_logevent( "EventRandromize", 2, "1=Round_End" );
	register_event( "HLTV", "EventNewRound", "a", "1=0", "2=0" );
	register_event( "SendAudio", "EventTerrsWin",   "a", "2&%!MRAD_terwin" );
	register_event( "TextMsg",	 "EventRandromize", "a", "2&#Game_w" );
	register_event( "DeathMsg",	 "EventDeath",      "a");
	register_event( "Money",	 "EventMoney",      "b" );
	register_event( "ResetHUD",	 "EventResetHud",   "be" );
	register_event("TeamInfo", "event_TeamInfo", "a");
	register_message(get_user_msgid("ShowMenu"), "message_ShowMenu");
	register_message(get_user_msgid("VGUIMenu"), "message_VGUIMenu");
	g_bFirstRound    = true;
	g_iMaxplayers    = get_maxplayers( );
	g_iMsgHideWeapon = get_user_msgid( "HideWeapon" );
	g_iMsgCrosshair  = get_user_msgid( "Crosshair" );
	g_iMsgMoney      = get_user_msgid( "Money" );
	g_iMsgSayText    = get_user_msgid( "SayText" );
	g_iMsgTeamInfo   = get_user_msgid( "TeamInfo" );
	
	g_iHudSync       = CreateHudSyncObj( );
	g_iHudSync2      = CreateHudSyncObj( );
	
	if( get_pcvar_num( g_pToggle ) ) {
		RegisterHam( Ham_TakeDamage, "player", "FwdHamPlayerDamage" );
		RegisterHam( Ham_Spawn,      "player", "FwdHamPlayerSpawn", 1 );
		register_forward( FM_ClientKill,       "FwdClientKill" );
		register_impulse( 201, "FwdImpulse_201" );
		
		if( get_pcvar_num( g_pGameName ) )
			register_forward( FM_GetGameDescription, "FwdGameDesc" );
		
		register_clcmd( "say /lifes", "CmdShowlifes" );
		register_clcmd( "say /lives", "CmdShowlifes" );
		
		register_clcmd( "radio1", "CmdRadio" );
		register_clcmd( "radio2", "CmdRadio" );
		register_clcmd( "radio3", "CmdRadio" );
		
		// Terrorist Check
		g_iThinker= create_entity( "info_target" );
		
		if( is_valid_ent( g_iThinker ) ) {
			entity_set_string( g_iThinker, EV_SZ_classname, "DeathrunThinker" );
			entity_set_float( g_iThinker, EV_FL_nextthink, get_gametime( ) + 20.0 );
			
			g_bRestart = true;
			
			// First think will happen in 20.0, Restart will be done there.
			
			register_think( "DeathrunThinker", "FwdThinker" );
		} else {
			set_task( 15.0, "CheckTerrorists", _, _, _, "b" );
			
			// Lets make restart after 20 seconds from map start.
			set_task( 20.0, "RestartRound" );
		}
		
		if( get_pcvar_num( g_pRemoveBuyZone ) ) {
			register_message( get_user_msgid( "StatusIcon" ), "MsgStatusIcon" ); // BuyZone Icon
			
			// Remove buyzone on map
			remove_entity_name( "info_map_parameters" );
			remove_entity_name( "func_buyzone" );
			
			// Create own entity to block buying
			new iEntity = create_entity( "info_map_parameters" );
			
			DispatchKeyValue( iEntity, "buying", "3" );
			DispatchSpawn( iEntity );
		}
		
		if( get_pcvar_num( g_pSemiclip ) ) {
			register_forward( FM_StartFrame,	"FwdStartFrame", 0 );
			register_forward( FM_AddToFullPack,	"FwdFullPack",   1 );
		}
		
		g_bEnabled = true;
		
	#if defined FAKE_PLAYER
		new iEntity, iCount;
		
		while( ( iEntity = find_ent_by_class( iEntity, "info_player_deathmatch" ) ) > 0 )
			if( iCount++ > 1 )
				break;
		
		if( iCount <= 1 )
			g_iFakeplayer = -1;
		
		set_task( 5.0, "UpdateBot" );
		
		register_message( get_user_msgid( "DeathMsg" ), "MsgDeathMsg" );
	#endif
	} else
		g_bEnabled = false;
}
public plugin_cfg()
{
	set_cvar_num("mp_limitteams", 32);
	set_cvar_num("sv_restart", 1);
}
// FAKEPLAYER
///////////////////////////////////////////
#if defined FAKE_PLAYER
	public UpdateBot( ) {
		if( g_iFakeplayer == -1 )
			return;
		
		new id = find_player( "i" );
		
		if( !id ) {
			id = engfunc( EngFunc_CreateFakeClient, g_szBotName );
			if( pev_valid( id ) ) {
				engfunc( EngFunc_FreeEntPrivateData, id );
				dllfunc( MetaFunc_CallGameEntity, "player", id );
				set_user_info( id, "rate", "3500" );
				set_user_info( id, "cl_updaterate", "25" );
				set_user_info( id, "cl_lw", "1" );
				set_user_info( id, "cl_lc", "1" );
				set_user_info( id, "cl_dlmax", "128" );
				set_user_info( id, "cl_righthand", "1" );
				set_user_info( id, "_vgui_menus", "0" );
				set_user_info( id, "_ah", "0" );
				set_user_info( id, "dm", "0" );
				set_user_info( id, "tracker", "0" );
				set_user_info( id, "friends", "0" );
				set_user_info( id, "*bot", "1" );
				set_pev( id, pev_flags, pev( id, pev_flags ) | FL_FAKECLIENT );
				set_pev( id, pev_colormap, id );
				
				new szMsg[ 128 ];
				dllfunc( DLLFunc_ClientConnect, id, g_szBotName, "127.0.0.1", szMsg );
				dllfunc( DLLFunc_ClientPutInServer, id );
				
				cs_set_user_team( id, CS_TEAM_T );
				ExecuteHamB( Ham_CS_RoundRespawn, id );
				
				set_pev( id, pev_effects, pev( id, pev_effects ) | EF_NODRAW );
				set_pev( id, pev_solid, SOLID_NOT );
				dllfunc( DLLFunc_Think, id );
				
				g_iFakeplayer = id;
			}
		}
	}
	
	public MsgDeathMsg( const iMsgId, const iMsgDest, const id ) {
		if( get_msg_arg_int( 2 ) == g_iFakeplayer )
			return PLUGIN_HANDLED;
		
		return PLUGIN_CONTINUE;
	}
#endif

// NEW TERRORIST
///////////////////////////////////////////
public EventRandromize( ) {
	if( !g_bEnabled || g_bFirstRound || g_bRandromized )
		return PLUGIN_CONTINUE;
	
	g_bRandromized = true;
	
	new i, iPlayers[ 32 ], iNum, iPlayer;
	get_players( iPlayers, iNum, "c" );
	
	if( iNum <= 1 )
		return PLUGIN_CONTINUE;
	
	for( i = 0; i < iNum; i++ ) {
		iPlayer = iPlayers[ i ];
		
		if( cs_get_user_team( iPlayer ) == CS_TEAM_T )
			cs_set_user_team( iPlayer, CS_TEAM_CT );
	}
	
	new iRandomPlayer, CsTeams:iTeam;
	
	while( ( iRandomPlayer = iPlayers[ random_num( 0, iNum - 1 ) ] ) == g_iLastTerr ) { }
	
	g_iLastTerr = iRandomPlayer;
	
	iTeam = cs_get_user_team( iRandomPlayer );
	
	if( iTeam == CS_TEAM_T || iTeam == CS_TEAM_CT ) {
		cs_set_user_team(iRandomPlayer, CS_TEAM_T);
		
		new szName[ 32 ];
		get_user_name( iRandomPlayer, szName, 31 );
		
		for( i = 0; i < iNum; i++ )
			ColorChat(iPlayers[ i ], RED, "%s^4 %L", g_szPrefix, iPlayers[ i ], "DR_NOW_TERR", szName);
		
		if( !g_bRestart && is_valid_ent( g_iThinker ) )
			entity_set_float( g_iThinker, EV_FL_nextthink, get_gametime( ) + 15.0 );
	} else {
		g_bRandromized = false;
		EventRandromize( );
	}
	
	return PLUGIN_CONTINUE;
}

// NEW ROUND
///////////////////////////////////////////
public EventNewRound( ) {
	new iEntity;
	
	while( ( iEntity = find_ent_by_class( iEntity, "func_button" ) ) > 0 )
		call_think( iEntity );
}
public EventRoundStart( ) {
	if( !g_bEnabled )
		return PLUGIN_CONTINUE;
	
	g_bRandromized	= false;
	g_bStarting	= false;
	
	new i, iPlayers[ 32 ], iNum, iRealPlayers, CsTeams:iTeam;
	get_players( iPlayers, iNum, "c" );
	
	if( iNum <= 1 )
		return PLUGIN_CONTINUE;
	
	for( i = 0; i < iNum; i++ ) {
		iTeam = cs_get_user_team( iPlayers[ i ] );
		
		if( iTeam == CS_TEAM_T || iTeam == CS_TEAM_CT )
			iRealPlayers++;
	}
	
	if( iRealPlayers <= 1 ) {
		set_hudmessage( 0, 128, 0, -1.0, 0.1, 0, 4.0, 4.0, 0.5, 0.5, 4 );
		
		for( i = 0; i < iNum; i++ )
			ShowSyncHudMsg( iPlayers[ i ], g_iHudSync, "%L", iPlayers[ i ], "DR_NOT_ENOUGH" );
		
		return PLUGIN_CONTINUE;
	}
	
	set_pcvar_num( g_pAutoBalance, 0 );
	set_pcvar_num( g_pLimitTeams, 0 );
	
	if( g_bFirstRound ) {
		set_hudmessage( 0, 128, 0, -1.0, 0.1, 0, 4.0, 4.0, 0.5, 0.5, 4 );
		
		for( i = 0; i < iNum; i++ ) {
			ShowSyncHudMsg( iPlayers[ i ], g_iHudSync, "%L", iPlayers[ i ], "DR_STARTING" );
			
			ColorChat( iPlayers[ i ], RED, "%s^1 %L", g_szPrefix, iPlayers[ i ], "DR_STARTING_CC" );
		}
		
		if( is_valid_ent( g_iThinker ) ) {
			g_bRestart = true;
			
			entity_set_float( g_iThinker, EV_FL_nextthink, get_gametime( ) + 9.0 );
		} else
			set_task( 9.0, "RestartRound" );
		
		g_bStarting = true;
		g_bFirstRound = false;
	}
	
	return PLUGIN_CONTINUE;
}
// BHOP
public client_PreThink(id) {
	if (!get_cvar_num("bh_enabled"))
		return PLUGIN_CONTINUE;

	entity_set_float(id, EV_FL_fuser2, 0.0)	;	// Disable slow down after jumping

	if (!get_cvar_num("bh_autojump"))
		return PLUGIN_CONTINUE;

	// Code from CBasePlayer::Jump (player.cpp)		Make a player jump automatically
	if (entity_get_int(id, EV_INT_button) & 2) {	// If holding jump
		new flags = entity_get_int(id, EV_INT_flags);

		if (flags & FL_WATERJUMP)
			return PLUGIN_CONTINUE;
		if ( entity_get_int(id, EV_INT_waterlevel) >= 2 )
			return PLUGIN_CONTINUE;
		if ( !(flags & FL_ONGROUND) )
			return PLUGIN_CONTINUE;

		new Float:velocity[3];
		entity_get_vector(id, EV_VEC_velocity, velocity);
		velocity[2] += 250.0;
		entity_set_vector(id, EV_VEC_velocity, velocity);

		entity_set_int(id, EV_INT_gaitsequence, 6);	// Play the Jump Animation
	}
	return PLUGIN_CONTINUE;
}

// CHECK TERRORIST
///////////////////////////////////////////
public FwdThinker( iEntity ) {
	if( g_bRestart ) {
		g_bRestart = false;
		
		RestartRound( );
	} else
		CheckTerrorists( );
	
	entity_set_float( iEntity, EV_FL_nextthink, get_gametime( ) + 15.0 );
}

public CheckTerrorists( ) {
	if( !g_bEnabled || g_bFirstRound || g_bStarting )
		return PLUGIN_CONTINUE;
	
	new i, iPlayers[ 32 ], iTerrors, iNum, iRealPlayers, CsTeams:iTeam;
	get_players( iPlayers, iNum, "c" );
	
	if( iNum <= 1 )
		return PLUGIN_CONTINUE;
	
	for( i = 0; i < iNum; i++ ) {
		iTeam = cs_get_user_team( iPlayers[ i ] );
		
		if( iTeam == CS_TEAM_T )
			iTerrors++;
		
		if( iTeam == CS_TEAM_T || iTeam == CS_TEAM_CT )
			iRealPlayers++;
	}
	
	if( iRealPlayers <= 1 ) {
		set_hudmessage( 0, 128, 0, -1.0, 0.1, 0, 4.0, 4.0, 0.5, 0.5, 4 );
		
		for( i = 0; i < iNum; i++ )
			ShowSyncHudMsg( iPlayers[ i ], g_iHudSync, "%L", iPlayers[ i ], "DR_NOT_ENOUGH" );
		
		return PLUGIN_CONTINUE;
	}
	
	if( iTerrors == 0 ) {
		for( i = 0; i < iNum; i++ ) {
			ColorChat(iPlayers[ i ], RED, "%s^1 %L", g_szPrefix, iPlayers[ i ], "DR_NO_DETECT");
			
			if( is_user_alive( iPlayers[ i ] ) && cs_get_user_team( iPlayers[ i ] ) == CS_TEAM_CT )
				user_silentkill( iPlayers[ i ] );
		}
		
		set_task( 0.5, "EventRandromize" );
	}
	
	return PLUGIN_CONTINUE;
}

// LIFE SYSTEM
///////////////////////////////////////////
public EventTerrsWin( ) {
	if( !g_bEnabled || g_bFirstRound )
		return PLUGIN_CONTINUE;
	
	new iPlayers[ 32 ], iNum, iPlayer;
	get_players( iPlayers, iNum, "c" );
	
	if( iNum <= 1 )
		return PLUGIN_CONTINUE;
	
	new iLifeCvar = get_pcvar_num( g_pLifeSystem );
	
	for( new i = 0; i < iNum; i++ ) {
		iPlayer = iPlayers[ i ];
		
		if( cs_get_user_team( iPlayer ) == CS_TEAM_T ) {
			set_user_frags( iPlayer, get_user_frags( iPlayer ) + 3 );
			
			if( iLifeCvar == 2 )
				g_Lifes[ iPlayer ]++;
		}
	}
	
	return PLUGIN_CONTINUE;
}

public EventDeath( ) {
	if( !g_bEnabled )
		return PLUGIN_CONTINUE;
	
#if defined FAKE_PLAYER
	new iVictim = read_data( 2 );
	new iTeam = get_user_team( iVictim );
	
	if( iTeam == 1 && is_user_alive( g_iFakeplayer ) )
		fakedamage( g_iFakeplayer, "worldspawn", 100.0, DMG_GENERIC );
	
	if( !get_pcvar_num( g_pLifeSystem ) )
		return PLUGIN_CONTINUE;
#else
	if( !get_pcvar_num( g_pLifeSystem ) )
		return PLUGIN_CONTINUE;
	
	new iVictim = read_data( 2 );
	new iTeam = get_user_team( iVictim );
#endif
	
	new iKiller = read_data( 1 );
	
	if( iKiller != iVictim && get_user_team(iKiller) != iTeam )
		g_Lifes[iKiller]++;
	
	if( cs_get_user_team( iVictim ) == CS_TEAM_CT && g_Lifes[ iVictim ] > 0 ) {
		new iCTcount;
		for( new i = 1; i <= g_iMaxplayers; i++ ) {
			if( is_user_alive( i ) && cs_get_user_team( i ) == CS_TEAM_CT )
				iCTcount++;
		}
		
		if( iCTcount > 1 ) {
			set_task(3.2, "fnRevivePlayer", iVictim);
			
			ColorChat( iVictim, RED, "%s^1 %L", g_szPrefix, iVictim, "DR_LIFE_RESPAWN" );
		}
		/*else
			ColorChat( iVictim, RED, "%s^1 %L", g_szPrefix, iVictim, "DR_LIFE_CANT" );*/
	}
	
	return PLUGIN_CONTINUE;
}

public fnRevivePlayer( id ) {
	if( g_bConnected[ id ] ) {
		if( cs_get_user_team( id ) == CS_TEAM_CT ) {
			new iCTcount;
			for( new i = 1; i <= g_iMaxplayers; i++ )
				if( is_user_alive( i ) && cs_get_user_team( i ) == CS_TEAM_CT )
					iCTcount++;
			
			if( iCTcount > 1 ) {
				ExecuteHamB( Ham_CS_RoundRespawn, id );
				
				g_Lifes[ id ]--;
			}
		}
	}
}

public CmdShowlifes( id ) {
	if( get_pcvar_num( g_pLifeSystem ) == 0 ) {
		ColorChat( id, RED, "%s^1 %L", g_szPrefix, id, "DR_LIFE_DISABLE" );
		return PLUGIN_HANDLED;
	}
	
	if( g_Lifes[ id ] > 0 )
		ColorChat( id, RED, "%s^1 %L", g_szPrefix, id, "DR_LIFE_CC_COUNT", g_Lifes[ id ] );
	else
		ColorChat( id, RED, "%s^1 %L", g_szPrefix, id, "DR_LIFE_CC_NO" );
	
	return PLUGIN_HANDLED;
}

public Showlifes( id ) {
	set_hudmessage( 0, 128, 0, 0.04, 0.71, 0, 2.5, 2.5, 0.5, 0.5, 3 );
	
	if( g_Lifes[ id ] > 0 )
		ShowSyncHudMsg( id, g_iHudSync2, "%L", id, "DR_LIFE_COUNT", g_Lifes[ id ] );
	else
		ShowSyncHudMsg( id, g_iHudSync2, "%L", id, "DR_LIFE_NO" );
}

// EVENTS
///////////////////////////////////////////
public EventResetHud( id ) {
	if( g_bEnabled && get_pcvar_num( g_pHideHuds ) && !is_user_bot( id ) ) {
		message_begin( MSG_ONE_UNRELIABLE, g_iMsgHideWeapon, _, id );
		write_byte( ( 1<<4 | 1<<5 ) );
		message_end( );
		
		message_begin( MSG_ONE_UNRELIABLE, g_iMsgCrosshair, _, id );
		write_byte( 0 );
		message_end( );
	}
}

public EventMoney( id ) {
	if( g_bEnabled && get_pcvar_num( g_pBlockMoney ) ) {
		set_pdata_int( id, 115, 0 );
		
		message_begin( MSG_ONE_UNRELIABLE, g_iMsgMoney, _, id );
		write_long ( 0 );
		write_byte ( 1 );
		message_end( );
	}
}

public client_putinserver( id )
	g_bConnected[ id ] = true;

public client_disconnect( id ) {
	remove_task(id);
	g_bConnected[ id ] = false;
	CheckTerrorists( );
	
	if( !g_bRestart && is_valid_ent( g_iThinker ) )
		entity_set_float( g_iThinker, EV_FL_nextthink, get_gametime( ) + 15.0 );
	
#if defined FAKE_PLAYER
	if( g_iFakeplayer == id ) {
		set_task( 1.5, "UpdateBot" );
		
		g_iFakeplayer = 0;
	}
#endif
}

// SEMICLIP
///////////////////////////////////////////
public FwdFullPack( es, e, ent, host, flags, player, pSet ) {
	if( !g_bEnabled )
		return FMRES_IGNORED;
	
	if( player && g_iSemiClip[ ent ] && g_iSemiClip[ host ] ) {
		set_es( es, ES_Solid, SOLID_NOT );
		set_es( es, ES_RenderMode, kRenderTransAlpha );
		set_es( es, ES_RenderAmt, 85 );
	}
	
	return FMRES_IGNORED;
}

public FwdStartFrame( ) {
	if( !g_bEnabled )
		return FMRES_IGNORED;
	
	static iPlayers[ 32 ], iNum, iPlayer, iPlayer2, i, j;
	get_players( iPlayers, iNum, "ache", "CT" );
	
	arrayset( g_iSemiClip, 0, 32 );
	
	if( iNum <= 1 )
		return FMRES_IGNORED;
	
	for( i = 0; i < iNum; i++ ) {
		iPlayer = iPlayers[ i ];
		
		for( j = 0; j < iNum; j++ ) {
			iPlayer2 = iPlayers[ j ];
			
			if( iPlayer == iPlayer2 )
				continue;
			
			if( g_iSemiClip[ iPlayer ] && g_iSemiClip[ iPlayer2 ] )
				continue;
			
			if( entity_range( iPlayer, iPlayer2 ) < 128 ) {
				g_iSemiClip[ iPlayer ]	= true;
				g_iSemiClip[ iPlayer2 ]	= true;
			}
		}
	}
	
	for( i = 0; i < iNum; i++ ) {
		iPlayer = iPlayers[ i ];
		
		set_pev( iPlayer, pev_solid, g_iSemiClip[ iPlayer ] ? SOLID_NOT : SOLID_SLIDEBOX );
	}
	
	return FMRES_IGNORED;
}

// FORWARDS
///////////////////////////////////////////
public FwdHamPlayerSpawn( id ) {
	if( !g_bEnabled || !is_user_alive( id ) )
		return HAM_IGNORED;
	
	if( get_pcvar_num( g_pBlockRadio ) ) // thanks to ConnorMcLeod for this good way :)
		set_pdata_int( id, 192, 0 );
	
#if defined FAKE_PLAYER
	if( g_iFakeplayer == id ) {
		set_pev( id, pev_frags, -1000.0 );
		cs_set_user_deaths( id, -1000 );
		
		set_pev( id, pev_effects, pev( id, pev_effects ) | EF_NODRAW );
		set_pev( id, pev_solid, SOLID_NOT );
		entity_set_origin( id, Float:{ 999999.0, 999999.0, 999999.0 } );
		dllfunc( DLLFunc_Think, id );
	} else {
#endif
		new CsTeams:iTeam = cs_get_user_team( id );
		
		// An small delay for message
		if( get_pcvar_num( g_pLifeSystem ) != 0 && iTeam == CS_TEAM_CT )
			set_task( 0.8, "Showlifes", id );
		
		strip_user_weapons( id );
		give_item( id, "weapon_knife" );
		
		set_pdata_int( id, 116, 0 ); // Pickup fix by ConnorMcLeod
		
		if( g_bGamerFun && iTeam == CS_TEAM_CT )
			give_item( id, "weapon_smokegrenade" );
		
		if( get_pcvar_num( g_pGiveUsp ) && iTeam == CS_TEAM_CT && !g_bHauntedHouse )
			set_task( 1.0, "GiveUsp", id );

#if defined FAKE_PLAYER
	}
#endif
	
	return HAM_IGNORED;
}

public GiveUsp( const id ) {
	if( is_user_alive( id ) ) {
		give_item( id, "weapon_usp" );
		cs_set_user_bpammo( id, CSW_USP, 100 );
	}
}

public FwdGameDesc( ) {
	static const GameName[ ] = "Deathrun v3.0";
	
	forward_return( FMV_STRING, GameName );
	
	return FMRES_SUPERCEDE;
}

public FwdClientKill( const id ) {
	if( !g_bEnabled || !is_user_alive(id) )
		return FMRES_IGNORED;
	
	if( get_pcvar_num( g_pBlockKill ) || cs_get_user_team( id ) == CS_TEAM_T ) {
		client_print( id, print_center, "%L", id, "DR_BLOCK_KILL" );
		client_print( id, print_console, "%L", id, "DR_BLOCK_KILL" );
		
		return FMRES_SUPERCEDE;
	}
	
	return FMRES_IGNORED;
}

public FwdImpulse_201( const id ) {
	if( g_bEnabled && get_pcvar_num( g_pBlockSpray ) ) {
		if( is_user_alive( id ) )
			client_print( id, print_center, "%L", id, "DR_BLOCK_SPRAY" );
		
		return PLUGIN_HANDLED_MAIN;
	}
	
	return PLUGIN_CONTINUE;
}

public FwdHamPlayerDamage( id, idInflictor, idAttacker, Float:flDamage, iDamageBits ) {
	if( get_pcvar_num( g_pNoFallDmg ) )
		if( iDamageBits & DMG_FALL )
			if( get_user_team( id ) == 1 )
				return HAM_SUPERCEDE;
	
	return HAM_IGNORED;
}

public MsgStatusIcon( msg_id, msg_dest, id ) {
	new szIcon[ 8 ];
	get_msg_arg_string( 2, szIcon, 7 );
	
	static const BuyZone[ ] = "buyzone";
	
	if( equal( szIcon, BuyZone ) ) {
		set_pdata_int( id, OFFSET_BZ, get_pdata_int( id, OFFSET_BZ, 5 ) & ~( 1 << 0 ), 5 );
		
		return PLUGIN_HANDLED;
	}
	
	return PLUGIN_CONTINUE;
}

public CmdRadio( id ) {
	if( get_pcvar_num( g_pBlockRadio ) )
		return PLUGIN_HANDLED_MAIN;
	
	return PLUGIN_CONTINUE;
}

public RestartRound( )
	set_pcvar_num( g_pSvRestart, 1 );

public event_TeamInfo()
{
	new id = read_data(1);
	new sTeam[32], iTeam;
	read_data(2, sTeam, sizeof(sTeam) - 1);
	for(new i = 0; i < MAX_TEAMS; i++)
	{
		if(g_cTeamChars == sTeam[0])
		{
			iTeam = i;
			break;
		}
	}
	
	if(g_iTeam[id] != iTeam)
	{
		g_iPlayers[g_iTeam[id]]--;
		g_iTeam[id] = iTeam;
		g_iPlayers[iTeam]++;
	}
}

public message_ShowMenu(iMsgid, iDest, id)
{
	static sMenuCode[iMaxLen];
	get_msg_arg_string(4, sMenuCode, sizeof(sMenuCode) - 1);
	if(equal(sMenuCode, FIRST_JOIN_MSG) || equal(sMenuCode, FIRST_JOIN_MSG_SPEC))
	{
		if(should_autojoin(id))
		{
			set_autojoin_task(id, iMsgid);
			return PLUGIN_HANDLED;
		}
	}
	else if(equal(sMenuCode, INGAME_JOIN_MSG) || equal(sMenuCode, INGAME_JOIN_MSG_SPEC))
	{
		if(should_autoswitch(id))
		{
			set_autoswitch_task(id, iMsgid);
			return PLUGIN_HANDLED;
		}
		else if(get_pcvar_num(tjm_block_change))
		{
			return PLUGIN_HANDLED;
		}
	}
	return PLUGIN_CONTINUE;
}

public message_VGUIMenu(iMsgid, iDest, id)
{
	if(get_msg_arg_int(1) != VGUI_JOIN_TEAM_NUM)
	{
		return PLUGIN_CONTINUE;
	}
	
	if(should_autojoin(id))
	{
		set_autojoin_task(id, iMsgid);
		return PLUGIN_HANDLED;
	}
	else if(should_autoswitch(id))
	{
		set_autoswitch_task(id, iMsgid);
		return PLUGIN_HANDLED;
	}
	else if((TEAM_NONE < g_iTeam[id] < TEAM_SPEC) && get_pcvar_num(tjm_block_change))
	{
		return PLUGIN_HANDLED;
	}
	return PLUGIN_CONTINUE;
}

public task_Autojoin(iParam[], id)
{
	new iTeam = get_new_team(get_pcvar_num(tjm_join_team));
	if(iTeam != -1)
	{
		handle_join(id, iParam[0], iTeam);
	}
}

public task_Autoswitch(iParam[], id)
{
	new iTeam = get_switch_team(id);
	if(iTeam != -1)
	{
		handle_join(id, iParam[0], iTeam);
	}
}

stock handle_join(id, iMsgid, iTeam)
{
	new iMsgBlock = get_msg_block(iMsgid);
	set_msg_block(iMsgid, BLOCK_SET);
	
	engclient_cmd(id, "jointeam", g_sTeamNums[iTeam]);
	
	new iClass = get_team_class(iTeam);
	if(1 <= iClass <= 4)
	{
		engclient_cmd(id, "joinclass", g_sClassNums[iClass - 1]);
	}
	set_msg_block(iMsgid, iMsgBlock);
}

stock get_new_team(iCvar)
{
	switch(iCvar)
	{
		case 1:
		{
			return TEAM_T;
		}
		case 2:
		{
			return TEAM_CT;
		}
		case 3:
		{
			return TEAM_SPEC;
		}
		case 4:
		{
			new iTCount = g_iPlayers[TEAM_T];
			new iCTCount = g_iPlayers[TEAM_CT];
			if(iTCount < iCTCount)
			{
				return TEAM_T;
			}
			else if(iTCount > iCTCount)
			{
				return TEAM_CT;
			}
			else
			{
				return random_num(TEAM_T, TEAM_CT);
			}
		}
	}
	return -1;
}

stock get_switch_team(id)
{
	new iTeam;
	
	new iTCount = g_iPlayers[TEAM_T];
	new iCTCount = g_iPlayers[TEAM_CT];
	switch(g_iTeam[id])
	{
		case TEAM_T: iTCount--;
		case TEAM_CT: iCTCount--;
	}
	if(iTCount < iCTCount)
	{
		iTeam = TEAM_T;
	}
	else if(iTCount > iCTCount)
	{
		iTeam = TEAM_CT;
	}
	else
	{
		iTeam = random_num(TEAM_T, TEAM_CT);
	}
	
	if(iTeam != g_iTeam[id])
	{
		return iTeam;
	}
	
	return -1;
}

stock get_team_class(iTeam)
{
	new iClass;
	if(TEAM_NONE < iTeam < TEAM_SPEC)
	{
		iClass = get_pcvar_num(tjm_class[iTeam]);
		if(iClass < 1 || iClass > 4)
		{
			iClass = random_num(1, 4);
		}
	}
	return iClass;
}

stock set_autojoin_task(id, iMsgid)
{
	new iParam[2];
	iParam[0] = iMsgid;
	set_task(0.1, "task_Autojoin", id, iParam, sizeof(iParam));
}

stock set_autoswitch_task(id, iMsgid)
{
	new iParam[2];
	iParam[0] = iMsgid;
	set_task(0.1, "task_Autoswitch", id, iParam, sizeof(iParam));
}

stock bool:should_autojoin(id)
{
	return ((5 > get_pcvar_num(tjm_join_team) > 0) && is_user_connected(id) && !(TEAM_NONE < g_iTeam[id] < TEAM_SPEC) && !task_exists(id));
}

stock bool:should_autoswitch(id)
{
	return (get_pcvar_num(tjm_switch_team) && is_user_connected(id) && (TEAM_NONE < g_iTeam[id] < TEAM_SPEC) && !task_exists(id));
}

// COLORCHAT
/////////////////////////////////////////////
ColorChat( id, Color:type, const szMessage[], {Float,Sql,Result,_}:... ) {
	if( !get_playersnum( ) ) return;
	
	new message[ 256 ];
	
	switch( type ) {
		case NORMAL: message[0] = 0x01;
		case GREEN: message[0] = 0x04;
		default: message[0] = 0x03;
	}
	
	vformat( message[ 1 ], 251, szMessage, 4 );
	
	message[ 192 ] = '^0';
	
	replace_all( message, 191, "\YEL", "^1" );
	replace_all( message, 191, "\GRN", "^4" );
	replace_all( message, 191, "\TEM", "^3" );
	
	new iTeam, ColorChange, index, MSG_Type;
	
	if( id ) {
		MSG_Type = MSG_ONE_UNRELIABLE;
		index = id;
	} else {
		index = CC_FindPlayer();
		MSG_Type = MSG_BROADCAST;
	}
	
	iTeam = get_user_team( index );
	ColorChange = CC_ColorSelection(index, MSG_Type, type);

	CC_ShowColorMessage(index, MSG_Type, message);
	
	if( ColorChange )
		CC_Team_Info(index, MSG_Type, TeamName[iTeam]);
}

CC_ShowColorMessage( id, type, message[] ) {
	message_begin( type, g_iMsgSayText, _, id );
	write_byte( id );	
	write_string( message );
	message_end( );	
}

CC_Team_Info( id, type, team[] ) {
	message_begin( type, g_iMsgTeamInfo, _, id );
	write_byte( id );
	write_string( team );
	message_end( );
	
	return 1;
}

CC_ColorSelection( index, type, Color:Type ) {
	switch( Type ) {
		case RED: return CC_Team_Info( index, type, TeamName[ 1 ] );
		case BLUE: return CC_Team_Info( index, type, TeamName[ 2 ] );
	}
	
	return 0;
}

CC_FindPlayer( ) {
	for( new i = 1; i <= g_iMaxplayers; i++ )
		if( g_bConnected[ i ] )
			return i;
	
	return -1;
}[/code]
Image
ImageImage
Post Reply

Return to “Modificari pluginuri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 6 guests