imi colorati si mie 2 pluginuri

Categoria cu cereri de pluginuri si nu numai.

Moderators: Moderatori ajutatori, Moderatori, Echipa eXtreamCS.com

Forum rules
Accesează link-ul pentru a putea vedea regulile forumului

Daca doriti sa vi se modifice un plugin, va rugam postati aici .
Post Reply
mIRr0r# =D
Membru, skill 0
Membru, skill 0
Posts: 45
Joined: 27 Apr 2013, 21:55
Detinator Steam: Nu
CS Status: BB.DEVILCS.RO
Has thanked: 10 times
Been thanked: 1 time
Contact:

12 Jul 2013, 20:39

As vrea si eu sa colorez aceste 2 pluginuri, 1. bb_shop = sa arate scrisu la shop cu portocaliu in hud, 2. basebuilder65 = sa arate meniu la arme tot cu portocaliu ca pe unele harti nu se vede meniul deoarce e alb si .. daca se poate sa colorati aceste 2 plug.

----------------------------------------------1.BB_shop.sma = http://www.filehost.ro/0//
| Afiseaza codul
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <engine>

#define NORMAL DontChange
#define GREEN DontChange
#define TEAM_COLOR DontChange
#define RED Red
#define BLUE Blue
#define GREY Grey
#define ColorChat client_print_color

#define VERSION "1.0"

#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )

#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame

#pragma semicolon 1

enum _:Colors {
	DontChange,
	Red,
	Blue,
	Grey
};

new const g_prefix[] = "[Base Builder Orizont]";

new const g_ModelSuperKnife[] = "models/bb/superknife.mdl";
new const g_ModelSuperDeagle[] = "models/bb/v_golden_deagle.mdl";

new bool:g_bHasSuperKnife[33],
	bool:g_bHasSuperSpeed[33],
	bool:g_bHasSuperM249[33],
	bool:g_bHasSuperAWP[33],
	bool:g_bHasSuperDeagle[33],
	bool:g_bHasGunsKit[33];
	

new g_iMaxPlayers;

new g_pCvarCostSuperCut,
	g_pCvarCostLowGrav,
	g_pCvarQuantityLowGrav,
	g_pCvarCostSpeed,
	g_pCvarQuantitySpeed,
	g_pCvarQuantityHealthCT,
	g_pCvarCostHealthCT,
	g_pCvarCostHE,
	g_pCvarCostFlash,
	g_pCvarCostSmoke,
	g_pCvarCostSuperM249,
	g_pCvarCostSuperAWP,
	g_pCvarCostSuperDeagle,
	g_pCvarCostKitGuns,
	g_pCvarQuantityHealthT1,
	g_pCvarCostHealthT1,
	g_pCvarQuantityHealthT2,
	g_pCvarCostHealthT2,
	g_pCvarCostInvisinsibilite,
	g_pCvarTimeInvisinsibilite;


public plugin_init()
{
	register_plugin("Base Builder Orizont", VERSION, "GaBy");

	register_clcmd("say /shop", "ShowShop");
	register_clcmd("say_team /shop", "ShowShop");
	register_clcmd("say shop", "ShowShop");
	register_clcmd("say_team shop", "ShowShop");

	// Cvars Mixtes
	g_pCvarCostSuperCut = register_cvar("shopbb_supercut", "16000");
	g_pCvarCostLowGrav = register_cvar("shopbb_grav", "8000");
	g_pCvarQuantityLowGrav = register_cvar("shopbb_quant_grav", "0.150");
	g_pCvarCostSpeed = register_cvar("shopbb_speed", "8000");
	g_pCvarQuantitySpeed = register_cvar("shopbb_quantity_speed", "500.0");
	
	// Cvars CT
	g_pCvarQuantityHealthCT = register_cvar("shopbb_vie_ct", "150");
	g_pCvarCostHealthCT = register_cvar("shopbb_prix_vie_ct", "5000");
	g_pCvarCostHE = register_cvar("shopbb_he", "2500");
	g_pCvarCostFlash = register_cvar("shopbb_flash", "2500");
	g_pCvarCostSmoke = register_cvar("shopbb_smoke", "2500");
	g_pCvarCostSuperM249 = register_cvar("shopbb_super_m249", "8000");
	g_pCvarCostSuperAWP = register_cvar("shopbb_super_awp", "10000");
	g_pCvarCostSuperDeagle = register_cvar("shopbb_super_deagle", "16000");
	g_pCvarCostKitGuns = register_cvar("shopbb_kit_guns", "16000");
	
	// Cvars T
	g_pCvarQuantityHealthT1 = register_cvar("shopbb_health_t1", "2000");
	g_pCvarCostHealthT1 = register_cvar("shopbb_prix_health_t1", "8000");
	g_pCvarQuantityHealthT2 = register_cvar("shopbb_health_t2", "5000");
	g_pCvarCostHealthT2 = register_cvar("shopbb_prix_health_t2", "16000");
	g_pCvarCostInvisinsibilite = register_cvar("shopbb_invins", "10000");
	g_pCvarTimeInvisinsibilite = register_cvar("shopbb_time_invins", "10.0");

	RegisterHam(Ham_Spawn, "player", "Player_Spawn_Post", 1);
	RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage_Pre");
	RegisterHam(Ham_Item_Deploy, "weapon_knife", "ham_ItemDeploy_Post_KNI", 1);
	RegisterHam(Ham_Item_Deploy, "weapon_deagle", "ham_ItemDeploy_Post_DGL", 1);
	RegisterHam(Ham_Player_ResetMaxSpeed, "player", "Player_ResetMaxSpeed",  1);
	
	g_iMaxPlayers = get_maxplayers();
}
 
public client_putinserver( id )
{ 
	g_bHasSuperKnife[id] = false;
	g_bHasSuperSpeed[id] = false;
	g_bHasSuperM249[id] = false;
	g_bHasSuperAWP[id] = false;
	g_bHasSuperDeagle[id] = false;
	g_bHasGunsKit[id] = false;
}
 
public ShowShop(id)
{
	if ( is_user_alive(id) )
	{
		new Text[64];
		
		if(cs_get_user_team(id) == CS_TEAM_T)
		{
			new menu1 = menu_create("\y[\rZombie Shop (BaseBuilder Orizont)\y]", "ZombieShop");
			formatex(Text, charsmax(Text), "\wSpeed \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSpeed));
			menu_additem(menu1, Text, "0");
			formatex(Text, charsmax(Text), "\wGravity \y[\r%d $\y]", get_pcvar_num(g_pCvarCostLowGrav));
			menu_additem(menu1, Text, "1");
			formatex(Text, charsmax(Text), "\wSuper Cut \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperCut));
			menu_additem(menu1, Text, "2");
			formatex(Text, charsmax(Text), "\w+%d HP \y[\r%d $\y]", get_pcvar_num(g_pCvarQuantityHealthT1), get_pcvar_num(g_pCvarCostHealthT1));
			menu_additem(menu1, Text, "3");
			formatex(Text, charsmax(Text), "\w+%d HP \y[\r%d $\y]", get_pcvar_num(g_pCvarQuantityHealthT2), get_pcvar_num(g_pCvarCostHealthT2));
			menu_additem(menu1, Text, "4");
			formatex(Text, charsmax(Text), "\wInvincible \y[\r%d $\y]", get_pcvar_num(g_pCvarCostInvisinsibilite));
			menu_additem(menu1, Text, "5");

			menu_setprop(menu1, MPROP_EXITNAME, "Exit");

			menu_display(id, menu1);
		}

		else if(cs_get_user_team(id) == CS_TEAM_CT)
		{
			new menu2 = menu_create ("\y[\rHuman Shop (BaseBuilder Orizont)\y]", "BaseBuilderShop");	
			formatex(Text, charsmax(Text), "\wSuper Cut \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperCut));
			menu_additem(menu2, Text, "0");
			formatex(Text, charsmax(Text), "\wSpeed \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSpeed));
			menu_additem(menu2, Text, "1");
			formatex(Text, charsmax(Text), "\wGravity \y[\r%d $\y]", get_pcvar_num(g_pCvarCostLowGrav));
			menu_additem(menu2, Text, "2");
			formatex(Text, charsmax(Text), "\w+%d HP \y[\r%d $\y]", get_pcvar_num(g_pCvarQuantityHealthCT), get_pcvar_num(g_pCvarCostHealthCT));
			menu_additem(menu2, Text, "3");
			formatex(Text, charsmax(Text), "\wGrenade \y[\r%d $\y]", get_pcvar_num(g_pCvarCostHE));
			menu_additem(menu2, Text, "4");
			formatex(Text, charsmax(Text), "\wFlash \y[\r%d $\y]", get_pcvar_num(g_pCvarCostFlash));
			menu_additem(menu2, Text, "5");
			formatex(Text, charsmax(Text), "\wSmoke \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSmoke));
			menu_additem(menu2, Text, "6");
			formatex(Text, charsmax(Text), "\wSuper M249 \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperM249));
			menu_additem(menu2, Text, "7");
			formatex(Text, charsmax(Text), "\wSuper AWP \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperAWP));
			menu_additem(menu2, Text, "8");
			formatex(Text, charsmax(Text), "\wSuper Deagle \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperDeagle));
			menu_additem(menu2, Text, "9");
			formatex(Text, charsmax(Text), "\wKit Guns \y[\r%d $\y]", get_pcvar_num(g_pCvarCostKitGuns));
			menu_additem(menu2, Text, "10");

			menu_display(id, menu2);
		}
	}
}

public ZombieShop(id, menu1, item)
{
	if (item == MENU_EXIT || !is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_T) 
	{
		menu_destroy(menu1);
		return PLUGIN_HANDLED;
	}
	
	new iMoney = cs_get_user_money(id);

	switch(item)
	{
		case 0:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSpeed))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSpeed));
				g_bHasSuperSpeed[id] = true;
				set_user_maxspeed(id, get_pcvar_float(g_pCvarQuantitySpeed));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super Speed^1!", g_prefix);
			}
				
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 1:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostLowGrav))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostLowGrav));
				set_user_gravity(id, get_pcvar_float(g_pCvarQuantityLowGrav));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Low Gravity^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 2:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSuperCut))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperCut));
				g_bHasSuperKnife[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super Cut^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}
	   
		case 3:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostHealthT1))
			{			 
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostHealthT1));
				set_user_health(id, get_user_health(id) + get_pcvar_num(g_pCvarQuantityHealthT1));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3%d HP^1!", g_prefix, get_pcvar_num(g_pCvarQuantityHealthT1));
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}
	   
		case 4:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostHealthT2))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostHealthT2));
				set_user_health(id, get_user_health(id) + get_pcvar_num(g_pCvarQuantityHealthT2));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3%d HP^1!", g_prefix, get_pcvar_num(g_pCvarQuantityHealthT2));
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}
	  
		case 5:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostInvisinsibilite))
			{
				cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(g_pCvarCostInvisinsibilite));
				set_user_godmode(id, 1);
				set_task(0.0 + get_pcvar_float(g_pCvarTimeInvisinsibilite), "RemoveGodMode", id);
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat l'^3invincibilite^1 pentru^3 cateva secunde^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}	  
	}
	menu_destroy(menu1);
	return PLUGIN_HANDLED;
}

public RemoveGodMode(id)
{
	set_user_godmode(id, 0);
	client_print_color(id, DontChange, "^4%s ^1Nu mai esti invincibil!", g_prefix);
}

public BaseBuilderShop(id, menu2, item)
{
	if (item == MENU_EXIT || !is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_CT) 
	{
		menu_destroy(menu2);
		return PLUGIN_HANDLED;
	}
	
	new iMoney = cs_get_user_money(id);

	switch(item)
	{
		case 0:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSuperCut))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperCut));
				g_bHasSuperKnife[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super Cut^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 1:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSpeed))
			{			 
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSpeed));
				g_bHasSuperSpeed[id] = true;
				set_user_maxspeed(id, get_pcvar_float(g_pCvarQuantitySpeed));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super Speed^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}
	   
		case 2:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostLowGrav))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostLowGrav));
				set_user_gravity(id, get_pcvar_float(g_pCvarQuantityLowGrav));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Low Gravity^1!", g_prefix);
			}
				
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}
	   
		case 3:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostHealthCT))
			{			 
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostHealthCT));
				set_user_health(id, get_user_health(id) + get_pcvar_num(g_pCvarQuantityHealthCT));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3%d HP^1!", g_prefix, get_pcvar_num(g_pCvarQuantityHealthCT));
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 4:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostHE))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostHE));
				give_item(id, "weapon_hegrenade");
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat un ^3HE^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 5:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostFlash))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostFlash));
				give_item(id, "weapon_flashbang");
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat un ^3Flash^1!", g_prefix);
			}
					
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 6:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSmoke))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSmoke));
				give_item(id, "weapon_smokegrenade");
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat un ^3Smoke^1!", g_prefix);
			}
				
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 7:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSuperM249))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperM249));
				give_item(id, "weapon_m249");
				cs_set_user_bpammo(id, CSW_M249, 200);
				g_bHasSuperM249[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super M249^1!", g_prefix);
			}
				
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 8:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSuperAWP))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperAWP));
				give_item(id, "weapon_awp");
				cs_set_user_bpammo(id, CSW_AWP, 30);
				g_bHasSuperAWP[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super AWP^1!", g_prefix);
			}
			
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}	
		
		case 9:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSuperDeagle))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperDeagle));
				give_item(id, "weapon_deagle");
				cs_set_user_bpammo(id, CSW_DEAGLE, 35);
				g_bHasSuperDeagle[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super Deagle^1!", g_prefix);
			}
			
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}	

		case 10:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostKitGuns))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostKitGuns));
				give_item(id, "weapon_deagle");
				give_item(id, "weapon_m4a1");
				give_item(id, "weapon_hegrenade");
				cs_set_user_bpammo(id, CSW_DEAGLE, 35);
				cs_set_user_bpammo(id, CSW_M4A1, 90);
				g_bHasGunsKit[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Kit Guns^1!", g_prefix);
			}
			
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}		
	}
	menu_destroy(menu2);
	return PLUGIN_HANDLED;
}
 
public Player_Spawn_Post( id )
{
	if(is_user_alive(id))
	{
		client_print(id, print_chat, "Tasteaza /shop pentru a-ti iteme!");
		g_bHasSuperKnife[id] = false;
		g_bHasSuperSpeed[id] = false;
		g_bHasSuperM249[id] = false;
		g_bHasSuperAWP[id] = false;
		g_bHasSuperDeagle[id] = false;
		g_bHasGunsKit[id] = false;
	}
}
 
public client_disconnect(id)
{
	g_bHasSuperKnife[id] = false;
	g_bHasSuperSpeed[id] = false;
	g_bHasSuperM249[id] = false;
	g_bHasSuperAWP[id] = false;
	g_bHasSuperDeagle[id] = false;
	g_bHasGunsKit[id] = false;
}
 
 
public plugin_precache()
{
	precache_model(g_ModelSuperKnife);
	precache_model(g_ModelSuperDeagle);
}
 
public ham_TakeDamage_Pre(victim, inflictor, attacker, Float:damage, damage_bits)
{
	if( !IsPlayer( attacker ) || !is_user_alive( attacker ) || inflictor != attacker )
	{
		return;
	}

	if ( g_bHasSuperKnife[attacker] && get_user_weapon(attacker) == CSW_KNIFE )
	{
		SetHamParamFloat( 4, damage * 231 );
	}
	
	if ( g_bHasSuperM249[attacker] && get_user_weapon(attacker) == CSW_M249 )
	{
		SetHamParamFloat( 4, damage * 2 );
	}
	
	if ( g_bHasSuperAWP[attacker] && get_user_weapon(attacker) == CSW_AWP )
	{
		SetHamParamFloat( 4, damage * 2 );
	}
	
	if ( g_bHasSuperDeagle[attacker] && get_user_weapon(attacker) == CSW_DEAGLE )
	{
		SetHamParamFloat( 4, damage * 4 );
	}
	
	if ( g_bHasGunsKit[attacker] && ( get_user_weapon(attacker) == CSW_M4A1 || CSW_DEAGLE ) )
	{
		SetHamParamFloat( 4, damage * 2 );
	}  
}
 
 
public ham_ItemDeploy_Post_KNI(weapon_ent)
{
	static owner;
	owner = get_pdata_cbase(weapon_ent, 41, 4);

	if(is_user_alive(owner) && g_bHasSuperKnife[owner])
	{
		set_pev(owner, pev_viewmodel2, g_ModelSuperKnife);
	}
}

public ham_ItemDeploy_Post_DGL(weapon_ent)
{
	static owner;
	owner = get_pdata_cbase(weapon_ent, 41, 4);

	if(is_user_alive(owner) && ( g_bHasSuperDeagle[owner] || g_bHasGunsKit[owner] ) )
	{
		set_pev(owner, pev_viewmodel2, g_ModelSuperDeagle);
	}
}

public Player_ResetMaxSpeed(id)
{
	if( is_user_alive(id) && get_user_maxspeed(id) !=  -1.0 && g_bHasSuperSpeed[id])
	{
		set_user_maxspeed(id, get_pcvar_float(g_pCvarQuantitySpeed));
	}
}

stock const g_szTeamName[Colors][] = 
{
	"UNASSIGNED",
	"TERRORIST",
	"CT",
	"SPECTATOR"
};

stock client_print_color(id, iColor=DontChange, const szMsg[], any:...)
{
	if( id && !is_user_connected(id) )
	{
		return 0;
	}

	if( iColor > Grey )
	{
		iColor = DontChange;
	}

	new szMessage[192];
	if( iColor == DontChange )
	{
		szMessage[0] = 0x04;
	}
	else
	{
		szMessage[0] = 0x03;
	}

	new iParams = numargs();

	if(id)
	{
		if( iParams == 3 )
		{
			copy(szMessage[1], charsmax(szMessage)-1, szMsg);
		}
		else
		{
			vformat(szMessage[1], charsmax(szMessage)-1, szMsg, 4);
		}

		if( iColor )
		{
			new szTeam[11];
			get_user_team(id, szTeam, charsmax(szTeam));

			Send_TeamInfo(id, id, g_szTeamName[iColor]);
			Send_SayText(id, id, szMessage);
			Send_TeamInfo(id, id, szTeam);
		}
		else
		{
			Send_SayText(id, id, szMessage);
		}
	} 
	return 1;
}

stock Send_TeamInfo(iReceiver, iPlayerId, szTeam[])
{
	static iTeamInfo = 0;
	if( !iTeamInfo )
	{
		iTeamInfo = get_user_msgid("TeamInfo");
	}
	message_begin(iReceiver ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, iTeamInfo, .player=iReceiver);
	write_byte(iPlayerId);
	write_string(szTeam);
	message_end();
}

stock Send_SayText(iReceiver, iPlayerId, szMessage[])
{
	static iSayText = 0;
	if( !iSayText )
	{
		iSayText = get_user_msgid("SayText");
	}
	message_begin(iReceiver ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, iSayText, .player=iReceiver);
	write_byte(iPlayerId);
	write_string(szMessage);
	message_end();
}
----------------------------------------------2.Basebuilder65.sma = http://www.filehost.ro/0//
| Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <fun>
#include <csx>

// Plugin Version
new VERSION[]="6.4"
new formatmodname[] = "^x01 [^x04 Base Builder Orizont^x01 ]"

//Models
new const g_ZombieModel1[] = "orizont_zombie"

//Sounds
new g_RoundStart[] = "basebuilder/round_start.wav"
new g_ZombKill1[] = "basebuilder/zombie_kill1.wav"

new g_WinZomb[] = "basebuilder/zombies_win.wav"
new g_WinHum[] = "basebuilder/humans_win.wav"

#define AFTER_BUILD ADMIN_LEVEL_A
#define DEAD_BUILD ADMIN_LEVEL_B
#define REMOVE_BLOCK ADMIN_LEVEL_C
#define DEAD_REMOVE ADMIN_LEVEL_D
#define LOCK_BLOCKS ADMIN_LEVEL_E
#define PAIN_SHOCK_FREE ADMIN_KICK
#define BAD_SPAWN ADMIN_KICK
#define BUILD_BAN ADMIN_KICK
#define REVIVE ADMIN_BAN
#define SWAP ADMIN_KICK
#define START_ROUND ADMIN_BAN
#define RESET ADMIN_BAN
#define MEMBERSHIP ADMIN_LEVEL_E
#define ADMIN_GUNS ADMIN_KICK
#define ADMIN_RESET ADMIN_BAN

#define BUILD_TASK 10000
#define MODELSET_TASK 20000

#define MAX_PLAYERS 32
#define AMMO_SLOT 376
#define MODELCHANGE_DELAY 0.5
#define MAXENTS 1365
#define AUTO_TEAM_JOIN_DELAY 0.1
#define TEAM_SELECT_VGUI_MENU_ID 2

#if cellbits == 32
    #define OFFSET_BUYZONE 235
#else
    #define OFFSET_BUYZONE 268
#endif

#define LockBlock(%1)     ( entity_set_int( %1, EV_INT_iuser1, 1 ) )
#define UnlockBlock(%1)   ( entity_set_int( %1, EV_INT_iuser1, 0 ) )
#define IsBlockLocked(%1) ( entity_get_int( %1, EV_INT_iuser1 ) == 1 )

// CS Weapon CBase Offsets (win32)
const OFFSET_WEAPONOWNER = 41
// Linux diff's
const OFFSET_LINUX_WEAPONS = 4

new gmsgStatusText, gmsgSayText
new gHudSyncInfo, g_MaxPlayers, g_ModName[32]
const fPainShock = 108

new bool:g_CanBuild, bool:g_ZombiesReleased
new g_RoundNum, count_down, g_iEntBarrier
new bool:g_BuildBan[MAX_PLAYERS+1]
new g_pEnt[MAX_PLAYERS+1], Float:g_pDist[MAX_PLAYERS+1], bool:g_MovingEnt[MAXENTS], g_EntMover[MAXENTS],
	g_LastMover[MAXENTS], g_EntOwner[MAXENTS], bool:g_InvisEnt[MAXENTS], g_OwnedEnts[MAX_PLAYERS+1]
new CsTeams:g_pTeam[MAX_PLAYERS+1], CsTeams:g_pCurTeam[MAX_PLAYERS+1]
new g_CurrentWeapon[MAX_PLAYERS+1], g_PrimaryWeapon[MAX_PLAYERS+1], Float:MaxHP[MAX_PLAYERS+1]

//Cached Stuff for Players
new g_isconnected[MAX_PLAYERS+1], g_isalive[MAX_PLAYERS+1], g_isbot[MAX_PLAYERS+1],
	g_iszombie[MAX_PLAYERS+1], g_friend[MAX_PLAYERS+1]

//Custom Model Stuff
new Float:g_ModelsTargetTime, Float:g_RoundStartTime
new g_HasCustomModel[MAX_PLAYERS+1], g_PlayerModel[MAX_PLAYERS+1][32]

// Allowed weapons for zombies
const ZOMBIE_ALLOWED_WEAPONS_BITSUM = (1<<CSW_KNIFE)

//CVARS
new g_pcvar_buildtime, g_pcvar_zombiehp, g_pcvar_maxrounds, g_pcvar_basecalc, g_pcvar_resetent,
	g_pcvar_showmovers, g_pcvar_knockback, g_pcvar_allowedweps, g_pcvar_givenades,
	g_pcvar_entmindist, g_pcvar_entsetdist, g_pcvar_entmaxdist, g_pcvar_maxclaimable,
	g_pcvar_claimable, g_pcvar_zresptime

new g_fwRoundStart, g_fwGrabEnt, g_fwDropEnt, g_fwNewGameStart, g_fwGameStart, g_fwSwapTeams
new g_fwiFakeReturn
	
//CSDM-Style Weapons Menu
new bool:firsttime[MAX_PLAYERS+1]
new weapon_picked[2][MAX_PLAYERS+1],cur_offset[MAX_PLAYERS+1],options_on_menu[8][MAX_PLAYERS+1]

//Weapon Names (For Guns Menu)
static const WEAPONNAMES[24][23] = { "Schmidt Scout", "XM1014 M4", "Ingram MAC-10", "Steyr AUG A1", "UMP 45", "SG-550 Auto-Sniper",
			"IMI Galil", "Famas", "AWP Magnum Sniper", "MP5 Navy", "M249 Para Machinegun", "M3 Super 90", "M4A1 Carbine",
			"Schmidt TMP", "G3SG1 Auto-Sniper", "SG-552 Commando", "AK-47 Kalashnikov", "ES P90", "P228 Compact",
			"Dual Elite Berettas", "Fiveseven", "USP .45 ACP Tactical", "Glock 18C", "Desert Eagle .50 AE"
}

// Weapon entity names
new const WEAPONENTNAMES[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
			"weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
			"weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
			"weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
			"weapon_ak47", "weapon_knife", "weapon_p90" }

public plugin_init()
{
	register_plugin("Base Builder Zombie Mod", VERSION, "Tirant")
	register_cvar("base_builder", VERSION, FCVAR_SPONLY|FCVAR_SERVER)
	set_cvar_string("base_builder", VERSION)
	
	//Basic mod functions/timers
	g_pcvar_buildtime = register_cvar("bb_build_time", "150.0")
	g_pcvar_zombiehp = register_cvar("bb_zombie_health", "3000.0")
	g_pcvar_basecalc = register_cvar("bb_calc_maxbase", "0")
	g_pcvar_showmovers = register_cvar("bb_show_moving", "1")
	g_pcvar_knockback = register_cvar("bb_pain_shock_free", "0")
	g_pcvar_entmaxdist = register_cvar("bb_max_move_dist", "960")
	g_pcvar_entmindist = register_cvar("bb_min_move_dist", "25")
	g_pcvar_entsetdist = register_cvar("bb_min_dist_set", "50")
	g_pcvar_resetent = register_cvar("bb_reset_blocks", "1")
	g_pcvar_maxclaimable = register_cvar("bb_claim_max", "999")
	g_pcvar_claimable = register_cvar("bb_claim_mode", "1")
	g_pcvar_zresptime = register_cvar("bb_zombie_respawn_time", "2.0")
	
	//Guns Menu
	g_pcvar_givenades = register_cvar("bb_give_nades","hs") 	//h f s, put multiple letters for multiple nades
	g_pcvar_allowedweps = register_cvar("bb_weapons","abcdeghijlmnqrstuvwx")
	
	register_dictionary("basebuilder.txt");
	
	//Client Commands
	register_clcmd("+grab","cmdMoveEnt") 							//command to move stuff around
	register_clcmd("-grab","cmdStopEnt") 							//command to move stuff around
	
	register_clcmd("say", "cmdSay",0, "<target> ")
	register_clcmd("say_team", "cmdSay",0, "<target> ")

	//Admin Commands
	register_concmd("removeaim","cmdRemoveEnt",0," - Deletes an object") 			//Removes an object (C alive, D dead)
	register_concmd("lockaim","cmdLockBlock",0," - Locks/Unlocks an object form moving")
	register_concmd("unclaimaim","cmdRemoveClaim",0," - Removes a claim on an object")	//Makes block claimable by everyone
	register_concmd("resetaim","cmdResetAim",0," - Resets an object")
	
	register_concmd("bb_buildban","cmdBuildBan",0,"<player>") 				//Bans targeted player from building
	register_concmd("bb_unbuildban","cmdBuildUnban",0,"<player>") 				//Unbans   "	   "     "     "
	register_concmd("bb_revive","cmdRevive",0,"<player>")
	register_concmd("bb_guns","cmdGiveGuns",0,"<player>")					//revives targetted player
	register_concmd("bb_swap","cmdSwap",0,"<player>")					//swaps the selected player to the opposite team
	register_concmd("bb_startround","cmdStartRound",0," - Ends the build phase")		//do i really have to explain this?
	register_concmd("bb_reset","cmdResetEnts",0," - Resets all entities")
	register_concmd("bb_clear","cmdClearEnts",0," - Deleted all unused entities")
	
	//Blocked Commands
	register_clcmd("drop", "clcmd_drop")
	register_clcmd("buy", "clcmd_buy")
	
	register_forward(FM_GetGameDescription, "fw_GetGameDescription")
	register_forward(FM_SetClientKeyValue, "fw_SetClientKeyValue")
	register_forward(FM_ClientUserInfoChanged, "fw_ClientUserInfoChanged")
	register_forward(FM_PlayerPreThink, "fw_Player_PreThink")
	if (get_pcvar_num(g_pcvar_showmovers) == 1)
		register_forward(FM_TraceLine, "fw_Traceline")
	
	RegisterHam(Ham_Touch, "weapon_shield", "ham_WeaponCleaner_Post", 1)
	RegisterHam(Ham_Touch, "weaponbox", "ham_WeaponCleaner_Post", 1)
	RegisterHam(Ham_Spawn, "player", "ham_PlayerSpawn_Post", 1)
	RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage")
	RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage_Post", 1)
	for (new i = 1; i < sizeof WEAPONENTNAMES; i++)
		if (WEAPONENTNAMES[0]) RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES, "ham_ItemDeploy_Post", 1)
	
	register_message(get_user_msgid("TextMsg"), "msgRoundEnd")
	register_message(get_user_msgid("StatusIcon"), "msgStatusIcon")
	register_message(get_user_msgid("StatusValue"), "msgStatusValue");
	register_message(get_user_msgid("Health"), "msgHealth");
	register_message(get_user_msgid("ScoreAttrib"), "msgScoreAttrib")
	
	register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
	register_event("AmmoX", "ev_AmmoX", "be", "1=1", "1=2", "1=3", "1=4", "1=5", "1=6", "1=7", "1=8", "1=9", "1=10")
	register_event("StatusValue", "ev_SetTeam", "be", "1=1");
	register_event("StatusValue", "ev_ShowStatus", "be", "1=2", "2!0");
	register_event("StatusValue", "ev_HideStatus", "be", "1=1", "2=0");
	register_event("Health", "ev_Health", "be", "1>0");
	
	register_logevent("logevent_round_start",2, "1=Round_Start")
	register_logevent("logevent_round_end", 2, "1=Round_End")
	
	register_menucmd(register_menuid("WeaponMethodMenu"),(1<<0)|(1<<1)|(1<<2),"weapon_method_pushed")
	register_menucmd(register_menuid("PrimaryWeaponSelect"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"prim_weapons_pushed")
	register_menucmd(register_menuid("SecWeaponSelect"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7),"sec_weapons_pushed")
	
	set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET)
	
	//Formats the Mod Name
	formatex(g_ModName, charsmax(g_ModName), "Base Builder %s", VERSION)
	
	gmsgSayText = get_user_msgid("SayText")
	gmsgStatusText = get_user_msgid("StatusText");
	gHudSyncInfo = CreateHudSyncObj();
	g_MaxPlayers = get_maxplayers();

	g_fwNewGameStart = CreateMultiForward("bb_new_round",ET_IGNORE)
	g_fwGameStart = CreateMultiForward("bb_timer_started",ET_IGNORE)
	g_fwRoundStart = CreateMultiForward("bb_zombies_released",ET_IGNORE)
	g_fwSwapTeams = CreateMultiForward("bb_teams_swapped",ET_IGNORE)
	g_fwGrabEnt = CreateMultiForward("bb_ent_grabbed",ET_IGNORE, FP_CELL, FP_CELL)
	g_fwDropEnt = CreateMultiForward("bb_ent_dropped",ET_IGNORE, FP_CELL, FP_CELL)
	
	server_cmd("sv_skyname dust")
	server_cmd("mp_freezetime 0")
	server_cmd("mp_flashlight 0")

	register_clcmd("chooseteam", "clcmd_changeteam")
	register_clcmd("jointeam", "clcmd_changeteam")
	register_message(get_user_msgid("ShowMenu"), "message_show_menu")
	register_message(get_user_msgid("VGUIMenu"), "message_vgui_menu")
	server_cmd("mp_limitteams 1")
	server_cmd("mp_autoteambalance 1")

	g_iEntBarrier = find_ent_by_tname( -1, "barrier" );
}

public plugin_precache()
{
	engfunc(EngFunc_PrecacheSound, g_RoundStart)
	engfunc(EngFunc_PrecacheSound, g_ZombKill1)
	engfunc(EngFunc_PrecacheSound, g_WinZomb)
	engfunc(EngFunc_PrecacheSound, g_WinHum)
	
	new szModel[64];
	formatex(szModel, charsmax(szModel), "models/player/%s/%s.mdl", g_ZombieModel1, g_ZombieModel1 );
	engfunc(EngFunc_PrecacheModel, szModel)
	
	new iBomb = create_entity("info_bomb_target");
	entity_set_origin(iBomb, Float:{8192.0,8192.0,8192.0})
	
	new iBuyZone = create_entity("info_map_parameters");
	DispatchKeyValue(iBuyZone, "buying", "3");
	DispatchSpawn(iBuyZone);
	
	g_pcvar_maxrounds = get_cvar_num("mp_maxrounds")
}

// Event Round Start (This is before freeze time)
public event_round_start()
{
	arrayset(g_MovingEnt, false, MAXENTS)
	arrayset(g_EntOwner, 0, MAXENTS)
	arrayset(g_LastMover, 0, MAXENTS)
	arrayset(g_OwnedEnts, 0, MAX_PLAYERS+1)
	
	g_RoundStartTime = get_gametime()
	g_ZombiesReleased = false
	
	if (get_pcvar_num(g_pcvar_resetent) == 1)
	{
		new cname[10], tname[7];
		for (new iEnt = g_MaxPlayers+1; iEnt < MAXENTS; iEnt++)
		{
			if (is_valid_ent(iEnt))
			{
				entity_get_string(iEnt, EV_SZ_classname, cname, 9);
				entity_get_string(iEnt, EV_SZ_targetname, tname, 6);
				if (!IsBlockLocked(iEnt) && iEnt != g_iEntBarrier && equal(cname, "func_wall") && !equal(tname, "ignore"))
				{
					if (g_InvisEnt[iEnt])
					{
						set_pev(iEnt,pev_solid,SOLID_BSP)
						set_pev(iEnt,pev_renderamt,Float:{255.0})
						set_pev(iEnt,pev_rendermode,0)
						g_InvisEnt[iEnt] = false
					}
					engfunc( EngFunc_SetOrigin, iEnt, Float:{ 0.0, 0.0, 0.0 } );
				}
			}
		}
	}
	ExecuteForward(g_fwNewGameStart, g_fwiFakeReturn)
}

// Log Event Round Start (This is AFTER freeze time)
public logevent_round_start()
{
	g_CanBuild = true
	
	set_pev(g_iEntBarrier,pev_solid,SOLID_BSP)
	set_pev(g_iEntBarrier,pev_rendermode,1)
	set_pev(g_iEntBarrier,pev_renderamt,Float:{150.0})
	
	set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 10.0, 0.1, 0.2, 1)
	new nLen, szMsg[128]
	nLen += format( szMsg[nLen], 127-nLen, "%L", LANG_SERVER, "WELCOME_MSG", VERSION);
	nLen += format( szMsg[nLen], 127-nLen, "%L", LANG_SERVER, "BIND_KEY");
	show_hudmessage(0, szMsg);
	
	print_color(0, "%s %s ^x04- ^x01%L", formatmodname, VERSION, LANG_SERVER, "ROUND_MSG")
	print_color(0, "%s Round: %d of %d", formatmodname, (g_RoundNum+1), g_pcvar_maxrounds)
	
	remove_task(BUILD_TASK)
	
	set_task(1.0, "CountDown", BUILD_TASK,_, _, "a", get_pcvar_num(g_pcvar_buildtime));
	count_down = (get_pcvar_num(g_pcvar_buildtime)-1);
	
	if (get_pcvar_num(g_pcvar_basecalc) == 1)
		set_task(5.0, "Base_Calc")
	
	ExecuteForward(g_fwGameStart, g_fwiFakeReturn)
}

public CountDown()
{
	count_down--
	new mins = count_down/60
	new secs = count_down%60
	if (count_down>=0)
	{
		client_print(0, print_center, "Timp de constructie - %d:%s%d", mins, (secs < 10 ? "0" : ""), secs)
	}
	
	if (mins != 0 && secs == 0)
	{
		new mmin[32]
		num_to_word(mins, mmin, 31)
		
		client_cmd(0, "spk ^"fvox/%s minutes remaining^"", mmin)
	}
	else if (mins == 0 && secs == 30)
	{
		new msec[32]
		num_to_word(secs, msec, 31)

		client_cmd(0, "spk ^"fvox/%s seconds remaining^"",  msec)
	}
	if (0<count_down<=10)
	{
		new msec[32]
		num_to_word(count_down, msec, 31)
		
		client_cmd(0, "spk ^"fvox/%s^"", msec)
	}
		
	if (count_down == 0)
	{
		Release_Zombies()
		remove_task(BUILD_TASK);
	}
}

public logevent_round_end()
{
	if (!g_CanBuild)
	{
		new players[32], num, player
		get_players(players, num)
		for (new i = 0; i < num; i++)
		{
			player = players
			
			if (g_pCurTeam[player] == g_pTeam[player])
				cs_set_user_team(player, (g_pTeam[player] = (g_pTeam[player] == CS_TEAM_T ? CS_TEAM_CT : CS_TEAM_T))) 
			else
				g_pTeam[player] = g_pTeam[player] == CS_TEAM_T ? CS_TEAM_CT : CS_TEAM_T
		}
		print_color(0, "^x04%L", LANG_SERVER, "TEAMS_SWAPPED")
		ExecuteForward(g_fwSwapTeams, g_fwiFakeReturn)
	}
	
	remove_task(BUILD_TASK)
		
	return PLUGIN_HANDLED
}

public client_death(g_attacker, g_victim, wpnindex, hitplace, TK)
{
	if (g_pEnt[g_victim])
		cmdStopEnt(g_victim)
		
	set_hudmessage(_, _, _, _, _, _, _, _, _, _, 4);
	show_hudmessage(g_victim, "");
	
	g_isalive[g_victim] = false
	
	if (TK == 0 && g_attacker != g_victim)
	{
		if (g_iszombie[g_attacker])
		{
			client_cmd(0, "spk %s", g_ZombKill1)
			new playername[35]
			get_user_name(g_victim, playername, 34)
			set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 5.0, 0.1, 0.2, 1)
			show_hudmessage(0, "%L",LANG_SERVER, "DEAD_ANNOUNCE", playername);
		}
	}
	
	if (g_iszombie[g_victim])
	{
		set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 10.0, 0.1, 0.2, 1)
		show_hudmessage(g_victim, "%L", LANG_SERVER, "DEAD_ZOMBIE", get_pcvar_num(g_pcvar_zresptime));
		set_task(get_pcvar_float(g_pcvar_zresptime), "Respawn_Zombie", g_victim)
	}
	if (!g_iszombie[g_victim])
	{
		set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 10.0, 0.1, 0.2, 1)
		show_hudmessage(g_victim, "%L", LANG_SERVER, "DEAD_SURVIVOR");
		cs_set_user_team(g_victim, cs_get_user_team(g_victim) == CS_TEAM_T ? CS_TEAM_CT:CS_TEAM_T)
		g_iszombie[g_victim] = true
		set_task(5.0, "Respawn_Zombie", g_victim)
	}
}

public ham_TakeDamage_Post(victim, inflictor, attacker, Float:damage, bits)
{
	if(get_pcvar_num(g_pcvar_knockback) == 1 && access(victim, PAIN_SHOCK_FREE) && g_iszombie[victim])
	{
		set_pdata_float(victim, fPainShock, 1.0, 5)
	}
}

public ham_TakeDamage(victim, inflictor, attacker, Float:damage, damagebits)
{
	if (!g_isalive[victim] || !g_isconnected[attacker]) return HAM_IGNORED
	
	if(g_CanBuild || victim == attacker)
		return HAM_SUPERCEDE
		
	return HAM_HANDLED
}

public client_disconnect(id)
{
	cmdStopEnt(id)

	g_isconnected[id] = false
	g_isalive[id] = false
	g_isbot[id] = false
	g_iszombie[id] = false
	
	return PLUGIN_CONTINUE
}

//Respawns late joiners, cts only if build time is still on
public client_putinserver(id)
{
	set_task(7.0,"Respawn_Human",id);
	g_isconnected[id] = true
	firsttime[id] = true

	// Set bot flag
	if (is_user_bot(id))
		g_isbot[id] = true
}

public Release_Zombies()
{
	g_CanBuild = false
	g_ZombiesReleased = true
	remove_task(BUILD_TASK);
	
	new weapon[32]
	new he, flash, smoke
	get_pcvar_string(g_pcvar_givenades,weapon,31)
	for(new i=0;i<strlen(weapon);i++)
	{
		switch(weapon)
		{
			case 'h': he++
			case 'f': flash++
			case 's': smoke++
		}
	}
	
	new players[32], num
	get_players(players, num)

	new player
	for(new i = 0; i < num; i++)
	{
		player = players
		if (g_isalive[player])
		{
			if (!g_iszombie[player])
			{
				cmdStopEnt(player)

				if(he) give_item(player,"weapon_hegrenade"), cs_set_user_bpammo(player,CSW_HEGRENADE,he)
				if(flash) give_item(player,"weapon_flashbang"), cs_set_user_bpammo(player,CSW_FLASHBANG,flash)
				if(smoke) give_item(player,"weapon_smokegrenade"), cs_set_user_bpammo(player,CSW_SMOKEGRENADE,smoke)

				if (g_PrimaryWeapon[player])
				{
					get_weaponname(g_PrimaryWeapon[player],weapon,31)
					engclient_cmd(player, weapon);
				}
			}
		}
	}
			
	set_pev(g_iEntBarrier,pev_solid,SOLID_NOT)
	set_pev(g_iEntBarrier,pev_renderamt,Float:{0.0})
	
	g_RoundNum++
	set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 10.0, 0.1, 0.2, 1)
	show_hudmessage(0, "%L", LANG_SERVER, "RELEASE_MSG");
	client_cmd(0, "spk %s", g_RoundStart)
	
	ExecuteForward(g_fwRoundStart,g_fwiFakeReturn)
}

//Called on zombie death function
public Respawn_Zombie(id)
{
	if (g_isconnected[id] && cs_get_user_team(id) == CS_TEAM_T)
	{
		if (get_user_health(id) ==MaxHP[id] || !is_user_alive(id))
			ExecuteHamB(Ham_CS_RoundRespawn, id)
		else
			client_print(id, print_center, "%L", LANG_SERVER, "FAIL_RESPAWN");
	}
}

//Called on al pllayers for late joiners, parent is above
public Respawn_Human(id)
{
	if (!g_isconnected[id] || g_isalive[id] || cs_get_user_team(id) == CS_TEAM_SPECTATOR || cs_get_user_team(id) == CS_TEAM_UNASSIGNED)
		return PLUGIN_HANDLED
		
	if (!g_isalive[id] && g_iszombie[id])
		ExecuteHamB(Ham_CS_RoundRespawn, id)
				
	if (!g_isalive[id] && g_iszombie[id])
		set_task(3.0,"Respawn_Human",id)
			
	if (g_CanBuild)
	{
		if (!g_isalive[id])
			ExecuteHamB(Ham_CS_RoundRespawn, id)
				
		if (!g_isalive[id])
			set_task(3.0,"Respawn_Human",id)
	}
	return PLUGIN_HANDLED
}

//Sets player health and weapons
public Add_Effects(id)
{
	if (!g_isconnected[id] || !g_isalive[id])
		return PLUGIN_HANDLED
	
	strip_user_weapons(id)
	give_item(id, "weapon_knife")
	
	if (g_iszombie[id])
	{
		MaxHP[id] = get_pcvar_float(g_pcvar_zombiehp)
		set_pev(id, pev_health, MaxHP[id]) // use decimal number
	}
	else
	{
		weapon_method_menu(id)
		MaxHP[id] = 100.0
	}
	ev_Health(id)
	return PLUGIN_HANDLED
}

//AmmoX Ensures BackPack ammo is always full
public ev_AmmoX(id)
{
	set_pdata_int(id, AMMO_SLOT + read_data(1), 200, 5)
} 

//Sets the "Game" description ie. Counter-Strike, in our case Base Builder
public fw_GetGameDescription()
{
	// Return the mod name so it can be easily identified
	forward_return(FMV_STRING, g_ModName)
	
	return FMRES_SUPERCEDE;
}

/*-------------------------------------------------------------------------------------------------|
|----------------------------------Begin Player Model Code---[0005]--------------------------------|
|-------------------------------------------------------------------------------------------------*/

public ham_PlayerSpawn_Post(id)
{
	if (!is_user_alive(id))
		return
	
	g_isalive[id] = true
	g_pCurTeam[id] = cs_get_user_team(id)
	g_iszombie[id] = g_pCurTeam[id] == CS_TEAM_T ? true : false
	
	Add_Effects(id)
	remove_task(id + MODELSET_TASK)
	if (g_iszombie[id])
	{
		copy(g_PlayerModel[id], charsmax(g_PlayerModel[]), g_ZombieModel1)
		new currentmodel[32]
		fm_get_user_model(id, currentmodel, charsmax(currentmodel))
		if (!equal(currentmodel, g_PlayerModel[id]))
		{
			if (get_gametime() - g_RoundStartTime < 5.0)
				set_task(5.0 * MODELCHANGE_DELAY, "fm_user_model_update", id + MODELSET_TASK)
			else
				fm_user_model_update(id + MODELSET_TASK)
		}
	}
	else if (g_HasCustomModel[id])
	{
		fm_reset_user_model(id)
	}
}

public fw_SetClientKeyValue(id, const infobuffer[], const key[])
{   
	if (g_HasCustomModel[id] && equal(key, "model"))
		return FMRES_SUPERCEDE
	return FMRES_IGNORED
}

public fw_ClientUserInfoChanged(id)
{
	if (!g_HasCustomModel[id])
		return FMRES_IGNORED
	static currentmodel[32]
	fm_get_user_model(id, currentmodel, charsmax(currentmodel))
	if (!equal(currentmodel, g_PlayerModel[id]) && !task_exists(id + MODELSET_TASK))
		fm_set_user_model(id + MODELSET_TASK)
	return FMRES_IGNORED
}

public fm_user_model_update(taskid)
{
	static Float:current_time
	current_time = get_gametime()
	
	if (current_time - g_ModelsTargetTime >= MODELCHANGE_DELAY)
	{
		fm_set_user_model(taskid)
		g_ModelsTargetTime = current_time
	}
	else
	{
		set_task((g_ModelsTargetTime + MODELCHANGE_DELAY) - current_time, "fm_set_user_model", taskid)
		g_ModelsTargetTime = g_ModelsTargetTime + MODELCHANGE_DELAY
	}
}

public fm_set_user_model(player)
{
	player -= MODELSET_TASK
	engfunc(EngFunc_SetClientKeyValue, player, engfunc(EngFunc_GetInfoKeyBuffer, player), "model", g_PlayerModel[player])
	g_HasCustomModel[player] = true
}

stock fm_get_user_model(player, model[], len)
{
	engfunc(EngFunc_InfoKeyValue, engfunc(EngFunc_GetInfoKeyBuffer, player), "model", model, len)
}

stock fm_reset_user_model(player)
{
	g_HasCustomModel[player] = false
	dllfunc(DLLFunc_ClientUserInfoChanged, player, engfunc(EngFunc_GetInfoKeyBuffer, player))
}

/*-------------------------------------------------------------------------------------------------|
|------------------------------------End Player Model Code-----------------------------------------|
|-------------------------------------------------------------------------------------------------*/

/*-------------------------------------------------------------------------------------------------|
|----------------------------------Begin Entity Mover Code---[0004]--------------------------------|
|-------------------------------------------------------------------------------------------------*/
public cmdMoveEnt(id)
{
	if (g_BuildBan[id] == true)
		return PLUGIN_HANDLED
	
	if (g_iszombie[id] && !access(id, AFTER_BUILD))
      		return PLUGIN_HANDLED 
			
	if (!g_CanBuild && !access(id, AFTER_BUILD))
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_TIME_UP")
		return PLUGIN_HANDLED 
	}
	
	if (!g_isalive[id] && !access(id, DEAD_BUILD))
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_DEAD")
		return PLUGIN_HANDLED 
	}

	if (g_pEnt[id] && is_valid_ent(g_pEnt[id])) 
		cmdStopEnt(id)
	
	new ent, bodypart
	get_user_aiming (id,ent,bodypart)
	
	if (!is_valid_ent(ent) || ent == g_iEntBarrier)
	{
		return PLUGIN_HANDLED
	}
	
	if (ent <= g_MaxPlayers && g_isalive[ent])
	{	
		return PLUGIN_HANDLED
	}
		
	if (IsBlockLocked(ent) || g_MovingEnt[ent])
	{
		return PLUGIN_HANDLED
	}

	if (get_pcvar_num(g_pcvar_claimable) == 1)
	{
		if (!g_EntOwner[ent])
		{
			if ((g_OwnedEnts[id]<get_pcvar_num(g_pcvar_maxclaimable)) || get_pcvar_num(g_pcvar_maxclaimable) == 0)
			{
				g_EntOwner[ent] = id
				g_OwnedEnts[id]++
			}
			else
			{
				client_print (id, print_center, "%L", LANG_SERVER, "FAIL_MAXOWNED", get_pcvar_num(g_pcvar_maxclaimable))
			}
		}
		else if (g_EntOwner[ent] != id && !access(id, AFTER_BUILD))
		{
			client_print (id, print_center, "%L", LANG_SERVER, "FAIL_ALREADYOWNED")
			return PLUGIN_HANDLED 
		}
	}
	
	new tname[7], cname[10];
	entity_get_string(ent, EV_SZ_targetname, tname, 6);
	entity_get_string(ent, EV_SZ_classname, cname, 9);
	if (!equal(cname, "func_wall") || equal(tname, "ignore"))
	{
		return PLUGIN_HANDLED
	}
	
	new origin[3], Float:entOrigin[3], Float:orig[3], Float:mins[3], Float:maxs[3]
	
	entity_get_vector(ent, EV_VEC_origin, orig);
	entity_get_vector(ent, EV_VEC_mins, mins);
	entity_get_vector(ent, EV_VEC_maxs, maxs);

	entOrigin[0] = (mins[0] + maxs[0]) / 2.0 + orig[0];
	entOrigin[1] = (mins[1] + maxs[1]) / 2.0 + orig[1];
	entOrigin[2] = (mins[2] + maxs[2]) / 2.0 + orig[2];
	
	get_user_origin(id, origin);
	IVecFVec(origin, orig)

	g_pDist[id] = get_distance_f(orig, entOrigin);
	
	if (get_pcvar_num(g_pcvar_entmindist)) //maximum
	{
		if (g_pDist[id] < get_pcvar_float(g_pcvar_entmindist)) //minimum
			g_pDist[id] = get_pcvar_float(g_pcvar_entsetdist);
		/*if (g_pDist[id] < get_pcvar_float(g_pcvar_entminoffset))
		{
			g_pOffset[id][0] = orig[0] - entOrigin[0]
			g_pOffset[id][1] = orig[1] - entOrigin[1]
			g_pOffset[id][2] = orig[2] - entOrigin[2]
		}*/
	}

	if (get_pcvar_num(g_pcvar_entmaxdist)) //maximum
	{
		if (g_pDist[id] > get_pcvar_float(g_pcvar_entmaxdist))
			return PLUGIN_HANDLED
	}
	
	//set_pev(ent,pev_solid, SOLID_NOT)
	set_pev(ent,pev_rendermode,1)
	set_pev(ent,pev_renderamt,Float:{100.0})
	set_pev(ent,pev_rendercolor,Float:{135.0, 206.0, 235.0})

	g_MovingEnt[ent] = true
	g_EntMover[ent] = id
	g_pEnt[id] = ent

	ExecuteForward(g_fwGrabEnt,g_fwiFakeReturn, id, ent)
	
	if (!g_CanBuild && access(id, AFTER_BUILD))
	{
		new adminauthid[35],adminname[35]
		get_user_authid (id,adminauthid,34)
		get_user_name(id,adminname,34)
		Log("[MOVE] Admin: %s || SteamID: %s moved an entity", adminname, adminauthid)
	}
	
	return PLUGIN_HANDLED
}

public fw_Player_PreThink(id)
{
	if (!g_pEnt[id] || !is_valid_ent(g_pEnt[id]))
		return FMRES_HANDLED
		
	new buttons = pev(id, pev_button)
	if (buttons & IN_ATTACK)
	{
		g_pDist[id] += 3.0;
		
		if (g_pDist[id] > get_pcvar_float(g_pcvar_entmaxdist))
		{
			g_pDist[id] = get_pcvar_float(g_pcvar_entmaxdist)
			client_print(id, print_center, "%L", LANG_SERVER, "OBJECT_MAX")
		}
		else
			client_print(id, print_center, "%L", LANG_SERVER, "OBJECT_PUSH")
	}
	else if (buttons & IN_ATTACK2)
	{
		g_pDist[id] -= 3.0;
			
		if (g_pDist[id] < get_pcvar_float(g_pcvar_entsetdist))
		{
			g_pDist[id] = get_pcvar_float(g_pcvar_entsetdist)
			client_print(id, print_center, "%L", LANG_SERVER, "OBJECT_MIN")
		}
		else
			client_print(id, print_center, "%L", LANG_SERVER, "OBJECT_PULL")
	}
	
	new origin[3], Float:aiming[3], Float:pOrigin[3], Float:mins[3], Float:maxs[3], Float:neworigin[3]
	
	if (!g_isconnected[id] || (g_pEnt[id] <= g_MaxPlayers)? !g_isconnected[id]:!is_valid_ent(g_pEnt[id]))
	{
		cmdStopEnt(id)
		return PLUGIN_HANDLED
	}
	
	entity_get_vector(g_pEnt[id], EV_VEC_mins, mins);
	entity_get_vector(g_pEnt[id], EV_VEC_maxs, maxs);
	
	get_user_origin(id, origin, 3);
	IVecFVec(origin, aiming);
	get_user_origin(id, origin);
	IVecFVec(origin, pOrigin);
	
	aiming[0] -= pOrigin[0];
	aiming[1] -= pOrigin[1];
	aiming[2] -= pOrigin[2];

	new Float:scalar = g_pDist[id] / vector_length(aiming);
	
	IVecFVec(origin, neworigin);

	neworigin[0] += aiming[0] * scalar - (mins[0] + maxs[0]) / 2.0;
	neworigin[1] += aiming[1] * scalar - (mins[1] + maxs[1]) / 2.0;
	neworigin[2] += aiming[2] * scalar - (mins[2] + maxs[2]) / 2.0;
		
	entity_set_origin(g_pEnt[id], neworigin);
	
	return FMRES_HANDLED
}

public cmdStopEnt(id)
{
	new ent = g_pEnt[id]
	g_MovingEnt[ent] = false
	//set_pev(ent,pev_solid, SOLID_BSP)
	set_pev(ent,pev_rendermode,0)
	set_pev(ent,pev_renderamt,Float:{255.0})
	set_pev(ent,pev_rendercolor,Float:{0.0, 0.0, 0.0})

	ExecuteForward(g_fwDropEnt,g_fwiFakeReturn, id, ent)
	
	g_EntMover[ent] = 0
	g_LastMover[ent] = id
	g_pEnt[id] = 0
}

public fw_Traceline(Float:start[3], Float:end[3], conditions, id, trace)
{
	if (!is_user_alive(id))  return PLUGIN_HANDLED
	
	new ent = get_tr2(trace, TR_pHit)
	
	if (is_valid_ent(ent))
	{
		new ent,body
		get_user_aiming(id,ent,body)
		
		new cname[10], tname[7];
		entity_get_string(ent, EV_SZ_classname, cname, 9);
		entity_get_string(ent, EV_SZ_targetname, tname, 6);
		if (equal(cname, "func_wall") && !equal(tname, "ignore") && ent != g_iEntBarrier && get_pcvar_num(g_pcvar_showmovers) == 1)
		{
			if (g_CanBuild || access(id, ADMIN_KICK))
			{
				if (IsBlockLocked(ent))
				{
					set_hudmessage(255, 0, 0, -1.0, 0.55, 1, 0.01, 3.0, 0.01, 0.01);
					ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_LOCKED");
					return PLUGIN_HANDLED
				}
				set_hudmessage(0, 50, 255, -1.0, 0.55, 1, 0.01, 3.0, 0.01, 0.01);
				if (get_pcvar_num(g_pcvar_claimable) == 0)
				{
					new currentmover[35], lastmover[35]
					if (g_EntMover[ent])
					{
						get_user_name(g_EntMover[ent],currentmover,34)
						if (!g_LastMover[ent]) ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_INFO1", currentmover);
					}
					if (g_LastMover[ent])
					{
						get_user_name(g_LastMover[ent],lastmover,34)
						if (!g_EntMover[ent]) ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_INFO2", lastmover);
					}
					if (g_LastMover[ent] && g_EntMover[ent]) ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_INFO3", currentmover, lastmover);
					else if (!g_LastMover[ent] && !g_EntMover[ent]) ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_INFO4");
				}
				else
				{
					if (g_EntOwner[ent])
					{
						new entowner[35]
						get_user_name(g_EntOwner[ent],entowner,34)
						ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_OWNER", entowner);
					}
					else 
					{
						ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_OWNER_NONE");
					}
				}
			}
		}
	}
	else ClearSyncHud(id, gHudSyncInfo);
	
	return PLUGIN_HANDLED
}

public cmdLockBlock(id)
{
	if (!access(id, LOCK_BLOCKS))
		return PLUGIN_HANDLED
		
	new ent, bodypart
	get_user_aiming (id,ent,bodypart)
	
	new tname[7], cname[10];
	entity_get_string(ent, EV_SZ_targetname, tname, 6);
	entity_get_string(ent, EV_SZ_classname, cname, 9);

	if (!ent || !is_valid_ent(ent) || is_user_alive(ent) || ent == g_iEntBarrier || !equal(cname, "func_wall") || equal(tname, "ignore")) return PLUGIN_HANDLED
	
	if (!IsBlockLocked(ent) && !g_MovingEnt[ent])
	{
		LockBlock(ent)
		set_pev(ent,pev_rendermode,1)
		set_pev(ent,pev_rendercolor,Float:{125.0, 0.0, 0.0})
		
		g_OwnedEnts[g_EntOwner[ent]]--
		g_EntOwner[ent] = 0
	}
	else if (IsBlockLocked(ent))
	{
		UnlockBlock(ent)
		set_pev(ent,pev_rendermode,0)
	}
	return PLUGIN_HANDLED
}

public cmdRemoveClaim(id)
{
	if (!access(id, LOCK_BLOCKS))
      		return PLUGIN_HANDLED 
		
	new ent, bodypart
	get_user_aiming (id,ent,bodypart)
	
	new tname[7], cname[10];
	entity_get_string(ent, EV_SZ_targetname, tname, 6);
	entity_get_string(ent, EV_SZ_classname, cname, 9);

	if (!ent || !is_valid_ent(ent) || is_user_alive(ent) || ent == g_iEntBarrier || !equal(cname, "func_wall") || equal(tname, "ignore") || IsBlockLocked(ent)) return PLUGIN_HANDLED

	g_OwnedEnts[g_EntOwner[ent]]--
	g_EntOwner[ent] = 0
	
	return PLUGIN_HANDLED
}

public cmdRemoveEnt(id)
{
	if (!access(id, REMOVE_BLOCK))
      		return PLUGIN_HANDLED 

	if (!g_isalive[id] && !access(id, DEAD_REMOVE))
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_REMOVE")
		return PLUGIN_HANDLED 
	}
      	
	new ent, bodypart
	get_user_aiming (id,ent,bodypart)
	
	if(!is_valid_ent(ent) || ent == g_iEntBarrier || (ent <= g_MaxPlayers && g_isalive[ent]))
		return PLUGIN_HANDLED
	
	if(IsBlockLocked(ent) || g_MovingEnt[ent])
		return PLUGIN_HANDLED

	new tname[7], cname[10];
	entity_get_string(ent, EV_SZ_targetname, tname, 6);
	entity_get_string(ent, EV_SZ_classname, cname, 9);
	if(!equal(cname, "func_wall"))
		return PLUGIN_HANDLED
	
	if(equal(tname, "ignore"))
		return PLUGIN_HANDLED
	
	g_OwnedEnts[g_EntOwner[ent]]--
	g_EntOwner[ent] = 0
	
	remove_entity(ent)
	
	new adminauthid[35],adminname[35]
	get_user_authid (id,adminauthid,34)
	get_user_name(id,adminname,34)
	Log("[REMOVE] Admin: %s || SteamID: %s removed an entity", adminname, adminauthid)
	
	return PLUGIN_HANDLED
}

public cmdResetEnts(id)
{
	if (!access(id, ADMIN_RESET))
		return PLUGIN_HANDLED
	
	new cname[10], tname[7];
	for (new iEnt = g_MaxPlayers+1; iEnt < MAXENTS; iEnt++)
	{
		if (is_valid_ent(iEnt))
		{
			entity_get_string(iEnt, EV_SZ_classname, cname, 9);
			entity_get_string(iEnt, EV_SZ_targetname, tname, 6);
			if (!IsBlockLocked(iEnt) && iEnt != g_iEntBarrier && equal(cname, "func_wall") && !equal(tname, "ignore"))
				engfunc( EngFunc_SetOrigin, iEnt, Float:{ 0.0, 0.0, 0.0 } );
		}
	}
	
	new adminauthid[35],adminname[35]
	get_user_authid (id,adminauthid,34)
	get_user_name(id,adminname,34)
	Log("[RESET-ENTS] Admin: %s || SteamID: %s reset the entities", adminname, adminauthid)
	
	return PLUGIN_HANDLED
}

public cmdResetAim(id)
{
	if (!access(id, ADMIN_RESET))
      		return PLUGIN_HANDLED 

	new ent, bodypart
	get_user_aiming (id,ent,bodypart)
	
	if(!is_valid_ent(ent) || ent == g_iEntBarrier || (ent <= g_MaxPlayers && g_isalive[ent]))
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_RESET")
		return PLUGIN_HANDLED
	}
	
	if(IsBlockLocked(ent) || g_MovingEnt[ent])
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_RESET")
		return PLUGIN_HANDLED
	}

	new tname[7], cname[10];
	entity_get_string(ent, EV_SZ_targetname, tname, 6);
	entity_get_string(ent, EV_SZ_classname, cname, 9);
	if(!equal(cname, "func_wall") || equal(tname, "ignore"))
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_RESET")
		return PLUGIN_HANDLED
	}
	
	engfunc( EngFunc_SetOrigin, ent, Float:{ 0.0, 0.0, 0.0 } );
	
	new adminauthid[35],adminname[35], targetauthid[35],targetname[35]
	get_user_authid (id,adminauthid,34)
	get_user_name(id,adminname,34)
	get_user_authid(g_EntOwner[ent],targetauthid,34)
	get_user_name(g_EntOwner[ent],targetname,34)
	Log("[REMOVE] Admin: %s || SteamID: %s reset a block belonging to Player: %s || SteamID: %s", adminname, adminauthid, targetauthid, targetname)
	
	g_OwnedEnts[g_EntOwner[ent]]--
	g_EntOwner[ent] = 0
	
	return PLUGIN_HANDLED
}


public cmdClearEnts(id)
{
	if (!access(id, ADMIN_RESET))
		return PLUGIN_HANDLED
	
	new cname[10], tname[7];
	for (new iEnt = g_MaxPlayers+1; iEnt < MAXENTS; iEnt++)
	{
		if (is_valid_ent(iEnt))
		{
			entity_get_string(iEnt, EV_SZ_classname, cname, 9);
			entity_get_string(iEnt, EV_SZ_targetname, tname, 6);
			if (!IsBlockLocked(iEnt) && iEnt != g_iEntBarrier && equal(cname, "func_wall") && !equal(tname, "ignore") && !g_LastMover[iEnt])
			{
				set_pev(iEnt,pev_solid,SOLID_NOT)
				set_pev(iEnt,pev_rendermode,1)
				set_pev(iEnt,pev_renderamt,Float:{0.0})
				g_InvisEnt[iEnt] = true
			}
		}
	}
	
	new adminauthid[35],adminname[35]
	get_user_authid (id,adminauthid,34)
	get_user_name(id,adminname,34)
	Log("[CLEAR-ENTS] Admin: %s || SteamID: %s reset the entities", adminname, adminauthid)
	
	return PLUGIN_HANDLED
}

/*-------------------------------------------------------------------------------------------------|
|------------------------------------End Entity Mover Code-----------------------------------------|
|-------------------------------------------------------------------------------------------------*/

// Ham Weapon Deploy Forward (forces knife only)
public ham_ItemDeploy_Post(weapon_ent)
{
	static owner
	owner = get_pdata_cbase(weapon_ent, OFFSET_WEAPONOWNER, OFFSET_LINUX_WEAPONS);
	
	static weaponid
	weaponid = cs_get_weapon_id(weapon_ent)
	
	g_CurrentWeapon[owner] = weaponid
	
	if (g_iszombie[owner] && !((1<<weaponid) & ZOMBIE_ALLOWED_WEAPONS_BITSUM))
	{
		g_CurrentWeapon[owner] = CSW_KNIFE
		engclient_cmd(owner, "weapon_knife")
	}
	else if (g_CanBuild && !g_iszombie[owner])
	{
		g_CurrentWeapon[owner] = CSW_KNIFE
		engclient_cmd(owner, "weapon_knife")
		client_print(owner, print_center, "%L", LANG_SERVER, "FAIL_KNIFE_ONLY");
	}
}

public msgRoundEnd(const MsgId, const MsgDest, const MsgEntity)
{
	static Message[192]
	get_msg_arg_string(2, Message, 191)
	
	set_hudmessage(255, 255, 255, -1.0, 0.40, 0, 6.0, 6.0, 0.1, 0.2, 1)
	
	if(equal(Message, "#Game_bomb_drop"))
		return PLUGIN_HANDLED
	
	if (equal(Message, "#Terrorists_Win"))
	{
		show_hudmessage(0, "Zombies Win!")
		set_msg_arg_string(2, "")
		client_cmd(0, "spk %s", g_WinZomb)
	}
	else if (equal(Message, "#Target_Saved") || equal(Message, "#CTs_Win"))
	{
		show_hudmessage(0, "Builders Win!")
		set_msg_arg_string(2, "")
		client_cmd(0, "spk %s", g_WinHum)
	}
	return PLUGIN_HANDLED
}

public ham_WeaponCleaner_Post(iEntity)
{
	call_think(iEntity)
}

/*-------------------------------------------------------------------------------------------------|
|----------------------------Begin Auto Join on Connect Code----[0003]-----------------------------|
|-------------------------------------------------------------------------------------------------*/

public message_show_menu(msgid, dest, id) 
{
	if (!(!get_user_team(id) && !g_isbot[id] && !access(id, ADMIN_IMMUNITY)))//
		return PLUGIN_CONTINUE

	static team_select[] = "#Team_Select"
	static menu_text_code[sizeof team_select]
	get_msg_arg_string(4, menu_text_code, sizeof menu_text_code - 1)
	if (!equal(menu_text_code, team_select))
		return PLUGIN_CONTINUE

	static param_menu_msgid[2]
	param_menu_msgid[0] = msgid
	set_task(AUTO_TEAM_JOIN_DELAY, "task_force_team_join", id, param_menu_msgid, sizeof param_menu_msgid)

	return PLUGIN_HANDLED
}

public message_vgui_menu(msgid, dest, id) 
{
	if (get_msg_arg_int(1) != TEAM_SELECT_VGUI_MENU_ID || !(!get_user_team(id) && !g_isbot[id] && !access(id, ADMIN_IMMUNITY)))// 
		return PLUGIN_CONTINUE
		
	static param_menu_msgid[2]
	param_menu_msgid[0] = msgid
	set_task(AUTO_TEAM_JOIN_DELAY, "task_force_team_join", id, param_menu_msgid, sizeof param_menu_msgid)

	return PLUGIN_HANDLED
}

public task_force_team_join(menu_msgid[], id) 
{
	if (get_user_team(id))
		return

	static msg_block
	msg_block = get_msg_block(menu_msgid[0])
	set_msg_block(menu_msgid[0], BLOCK_SET)
	engclient_cmd(id, "jointeam", "5")
	engclient_cmd(id, "joinclass", "5")
	set_msg_block(menu_msgid[0], msg_block)
	
	g_pTeam[id] = cs_get_user_team(id)
	g_pCurTeam[id] = cs_get_user_team(id)
}

/*-------------------------------------------------------------------------------------------------|
|----------------------------End Auto Join on Connect Code-----------------------------------------|
|-------------------------------------------------------------------------------------------------*/

public clcmd_changeteam(id)
{
	if (!access(id, ADMIN_IMMUNITY))
	{
		if (g_iszombie[id])
			client_print (id, print_center, "%L", LANG_SERVER, "FAIL_ZOMBIE")
		else if (g_CanBuild) 
			weapon_method_menu(id)
		else 
			client_print (id, print_center, "%L", LANG_SERVER, "FAIL_WEAPONS")
			
		return PLUGIN_HANDLED
	}
	return PLUGIN_CONTINUE
}

public clcmd_drop(id)
{
	client_print (id, print_center, "%L", LANG_SERVER, "FAIL_DROP")
	return PLUGIN_HANDLED
}

public clcmd_buy(id)
{
	client_print (id, print_center, "%L", LANG_SERVER, "FAIL_BUY")
	return PLUGIN_HANDLED
}

public Base_Calc()
{
	new players[32], num, ct, basenum
	get_players(players, num)
	new player
	for(new i = 0; i < num; i++)
	{
		player = players
		if (cs_get_user_team(player) == CS_TEAM_CT)
			ct++

		if (ct < 6)
			basenum = 2
		else
			basenum = (ct/3)
	}
	print_color(0, "%s %L", formatmodname, LANG_SERVER, "BASE_CALC", basenum)
}

public Fix_Spawns()
{
	new players[32], num
	get_players(players, num)
			
	new player
	for(new i = 0; i < num; i++)
	{
		player = players
		if (cs_get_user_team(player) == CS_TEAM_CT && !is_user_alive(player) && g_isconnected[player] && g_CanBuild)
			ExecuteHamB(Ham_CS_RoundRespawn, player)
	}
}

public msgScoreAttrib(msgid, dest, id)
{
	static attrib 
	attrib = get_msg_arg_int(2)
	
	if(attrib == (1<<1))
		set_msg_arg_int(2, ARG_BYTE, 0)
}

public msgStatusIcon(const iMsgId, const iMsgDest, const iPlayer)
{
	if(g_isalive[iPlayer] && g_isconnected[iPlayer]) 
	{
		static szMsg[8]
		get_msg_arg_string(2, szMsg, 7)
    
    		if (szMsg[0] == 'c' && szMsg[1] == '4') return PLUGIN_HANDLED
		else return PLUGIN_CONTINUE
    
		if(equal(szMsg, "buyzone"))
		{
			set_pdata_int(iPlayer, OFFSET_BUYZONE, get_pdata_int(iPlayer, OFFSET_BUYZONE) & ~(1<<0))
			return PLUGIN_HANDLED
		}
	}
	return PLUGIN_CONTINUE
} 

/*public fw_CreateNamedEntity(entclassname)
{
	static classname[10]
	engfunc(EngFunc_SzFromIndex, entclassname, classname, 9)
	
	return (classname[7] == 'c' && classname[8] == '4') ? FMRES_SUPERCEDE : FMRES_IGNORED
}*/

public cmdBuildBan(id)
{
	if (access(id, BUILD_BAN))
	{
		new arg[32]
		read_argv(1, arg, 31)
		new player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)
		g_BuildBan[player] = true
		cmdStopEnt(player)
		
		new adminauthid[35],adminname[35],playername[35],playerauthid[35]
		get_user_name(id,adminname,34)
		get_user_authid (id,adminauthid,34)
		get_user_name(player, playername, 34)
		get_user_authid (player,playerauthid,34)
		Log("[MOVE] Admin: %s || SteamID: %s banned Player: %s || SteamID: %s from building", adminname, adminauthid, playername, playerauthid)
		
		client_print(id, print_console, "%L", LANG_SERVER, "BUILD_BAN1", playername)
		client_print(player, print_center, "%L", LANG_SERVER, "BUILD_BAN2")
	}
}

public cmdBuildUnban(id)
{
	if (access(id, BUILD_BAN))
	{
		new arg[32], playername[35]
	
		read_argv(1, arg, 31)
		new player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)
		get_user_name(player, playername, 34)
		client_print(id, print_console, "%L", LANG_SERVER, "UNBUILD_BAN1", playername)
		g_BuildBan[player] = false
		print_color(player, "%s %L", formatmodname, LANG_SERVER, "UNBUILD_BAN2")
	}
}

public cmdRevive(id)
{
	if (access(id, REVIVE))
	{
		new arg[32]
		read_argv(1, arg, 31)
		new player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)

		if (is_user_alive(player))
		{
			client_print(id, print_console, "%L", LANG_SERVER, "FAIL_REVIVE")
			return PLUGIN_HANDLED
		}
		
		ExecuteHamB(Ham_CS_RoundRespawn, player)
		
		new adminauthid[35],adminname[35],playername[35],playerauthid[35]
		get_user_name(id,adminname,34)
		get_user_authid (id,adminauthid,34)
		get_user_name(player, playername, 34)
		get_user_authid (player,playerauthid,34)
		Log("[REVIVE] Admin: %s || SteamID: %s revived Player: %s || SteamID: %s", adminname, adminauthid, playername, playerauthid)
		
		client_print(id, print_console, "%L", LANG_SERVER, "REVIVE1", playername)
		client_print(player, print_center, "%L", LANG_SERVER, "REVIVE2")
	}
	return PLUGIN_HANDLED
}


public cmdGiveGuns(id)
{
	if (access(id, ADMIN_GUNS))
	{
		new arg[32]
		read_argv(1, arg, 31)
		new player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)
		
		new playername[35]
		get_user_name(player, playername, 34)
		
		if (g_isalive[player])
		{
			weapon_method_menu(player)
			
			client_print(id, print_console, "%L", LANG_SERVER, "GIVEGUNS1", playername)
			client_print(player, print_center, "%L", LANG_SERVER, "GIVEGUNS2")
		}
		else
		{
			client_print(id, print_console, "%L", LANG_SERVER, "GIVEGUNS3", playername)
		}
	}
	return PLUGIN_HANDLED
}

public cmdSwap(id)
{
	if (access(id, SWAP))
	{
		new arg[32]
		read_argv(1, arg, 31)
		new player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)

		if (!is_user_connected(player)) return PLUGIN_HANDLED
		
		cs_set_user_team(player, cs_get_user_team(player) == CS_TEAM_T ? CS_TEAM_CT:CS_TEAM_T)
			
		g_iszombie[id] = cs_get_user_team(id) == CS_TEAM_T ? true : false
		
		if (is_user_alive(player))
			ExecuteHamB(Ham_CS_RoundRespawn, player)
		
		new adminauthid[35],adminname[35],playername[35],playerauthid[35]
		get_user_name(id,adminname,34)
		get_user_authid (id,adminauthid,34)
		get_user_name(player, playername, 34)
		get_user_authid (player,playerauthid,34)
		Log("[TEAM-SWAP] Admin: %s || SteamID: %s swapped Player: %s || SteamID: %s", adminname, adminauthid, playername, playerauthid)
		
		client_print(id, print_console, "%L", LANG_SERVER, "SWAP1", playername)
		client_print(player, print_center, "%L", LANG_SERVER, "SWAP2")
	}
	return PLUGIN_HANDLED
}

public cmdStartRound(id)
{
	if (access(id, START_ROUND))
	{
		if (count_down<10)
		{
			client_print(id, print_console, "%L", LANG_SERVER, "FAIL_START_ROUND")
			return PLUGIN_HANDLED
		}
		
		Release_Zombies()
		
		new adminauthid[35],adminname[35]
		get_user_name(id,adminname,34)
		get_user_authid (id,adminauthid,34)
		Log("[START_ROUND] Admin: %s || SteamID: %s started the round", adminname, adminauthid)
		
		client_print(id, print_center, "%L", LANG_SERVER, "START_ROUND")
		client_print(id, print_chat, "^x04%L", LANG_SERVER, "START_ROUND")
	}
	return PLUGIN_HANDLED
}


public cmdSay(id)
{
	new arg[64], arg1[31], arg2[32]
	read_args(arg1, charsmax(arg1));
	remove_quotes(arg1);
	read_args(arg,63)
	remove_quotes(arg)
	strtok(arg,arg1,255,arg2,255,' ',1)
	trim(arg2)
	
	if(arg1[0] == '/')
	{
		if (equali(arg1, "/cmds") == 1 || equali(arg1, "/commands") == 1)
		{
			print_color(id, "%s /respawn, /fixspawn, /help, /round, /guns", formatmodname)
			if (access(id, ADMIN_KICK))
				print_color(id, "%s Admin: /fixspawns, /respawns, removeaim, lockaim, unclaimaim", formatmodname)
			return PLUGIN_HANDLED
		}

		if (equali(arg1, "/respawn") == 1 || equali(arg1, "/revive") == 1)
		{
			Respawn_Zombie(id)
			return PLUGIN_HANDLED
		}
		
		if (equali(arg1, "/fixspawn") == 1)
		{
			if (g_isconnected[id] && !g_iszombie[id] && g_CanBuild)
				ExecuteHamB(Ham_CS_RoundRespawn, id)
				
			return PLUGIN_HANDLED
		}
		if (equali(arg1, "/help") == 1 || equali(arg1, "/rules") == 1)
		{
			set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 15.0, 0.1, 0.2, 2)
			new nLen, szHelp[512]
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "WELCOME_MSG", VERSION);
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "BIND_KEY");
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "RULE1");
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "RULE2");
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "RULE3");
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "RULE4");
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "RULE5");
			show_hudmessage(id, szHelp);
			
			return PLUGIN_HANDLED
		}

		if (equali(arg1, "/round") == 1)
		{
			if (g_ZombiesReleased) print_color(id, "%s Round: %d of %d", formatmodname, (g_RoundNum), g_pcvar_maxrounds)
			else if (!g_ZombiesReleased) print_color(id, "%s Round: %d of %d", formatmodname, (g_RoundNum+1), g_pcvar_maxrounds)
			
			return PLUGIN_HANDLED
		}
	
		if (equali(arg1, "/guns") == 1)
		{
			if(!g_isalive[id] || !g_isconnected[id] || g_iszombie[id])
				return PLUGIN_HANDLED
			
			if(!g_CanBuild && !access(id, ADMIN_GUNS))
				return PLUGIN_HANDLED	
		
			weapon_method_menu(id)
			
			return PLUGIN_HANDLED
		}
	
		if (equali(arg1, "/fixspawns") == 1 && access(id, BAD_SPAWN))
		{
			new players[32], num
			get_players(players, num)
				
			new player
			for(new i = 0; i < num; i++)
			{
				player = players
				if (cs_get_user_team(player) == CS_TEAM_CT && !is_user_alive(player) && g_isconnected[player] && g_CanBuild)
					ExecuteHamB(Ham_CS_RoundRespawn, player)
			}
			return PLUGIN_HANDLED
		}
		
		if (equali(arg1, "/respawns") == 1 && access(id, BAD_SPAWN))
		{
			new players[32], num
			get_players(players, num)
				
			new player
			for(new i = 0; i < num; i++)
			{
				player = players
				if (cs_get_user_team(player) == CS_TEAM_T && !is_user_alive(player) && g_isconnected[player])
					ExecuteHamB(Ham_CS_RoundRespawn, player)
			}
			return PLUGIN_HANDLED
		}
	}
	return PLUGIN_CONTINUE
}

/*-------------------------------------------------------------------------------------------------|
|----------------------------------Begin Status Text Code---[0006]---------------------------------|
|-------------------------------------------------------------------------------------------------*/
public msgStatusValue()
{
	//Block the name info, of person you aim at
	set_msg_block(gmsgStatusText, BLOCK_SET);
}

public ev_SetTeam(id)
{
	g_friend[id] = read_data(2)
}

public ev_ShowStatus(id) //called when id looks at someone
{
	new name[32], pid = read_data(2);
	
	get_user_name(pid, name, 31);
	new color1 = 0, color2 = 0;

	if (get_user_team(pid) == 1)
		color1 = 255;
	else
		color2 = 255;

	new Float:height=0.30
	//height=0.60

	if (g_friend[id] == 1)	// friend
	{
		new clip, ammo, wpnid = get_user_weapon(pid, clip, ammo);
		new wpnname[32];

		if (wpnid)
			xmod_get_wpnname(wpnid, wpnname, 31);

		set_hudmessage(color1, 50, color2, -1.0, height, 1, 0.01, 3.0, 0.01, 0.01);
		new nLen, szStatus[512]
		nLen += format( szStatus[nLen], 511-nLen, "%L", LANG_SERVER, "PLAYER_INFO1", name, get_user_health(pid), wpnname);
		ShowSyncHudMsg(id, gHudSyncInfo, szStatus);
	} 
	if (g_friend[id] != 1) //enemy
	{
		set_hudmessage(color1, 50, color2, -1.0, height, 1, 0.01, 3.0, 0.01, 0.01);
		ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "PLAYER_INFO2", name);
	}
}

public ev_HideStatus(id)
{
	ClearSyncHud(id, gHudSyncInfo);
}
/*-------------------------------------------------------------------------------------------------|
|------------------------------------------End Player Model Code-----------------------------------|
|-------------------------------------------------------------------------------------------------*/

/*-------------------------------------------------------------------------------------------------|
|-------------------------------Begin Guns Menu Code-[0001]----------------------------------------|
|-------------------------------------------------------------------------------------------------*/

//Call this on player spawn
public weapon_method_menu(id)
{
	if(firsttime[id])
	{
		firsttime[id] = false
		prim_weapons_menu(id,0)
	}
	else
	{
		cur_offset[id] = 0
		show_menu(id,(1<<0)|(1<<1),"\yChoose Your Weapon^n^n\y1. \wNew Guns^n\y2. \wLast Guns",-1,"WeaponMethodMenu")
	}
}

public weapon_method_pushed(id,key)
{
	switch(key)
	{
		case 0: prim_weapons_menu(id,0)
		case 1: give_weapons(id)
	}
	return PLUGIN_HANDLED;
}

public prim_weapons_menu(id,offset)
{
	if(offset<0) offset = 0

	new cvar_value[32]
	get_pcvar_string(g_pcvar_allowedweps,cvar_value,31)
	new flags = read_flags(cvar_value)

	new keys, curnum, menu[2048]
	for(new i=offset;i<19;i++)
	{
		if(flags & power(2,i))
		{
			options_on_menu[curnum][id] = i
			keys += (1<<curnum)
	
			curnum++
			format(menu,2047,"%s^n%d. %s",menu,curnum,WEAPONNAMES)
	
			if(curnum==8)
			break;
		}
	}

	format(menu,2047,"\yPrimary Weapon:\w^n%s^n",menu)
	if(curnum==8 && offset<12)
	{
		keys += (1<<8)
		format(menu,2047,"%s^n9. Next",menu)
	}
	if(offset)
	{
		keys += (1<<9)
		format(menu,2047,"%s^n0. Back",menu)
	}

	show_menu(id,keys,menu,-1,"PrimaryWeaponSelect")
}

public prim_weapons_pushed(id,key)
{
	if(key<8)
	{
		weapon_picked[0][id] = options_on_menu[key][id]
		cur_offset[id] = 0
		sec_weapons_menu(id,0)
	}
	else
	{
		if(key==8)
			cur_offset[id] += 8
		if(key==9)
			cur_offset[id] -= 8
		prim_weapons_menu(id,cur_offset[id])
	}
	return ;
}

public sec_weapons_menu(id,offset)
{
	if(offset<0) offset = 0

	new cvar_value[32]
	get_pcvar_string(g_pcvar_allowedweps,cvar_value,31)
	new flags = read_flags(cvar_value)

	new keys, curnum, menu[2048]
	for(new i=18;i<24;i++)
	{
		if(flags & power(2,i))
		{
		options_on_menu[curnum][id] = i
		keys += (1<<curnum)

		curnum++
		format(menu,2047,"%s^n%d. %s",menu,curnum,WEAPONNAMES[i])
		}
	}

	format(menu,2047,"\ySecondary Weapon:\w^n%s",menu)

	show_menu(id,keys,menu,-1,"SecWeaponSelect")
}

public sec_weapons_pushed(id,key)
{
	if(key<8)
	{
		weapon_picked[1][id] = options_on_menu[key][id]
	}
	give_weapons(id)
	return ;
}

public give_weapons(id)
{
	strip_user_weapons(id)
	give_item(id,"weapon_knife")
   
	new weapon[32]
	new csw = csw_contant(weapon_picked[0][id])
	get_weaponname(csw,weapon,31)
	give_item(id,weapon)
	cs_set_user_bpammo(id,csw,999)
	g_PrimaryWeapon[id] = csw

	csw = csw_contant(weapon_picked[1][id])
	get_weaponname(csw,weapon,31)
	give_item(id,weapon)
	cs_set_user_bpammo(id,csw,999)
}

public csw_contant(weapon)
{
	new num = 29
	switch(weapon)
	{
		case 0: num = 3
		case 1: num = 5
		case 2: num = 7
		case 3: num = 8
		case 4: num = 12
		case 5: num = 13
		case 6: num = 14
		case 7: num = 15
		case 8: num = 18
		case 9: num = 19
		case 10: num = 20
		case 11: num = 21
		case 12: num = 22
		case 13: num = 23
		case 14: num = 24
		case 15: num = 27
		case 16: num = 28
		case 17: num = 30
		case 18: num = 1
		case 19: num = 10
		case 20: num = 11
		case 21: num = 16
		case 22: num = 17
		case 23: num = 26
		case 24:
		{
			new s_weapon[32]
		
			get_pcvar_string(g_pcvar_allowedweps,s_weapon,31)
		   
			new flags = read_flags(s_weapon)
			do
			{
				num = random_num(0,18)
				if(!(num & flags))
				{
					num = -1
				}
			}
			while(num==-1)
			num = csw_contant(num)
		}
		case 25:
		{
			new s_weapon[32]

			get_pcvar_string(g_pcvar_allowedweps,s_weapon,31)
		
			new flags = read_flags(s_weapon)
			do
			{
				num = random_num(18,23)
				if(!(num & flags))
				{
					num = -1
				}
			}
			while(num==-1)
			num = csw_contant(num)
		}
	}
	return num;
}

/*-------------------------------------------------------------------------------------------------|
|---------------------------------End Guns Menu Code-----------------------------------------------|
|-------------------------------------------------------------------------------------------------*/

public ev_Health(id)
{
	if (is_user_alive(id))
	{
		set_hudmessage(255, 255, 255, -1.0, 0.9, 0, 12.0, 12.0, 0.1, 0.2, 4);
		show_hudmessage(id, "%L", LANG_SERVER, "PLAYER_HEALTH", get_user_health(id));
		
		set_task(11.9, "ev_Health", id);
	}
}

public msgHealth(msgid, dest, id)
{
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE;
	
	static hp;
	hp = get_msg_arg_int(1);
	
	if(hp > 255 && (hp % 256) == 0)
		set_msg_arg_int(1, ARG_BYTE, ++hp);
	
	return PLUGIN_CONTINUE;
}

Log(const message_fmt[], any:...)
{
	static message[256];
	vformat(message, sizeof(message) - 1, message_fmt, 2);
	
	static filename[96];
	static dir[64];
	if( !dir[0] )
	{
		get_basedir(dir, sizeof(dir) - 1);
		add(dir, sizeof(dir) - 1, "/logs");
	}
	
	format_time(filename, sizeof(filename) - 1, "%m-%d-%Y");
	format(filename, sizeof(filename) - 1, "%s/ADMIN_ACTIVITY_%s.log", dir, filename);
	
	log_to_file(filename, "%s", message);
}

print_color(target, const message[], any:...)
{
	static buffer[512], i, argscount
	argscount = numargs()
	
	// Send to everyone
	if (!target)
	{
		static player
		for (player = 1; player <= g_MaxPlayers; player++)
		{
			if (!g_isconnected[player])
				continue;

			static changed[5], changedcount
			changedcount = 0

			for (i = 2; i < argscount; i++)
			{
				if (getarg(i) == LANG_PLAYER)
				{
					setarg(i, 0, player)
					changed[changedcount] = i
					changedcount++
				}
			}
			vformat(buffer, charsmax(buffer), message, 3)

			message_begin(MSG_ONE_UNRELIABLE, gmsgSayText, _, player)
			write_byte(player)
			write_string(buffer)
			message_end()
			
			for (i = 0; i < changedcount; i++)
				setarg(changed[i], 0, LANG_PLAYER)
		}
	}
	// Send to specific target
	else
	{
		vformat(buffer, charsmax(buffer), message, 3)

		message_begin(MSG_ONE, gmsgSayText, _, target)
		write_byte(target)
		write_string(buffer)
		message_end()
	}
}
Image
Server: (25:47) Bb.Proskill.Ro # BaseBuilder 6.5 , Cautam Admini
Ip: 95.64.36.30:27015
Name: PSR @ mIRr-0r.dll
Functie: Detinator + FTP
Rank/Top15: 1
RoyalServer 2
EDwardddd.
Membru, skill +2
Membru, skill +2
Posts: 806
Joined: 18 Jun 2010, 10:30
Detinator Steam: Da
SteamID: edwarddwd
Reputatie: Membru Club eXtreamCS (trei luni)
Fost Moderator ajutator
Nume anterioare: Elk, eDward /R/
Has thanked: 16 times
Been thanked: 49 times

13 Jul 2013, 11:24

Mutat in: Prima pagină » eXtream - Counter-Strike 1.6 » Pluginuri » Cereri
User avatar
FlyingSnow
Membru, skill +2
Membru, skill +2
Posts: 825
Joined: 01 Oct 2012, 02:22
Detinator Steam: Da
Detinator server CS: Dap.
SteamID: Nu-i public.
Has thanked: 26 times
Been thanked: 52 times
Contact:

13 Jul 2013, 11:42

SHOP | Afiseaza codul
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <engine>

#define NORMAL DontChange
#define GREEN DontChange
#define TEAM_COLOR DontChange
#define RED Red
#define BLUE Blue
#define GREY Grey
#define ColorChat client_print_color

#define VERSION "1.0"

#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )

#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame

#pragma semicolon 1

enum _:Colors {
	DontChange,
	Red,
	Blue,
	Grey
};

new const g_prefix[] = "[Base Builder Orizont]";

new const g_ModelSuperKnife[] = "models/bb/superknife.mdl";
new const g_ModelSuperDeagle[] = "models/bb/v_golden_deagle.mdl";

new bool:g_bHasSuperKnife[33],
	bool:g_bHasSuperSpeed[33],
	bool:g_bHasSuperM249[33],
	bool:g_bHasSuperAWP[33],
	bool:g_bHasSuperDeagle[33],
	bool:g_bHasGunsKit[33];
	

new g_iMaxPlayers;

new g_pCvarCostSuperCut,
	g_pCvarCostLowGrav,
	g_pCvarQuantityLowGrav,
	g_pCvarCostSpeed,
	g_pCvarQuantitySpeed,
	g_pCvarQuantityHealthCT,
	g_pCvarCostHealthCT,
	g_pCvarCostHE,
	g_pCvarCostFlash,
	g_pCvarCostSmoke,
	g_pCvarCostSuperM249,
	g_pCvarCostSuperAWP,
	g_pCvarCostSuperDeagle,
	g_pCvarCostKitGuns,
	g_pCvarQuantityHealthT1,
	g_pCvarCostHealthT1,
	g_pCvarQuantityHealthT2,
	g_pCvarCostHealthT2,
	g_pCvarCostInvisinsibilite,
	g_pCvarTimeInvisinsibilite;


public plugin_init()
{
	register_plugin("Base Builder Orizont", VERSION, "GaBy");

	register_clcmd("say /shop", "ShowShop");
	register_clcmd("say_team /shop", "ShowShop");
	register_clcmd("say shop", "ShowShop");
	register_clcmd("say_team shop", "ShowShop");

	// Cvars Mixtes
	g_pCvarCostSuperCut = register_cvar("shopbb_supercut", "16000");
	g_pCvarCostLowGrav = register_cvar("shopbb_grav", "8000");
	g_pCvarQuantityLowGrav = register_cvar("shopbb_quant_grav", "0.150");
	g_pCvarCostSpeed = register_cvar("shopbb_speed", "8000");
	g_pCvarQuantitySpeed = register_cvar("shopbb_quantity_speed", "500.0");
	
	// Cvars CT
	g_pCvarQuantityHealthCT = register_cvar("shopbb_vie_ct", "150");
	g_pCvarCostHealthCT = register_cvar("shopbb_prix_vie_ct", "5000");
	g_pCvarCostHE = register_cvar("shopbb_he", "2500");
	g_pCvarCostFlash = register_cvar("shopbb_flash", "2500");
	g_pCvarCostSmoke = register_cvar("shopbb_smoke", "2500");
	g_pCvarCostSuperM249 = register_cvar("shopbb_super_m249", "8000");
	g_pCvarCostSuperAWP = register_cvar("shopbb_super_awp", "10000");
	g_pCvarCostSuperDeagle = register_cvar("shopbb_super_deagle", "16000");
	g_pCvarCostKitGuns = register_cvar("shopbb_kit_guns", "16000");
	
	// Cvars T
	g_pCvarQuantityHealthT1 = register_cvar("shopbb_health_t1", "2000");
	g_pCvarCostHealthT1 = register_cvar("shopbb_prix_health_t1", "8000");
	g_pCvarQuantityHealthT2 = register_cvar("shopbb_health_t2", "5000");
	g_pCvarCostHealthT2 = register_cvar("shopbb_prix_health_t2", "16000");
	g_pCvarCostInvisinsibilite = register_cvar("shopbb_invins", "10000");
	g_pCvarTimeInvisinsibilite = register_cvar("shopbb_time_invins", "10.0");

	RegisterHam(Ham_Spawn, "player", "Player_Spawn_Post", 1);
	RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage_Pre");
	RegisterHam(Ham_Item_Deploy, "weapon_knife", "ham_ItemDeploy_Post_KNI", 1);
	RegisterHam(Ham_Item_Deploy, "weapon_deagle", "ham_ItemDeploy_Post_DGL", 1);
	RegisterHam(Ham_Player_ResetMaxSpeed, "player", "Player_ResetMaxSpeed",  1);
	
	g_iMaxPlayers = get_maxplayers();
}
 
public client_putinserver( id )
{ 
	g_bHasSuperKnife[id] = false;
	g_bHasSuperSpeed[id] = false;
	g_bHasSuperM249[id] = false;
	g_bHasSuperAWP[id] = false;
	g_bHasSuperDeagle[id] = false;
	g_bHasGunsKit[id] = false;
}
 
public ShowShop(id)
{
	if ( is_user_alive(id) )
	{
		new Text[64];
		
		if(cs_get_user_team(id) == CS_TEAM_T)
		{
			new menu1 = menu_create("\y[\rZombie Shop (BaseBuilder Orizont)\y]", "ZombieShop");
			formatex(Text, charsmax(Text), "\ySpeed \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSpeed));
			menu_additem(menu1, Text, "0");
			formatex(Text, charsmax(Text), "\yGravity \y[\r%d $\y]", get_pcvar_num(g_pCvarCostLowGrav));
			menu_additem(menu1, Text, "1");
			formatex(Text, charsmax(Text), "\ySuper Cut \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperCut));
			menu_additem(menu1, Text, "2");
			formatex(Text, charsmax(Text), "\y+%d HP \y[\r%d $\y]", get_pcvar_num(g_pCvarQuantityHealthT1), get_pcvar_num(g_pCvarCostHealthT1));
			menu_additem(menu1, Text, "3");
			formatex(Text, charsmax(Text), "\y+%d HP \y[\r%d $\y]", get_pcvar_num(g_pCvarQuantityHealthT2), get_pcvar_num(g_pCvarCostHealthT2));
			menu_additem(menu1, Text, "4");
			formatex(Text, charsmax(Text), "\yInvincible \y[\r%d $\y]", get_pcvar_num(g_pCvarCostInvisinsibilite));
			menu_additem(menu1, Text, "5");

			menu_setprop(menu1, MPROP_EXITNAME, "Exit");

			menu_display(id, menu1);
		}

		else if(cs_get_user_team(id) == CS_TEAM_CT)
		{
			new menu2 = menu_create ("\y[\rHuman Shop (BaseBuilder Orizont)\y]", "BaseBuilderShop");	
			formatex(Text, charsmax(Text), "\ySuper Cut \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperCut));
			menu_additem(menu2, Text, "0");
			formatex(Text, charsmax(Text), "\ySpeed \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSpeed));
			menu_additem(menu2, Text, "1");
			formatex(Text, charsmax(Text), "\yGravity \y[\r%d $\y]", get_pcvar_num(g_pCvarCostLowGrav));
			menu_additem(menu2, Text, "2");
			formatex(Text, charsmax(Text), "\y+%d HP \y[\r%d $\y]", get_pcvar_num(g_pCvarQuantityHealthCT), get_pcvar_num(g_pCvarCostHealthCT));
			menu_additem(menu2, Text, "3");
			formatex(Text, charsmax(Text), "\yGrenade \y[\r%d $\y]", get_pcvar_num(g_pCvarCostHE));
			menu_additem(menu2, Text, "4");
			formatex(Text, charsmax(Text), "\yFlash \y[\r%d $\y]", get_pcvar_num(g_pCvarCostFlash));
			menu_additem(menu2, Text, "5");
			formatex(Text, charsmax(Text), "\ySmoke \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSmoke));
			menu_additem(menu2, Text, "6");
			formatex(Text, charsmax(Text), "\ySuper M249 \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperM249));
			menu_additem(menu2, Text, "7");
			formatex(Text, charsmax(Text), "\ySuper AWP \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperAWP));
			menu_additem(menu2, Text, "8");
			formatex(Text, charsmax(Text), "\ySuper Deagle \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperDeagle));
			menu_additem(menu2, Text, "9");
			formatex(Text, charsmax(Text), "\yKit Guns \y[\r%d $\y]", get_pcvar_num(g_pCvarCostKitGuns));
			menu_additem(menu2, Text, "10");

			menu_display(id, menu2);
		}
	}
}

public ZombieShop(id, menu1, item)
{
	if (item == MENU_EXIT || !is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_T) 
	{
		menu_destroy(menu1);
		return PLUGIN_HANDLED;
	}
	
	new iMoney = cs_get_user_money(id);

	switch(item)
	{
		case 0:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSpeed))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSpeed));
				g_bHasSuperSpeed[id] = true;
				set_user_maxspeed(id, get_pcvar_float(g_pCvarQuantitySpeed));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super Speed^1!", g_prefix);
			}
				
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 1:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostLowGrav))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostLowGrav));
				set_user_gravity(id, get_pcvar_float(g_pCvarQuantityLowGrav));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Low Gravity^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 2:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSuperCut))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperCut));
				g_bHasSuperKnife[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super Cut^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}
	   
		case 3:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostHealthT1))
			{			 
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostHealthT1));
				set_user_health(id, get_user_health(id) + get_pcvar_num(g_pCvarQuantityHealthT1));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3%d HP^1!", g_prefix, get_pcvar_num(g_pCvarQuantityHealthT1));
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}
	   
		case 4:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostHealthT2))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostHealthT2));
				set_user_health(id, get_user_health(id) + get_pcvar_num(g_pCvarQuantityHealthT2));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3%d HP^1!", g_prefix, get_pcvar_num(g_pCvarQuantityHealthT2));
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}
	  
		case 5:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostInvisinsibilite))
			{
				cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(g_pCvarCostInvisinsibilite));
				set_user_godmode(id, 1);
				set_task(0.0 + get_pcvar_float(g_pCvarTimeInvisinsibilite), "RemoveGodMode", id);
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat l'^3invincibilite^1 pentru^3 cateva secunde^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}	  
	}
	menu_destroy(menu1);
	return PLUGIN_HANDLED;
}

public RemoveGodMode(id)
{
	set_user_godmode(id, 0);
	client_print_color(id, DontChange, "^4%s ^1Nu mai esti invincibil!", g_prefix);
}

public BaseBuilderShop(id, menu2, item)
{
	if (item == MENU_EXIT || !is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_CT) 
	{
		menu_destroy(menu2);
		return PLUGIN_HANDLED;
	}
	
	new iMoney = cs_get_user_money(id);

	switch(item)
	{
		case 0:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSuperCut))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperCut));
				g_bHasSuperKnife[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super Cut^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 1:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSpeed))
			{			 
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSpeed));
				g_bHasSuperSpeed[id] = true;
				set_user_maxspeed(id, get_pcvar_float(g_pCvarQuantitySpeed));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super Speed^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}
	   
		case 2:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostLowGrav))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostLowGrav));
				set_user_gravity(id, get_pcvar_float(g_pCvarQuantityLowGrav));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Low Gravity^1!", g_prefix);
			}
				
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}
	   
		case 3:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostHealthCT))
			{			 
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostHealthCT));
				set_user_health(id, get_user_health(id) + get_pcvar_num(g_pCvarQuantityHealthCT));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3%d HP^1!", g_prefix, get_pcvar_num(g_pCvarQuantityHealthCT));
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 4:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostHE))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostHE));
				give_item(id, "weapon_hegrenade");
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat un ^3HE^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 5:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostFlash))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostFlash));
				give_item(id, "weapon_flashbang");
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat un ^3Flash^1!", g_prefix);
			}
					
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 6:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSmoke))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSmoke));
				give_item(id, "weapon_smokegrenade");
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat un ^3Smoke^1!", g_prefix);
			}
				
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 7:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSuperM249))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperM249));
				give_item(id, "weapon_m249");
				cs_set_user_bpammo(id, CSW_M249, 200);
				g_bHasSuperM249[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super M249^1!", g_prefix);
			}
				
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 8:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSuperAWP))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperAWP));
				give_item(id, "weapon_awp");
				cs_set_user_bpammo(id, CSW_AWP, 30);
				g_bHasSuperAWP[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super AWP^1!", g_prefix);
			}
			
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}	
		
		case 9:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSuperDeagle))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperDeagle));
				give_item(id, "weapon_deagle");
				cs_set_user_bpammo(id, CSW_DEAGLE, 35);
				g_bHasSuperDeagle[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super Deagle^1!", g_prefix);
			}
			
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}	

		case 10:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostKitGuns))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostKitGuns));
				give_item(id, "weapon_deagle");
				give_item(id, "weapon_m4a1");
				give_item(id, "weapon_hegrenade");
				cs_set_user_bpammo(id, CSW_DEAGLE, 35);
				cs_set_user_bpammo(id, CSW_M4A1, 90);
				g_bHasGunsKit[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Kit Guns^1!", g_prefix);
			}
			
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}		
	}
	menu_destroy(menu2);
	return PLUGIN_HANDLED;
}
 
public Player_Spawn_Post( id )
{
	if(is_user_alive(id))
	{
		client_print(id, print_chat, "Tasteaza /shop pentru a-ti iteme!");
		g_bHasSuperKnife[id] = false;
		g_bHasSuperSpeed[id] = false;
		g_bHasSuperM249[id] = false;
		g_bHasSuperAWP[id] = false;
		g_bHasSuperDeagle[id] = false;
		g_bHasGunsKit[id] = false;
	}
}
 
public client_disconnect(id)
{
	g_bHasSuperKnife[id] = false;
	g_bHasSuperSpeed[id] = false;
	g_bHasSuperM249[id] = false;
	g_bHasSuperAWP[id] = false;
	g_bHasSuperDeagle[id] = false;
	g_bHasGunsKit[id] = false;
}
 
 
public plugin_precache()
{
	precache_model(g_ModelSuperKnife);
	precache_model(g_ModelSuperDeagle);
}
 
public ham_TakeDamage_Pre(victim, inflictor, attacker, Float:damage, damage_bits)
{
	if( !IsPlayer( attacker ) || !is_user_alive( attacker ) || inflictor != attacker )
	{
		return;
	}

	if ( g_bHasSuperKnife[attacker] && get_user_weapon(attacker) == CSW_KNIFE )
	{
		SetHamParamFloat( 4, damage * 231 );
	}
	
	if ( g_bHasSuperM249[attacker] && get_user_weapon(attacker) == CSW_M249 )
	{
		SetHamParamFloat( 4, damage * 2 );
	}
	
	if ( g_bHasSuperAWP[attacker] && get_user_weapon(attacker) == CSW_AWP )
	{
		SetHamParamFloat( 4, damage * 2 );
	}
	
	if ( g_bHasSuperDeagle[attacker] && get_user_weapon(attacker) == CSW_DEAGLE )
	{
		SetHamParamFloat( 4, damage * 4 );
	}
	
	if ( g_bHasGunsKit[attacker] && ( get_user_weapon(attacker) == CSW_M4A1 || CSW_DEAGLE ) )
	{
		SetHamParamFloat( 4, damage * 2 );
	}  
}
 
 
public ham_ItemDeploy_Post_KNI(weapon_ent)
{
	static owner;
	owner = get_pdata_cbase(weapon_ent, 41, 4);

	if(is_user_alive(owner) && g_bHasSuperKnife[owner])
	{
		set_pev(owner, pev_viewmodel2, g_ModelSuperKnife);
	}
}

public ham_ItemDeploy_Post_DGL(weapon_ent)
{
	static owner;
	owner = get_pdata_cbase(weapon_ent, 41, 4);

	if(is_user_alive(owner) && ( g_bHasSuperDeagle[owner] || g_bHasGunsKit[owner] ) )
	{
		set_pev(owner, pev_viewmodel2, g_ModelSuperDeagle);
	}
}

public Player_ResetMaxSpeed(id)
{
	if( is_user_alive(id) && get_user_maxspeed(id) !=  -1.0 && g_bHasSuperSpeed[id])
	{
		set_user_maxspeed(id, get_pcvar_float(g_pCvarQuantitySpeed));
	}
}

stock const g_szTeamName[Colors][] = 
{
	"UNASSIGNED",
	"TERRORIST",
	"CT",
	"SPECTATOR"
};

stock client_print_color(id, iColor=DontChange, const szMsg[], any:...)
{
	if( id && !is_user_connected(id) )
	{
		return 0;
	}

	if( iColor > Grey )
	{
		iColor = DontChange;
	}

	new szMessage[192];
	if( iColor == DontChange )
	{
		szMessage[0] = 0x04;
	}
	else
	{
		szMessage[0] = 0x03;
	}

	new iParams = numargs();

	if(id)
	{
		if( iParams == 3 )
		{
			copy(szMessage[1], charsmax(szMessage)-1, szMsg);
		}
		else
		{
			vformat(szMessage[1], charsmax(szMessage)-1, szMsg, 4);
		}

		if( iColor )
		{
			new szTeam[11];
			get_user_team(id, szTeam, charsmax(szTeam));

			Send_TeamInfo(id, id, g_szTeamName[iColor]);
			Send_SayText(id, id, szMessage);
			Send_TeamInfo(id, id, szTeam);
		}
		else
		{
			Send_SayText(id, id, szMessage);
		}
	} 
	return 1;
}

stock Send_TeamInfo(iReceiver, iPlayerId, szTeam[])
{
	static iTeamInfo = 0;
	if( !iTeamInfo )
	{
		iTeamInfo = get_user_msgid("TeamInfo");
	}
	message_begin(iReceiver ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, iTeamInfo, .player=iReceiver);
	write_byte(iPlayerId);
	write_string(szTeam);
	message_end();
}

stock Send_SayText(iReceiver, iPlayerId, szMessage[])
{
	static iSayText = 0;
	if( !iSayText )
	{
		iSayText = get_user_msgid("SayText");
	}
	message_begin(iReceiver ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, iSayText, .player=iReceiver);
	write_byte(iPlayerId);
	write_string(szMessage);
	message_end();
}
mIRr0r# =D
Membru, skill 0
Membru, skill 0
Posts: 45
Joined: 27 Apr 2013, 21:55
Detinator Steam: Nu
CS Status: BB.DEVILCS.RO
Has thanked: 10 times
Been thanked: 1 time
Contact:

13 Jul 2013, 20:34

ms frumos flyingsnow multumesc :)
Image
Server: (25:47) Bb.Proskill.Ro # BaseBuilder 6.5 , Cautam Admini
Ip: 95.64.36.30:27015
Name: PSR @ mIRr-0r.dll
Functie: Detinator + FTP
Rank/Top15: 1
User avatar
FlyingSnow
Membru, skill +2
Membru, skill +2
Posts: 825
Joined: 01 Oct 2012, 02:22
Detinator Steam: Da
Detinator server CS: Dap.
SteamID: Nu-i public.
Has thanked: 26 times
Been thanked: 52 times
Contact:

13 Jul 2013, 21:28

La al 2-lea ce ai nevoie sa fie colorat?:-?
Pluginu de baza | Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <fun>
#include <csx>

// Plugin Version
new VERSION[]="6.4"
new formatmodname[] = "^x01 [^x04 Base Builder Orizont^x01 ]"

//Models
new const g_ZombieModel1[] = "orizont_zombie"

//Sounds
new g_RoundStart[] = "basebuilder/round_start.wav"
new g_ZombKill1[] = "basebuilder/zombie_kill1.wav"

new g_WinZomb[] = "basebuilder/zombies_win.wav"
new g_WinHum[] = "basebuilder/humans_win.wav"

#define AFTER_BUILD ADMIN_LEVEL_A
#define DEAD_BUILD ADMIN_LEVEL_B
#define REMOVE_BLOCK ADMIN_LEVEL_C
#define DEAD_REMOVE ADMIN_LEVEL_D
#define LOCK_BLOCKS ADMIN_LEVEL_E
#define PAIN_SHOCK_FREE ADMIN_KICK
#define BAD_SPAWN ADMIN_KICK
#define BUILD_BAN ADMIN_KICK
#define REVIVE ADMIN_BAN
#define SWAP ADMIN_KICK
#define START_ROUND ADMIN_BAN
#define RESET ADMIN_BAN
#define MEMBERSHIP ADMIN_LEVEL_E
#define ADMIN_GUNS ADMIN_KICK
#define ADMIN_RESET ADMIN_BAN

#define BUILD_TASK 10000
#define MODELSET_TASK 20000

#define MAX_PLAYERS 32
#define AMMO_SLOT 376
#define MODELCHANGE_DELAY 0.5
#define MAXENTS 1365
#define AUTO_TEAM_JOIN_DELAY 0.1
#define TEAM_SELECT_VGUI_MENU_ID 2

#if cellbits == 32
    #define OFFSET_BUYZONE 235
#else
    #define OFFSET_BUYZONE 268
#endif

#define LockBlock(%1)     ( entity_set_int( %1, EV_INT_iuser1, 1 ) )
#define UnlockBlock(%1)   ( entity_set_int( %1, EV_INT_iuser1, 0 ) )
#define IsBlockLocked(%1) ( entity_get_int( %1, EV_INT_iuser1 ) == 1 )

// CS Weapon CBase Offsets (win32)
const OFFSET_WEAPONOWNER = 41
// Linux diff's
const OFFSET_LINUX_WEAPONS = 4

new gmsgStatusText, gmsgSayText
new gHudSyncInfo, g_MaxPlayers, g_ModName[32]
const fPainShock = 108

new bool:g_CanBuild, bool:g_ZombiesReleased
new g_RoundNum, count_down, g_iEntBarrier
new bool:g_BuildBan[MAX_PLAYERS+1]
new g_pEnt[MAX_PLAYERS+1], Float:g_pDist[MAX_PLAYERS+1], bool:g_MovingEnt[MAXENTS], g_EntMover[MAXENTS],
	g_LastMover[MAXENTS], g_EntOwner[MAXENTS], bool:g_InvisEnt[MAXENTS], g_OwnedEnts[MAX_PLAYERS+1]
new CsTeams:g_pTeam[MAX_PLAYERS+1], CsTeams:g_pCurTeam[MAX_PLAYERS+1]
new g_CurrentWeapon[MAX_PLAYERS+1], g_PrimaryWeapon[MAX_PLAYERS+1], Float:MaxHP[MAX_PLAYERS+1]

//Cached Stuff for Players
new g_isconnected[MAX_PLAYERS+1], g_isalive[MAX_PLAYERS+1], g_isbot[MAX_PLAYERS+1],
	g_iszombie[MAX_PLAYERS+1], g_friend[MAX_PLAYERS+1]

//Custom Model Stuff
new Float:g_ModelsTargetTime, Float:g_RoundStartTime
new g_HasCustomModel[MAX_PLAYERS+1], g_PlayerModel[MAX_PLAYERS+1][32]

// Allowed weapons for zombies
const ZOMBIE_ALLOWED_WEAPONS_BITSUM = (1<<CSW_KNIFE)

//CVARS
new g_pcvar_buildtime, g_pcvar_zombiehp, g_pcvar_maxrounds, g_pcvar_basecalc, g_pcvar_resetent,
	g_pcvar_showmovers, g_pcvar_knockback, g_pcvar_allowedweps, g_pcvar_givenades,
	g_pcvar_entmindist, g_pcvar_entsetdist, g_pcvar_entmaxdist, g_pcvar_maxclaimable,
	g_pcvar_claimable, g_pcvar_zresptime

new g_fwRoundStart, g_fwGrabEnt, g_fwDropEnt, g_fwNewGameStart, g_fwGameStart, g_fwSwapTeams
new g_fwiFakeReturn
	
//CSDM-Style Weapons Menu
new bool:firsttime[MAX_PLAYERS+1]
new weapon_picked[2][MAX_PLAYERS+1],cur_offset[MAX_PLAYERS+1],options_on_menu[8][MAX_PLAYERS+1]

//Weapon Names (For Guns Menu)
static const WEAPONNAMES[24][23] = { "Schmidt Scout", "XM1014 M4", "Ingram MAC-10", "Steyr AUG A1", "UMP 45", "SG-550 Auto-Sniper",
			"IMI Galil", "Famas", "AWP Magnum Sniper", "MP5 Navy", "M249 Para Machinegun", "M3 Super 90", "M4A1 Carbine",
			"Schmidt TMP", "G3SG1 Auto-Sniper", "SG-552 Commando", "AK-47 Kalashnikov", "ES P90", "P228 Compact",
			"Dual Elite Berettas", "Fiveseven", "USP .45 ACP Tactical", "Glock 18C", "Desert Eagle .50 AE"
}

// Weapon entity names
new const WEAPONENTNAMES[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
			"weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
			"weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
			"weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
			"weapon_ak47", "weapon_knife", "weapon_p90" }

public plugin_init()
{
	register_plugin("Base Builder Zombie Mod", VERSION, "Tirant")
	register_cvar("base_builder", VERSION, FCVAR_SPONLY|FCVAR_SERVER)
	set_cvar_string("base_builder", VERSION)
	
	//Basic mod functions/timers
	g_pcvar_buildtime = register_cvar("bb_build_time", "150.0")
	g_pcvar_zombiehp = register_cvar("bb_zombie_health", "3000.0")
	g_pcvar_basecalc = register_cvar("bb_calc_maxbase", "0")
	g_pcvar_showmovers = register_cvar("bb_show_moving", "1")
	g_pcvar_knockback = register_cvar("bb_pain_shock_free", "0")
	g_pcvar_entmaxdist = register_cvar("bb_max_move_dist", "960")
	g_pcvar_entmindist = register_cvar("bb_min_move_dist", "25")
	g_pcvar_entsetdist = register_cvar("bb_min_dist_set", "50")
	g_pcvar_resetent = register_cvar("bb_reset_blocks", "1")
	g_pcvar_maxclaimable = register_cvar("bb_claim_max", "999")
	g_pcvar_claimable = register_cvar("bb_claim_mode", "1")
	g_pcvar_zresptime = register_cvar("bb_zombie_respawn_time", "2.0")
	
	//Guns Menu
	g_pcvar_givenades = register_cvar("bb_give_nades","hs") 	//h f s, put multiple letters for multiple nades
	g_pcvar_allowedweps = register_cvar("bb_weapons","abcdeghijlmnqrstuvwx")
	
	register_dictionary("basebuilder.txt");
	
	//Client Commands
	register_clcmd("+grab","cmdMoveEnt") 							//command to move stuff around
	register_clcmd("-grab","cmdStopEnt") 							//command to move stuff around
	
	register_clcmd("say", "cmdSay",0, "<target> ")
	register_clcmd("say_team", "cmdSay",0, "<target> ")

	//Admin Commands
	register_concmd("removeaim","cmdRemoveEnt",0," - Deletes an object") 			//Removes an object (C alive, D dead)
	register_concmd("lockaim","cmdLockBlock",0," - Locks/Unlocks an object form moving")
	register_concmd("unclaimaim","cmdRemoveClaim",0," - Removes a claim on an object")	//Makes block claimable by everyone
	register_concmd("resetaim","cmdResetAim",0," - Resets an object")
	
	register_concmd("bb_buildban","cmdBuildBan",0,"<player>") 				//Bans targeted player from building
	register_concmd("bb_unbuildban","cmdBuildUnban",0,"<player>") 				//Unbans   "	   "     "     "
	register_concmd("bb_revive","cmdRevive",0,"<player>")
	register_concmd("bb_guns","cmdGiveGuns",0,"<player>")					//revives targetted player
	register_concmd("bb_swap","cmdSwap",0,"<player>")					//swaps the selected player to the opposite team
	register_concmd("bb_startround","cmdStartRound",0," - Ends the build phase")		//do i really have to explain this?
	register_concmd("bb_reset","cmdResetEnts",0," - Resets all entities")
	register_concmd("bb_clear","cmdClearEnts",0," - Deleted all unused entities")
	
	//Blocked Commands
	register_clcmd("drop", "clcmd_drop")
	register_clcmd("buy", "clcmd_buy")
	
	register_forward(FM_GetGameDescription, "fw_GetGameDescription")
	register_forward(FM_SetClientKeyValue, "fw_SetClientKeyValue")
	register_forward(FM_ClientUserInfoChanged, "fw_ClientUserInfoChanged")
	register_forward(FM_PlayerPreThink, "fw_Player_PreThink")
	if (get_pcvar_num(g_pcvar_showmovers) == 1)
		register_forward(FM_TraceLine, "fw_Traceline")
	
	RegisterHam(Ham_Touch, "weapon_shield", "ham_WeaponCleaner_Post", 1)
	RegisterHam(Ham_Touch, "weaponbox", "ham_WeaponCleaner_Post", 1)
	RegisterHam(Ham_Spawn, "player", "ham_PlayerSpawn_Post", 1)
	RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage")
	RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage_Post", 1)
	for (new i = 1; i < sizeof WEAPONENTNAMES; i++)
		if (WEAPONENTNAMES[0]) RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES, "ham_ItemDeploy_Post", 1)
	
	register_message(get_user_msgid("TextMsg"), "msgRoundEnd")
	register_message(get_user_msgid("StatusIcon"), "msgStatusIcon")
	register_message(get_user_msgid("StatusValue"), "msgStatusValue");
	register_message(get_user_msgid("Health"), "msgHealth");
	register_message(get_user_msgid("ScoreAttrib"), "msgScoreAttrib")
	
	register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
	register_event("AmmoX", "ev_AmmoX", "be", "1=1", "1=2", "1=3", "1=4", "1=5", "1=6", "1=7", "1=8", "1=9", "1=10")
	register_event("StatusValue", "ev_SetTeam", "be", "1=1");
	register_event("StatusValue", "ev_ShowStatus", "be", "1=2", "2!0");
	register_event("StatusValue", "ev_HideStatus", "be", "1=1", "2=0");
	register_event("Health", "ev_Health", "be", "1>0");
	
	register_logevent("logevent_round_start",2, "1=Round_Start")
	register_logevent("logevent_round_end", 2, "1=Round_End")
	
	register_menucmd(register_menuid("WeaponMethodMenu"),(1<<0)|(1<<1)|(1<<2),"weapon_method_pushed")
	register_menucmd(register_menuid("PrimaryWeaponSelect"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"prim_weapons_pushed")
	register_menucmd(register_menuid("SecWeaponSelect"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7),"sec_weapons_pushed")
	
	set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET)
	
	//Formats the Mod Name
	formatex(g_ModName, charsmax(g_ModName), "Base Builder %s", VERSION)
	
	gmsgSayText = get_user_msgid("SayText")
	gmsgStatusText = get_user_msgid("StatusText");
	gHudSyncInfo = CreateHudSyncObj();
	g_MaxPlayers = get_maxplayers();

	g_fwNewGameStart = CreateMultiForward("bb_new_round",ET_IGNORE)
	g_fwGameStart = CreateMultiForward("bb_timer_started",ET_IGNORE)
	g_fwRoundStart = CreateMultiForward("bb_zombies_released",ET_IGNORE)
	g_fwSwapTeams = CreateMultiForward("bb_teams_swapped",ET_IGNORE)
	g_fwGrabEnt = CreateMultiForward("bb_ent_grabbed",ET_IGNORE, FP_CELL, FP_CELL)
	g_fwDropEnt = CreateMultiForward("bb_ent_dropped",ET_IGNORE, FP_CELL, FP_CELL)
	
	server_cmd("sv_skyname dust")
	server_cmd("mp_freezetime 0")
	server_cmd("mp_flashlight 0")

	register_clcmd("chooseteam", "clcmd_changeteam")
	register_clcmd("jointeam", "clcmd_changeteam")
	register_message(get_user_msgid("ShowMenu"), "message_show_menu")
	register_message(get_user_msgid("VGUIMenu"), "message_vgui_menu")
	server_cmd("mp_limitteams 1")
	server_cmd("mp_autoteambalance 1")

	g_iEntBarrier = find_ent_by_tname( -1, "barrier" );
}

public plugin_precache()
{
	engfunc(EngFunc_PrecacheSound, g_RoundStart)
	engfunc(EngFunc_PrecacheSound, g_ZombKill1)
	engfunc(EngFunc_PrecacheSound, g_WinZomb)
	engfunc(EngFunc_PrecacheSound, g_WinHum)
	
	new szModel[64];
	formatex(szModel, charsmax(szModel), "models/player/%s/%s.mdl", g_ZombieModel1, g_ZombieModel1 );
	engfunc(EngFunc_PrecacheModel, szModel)
	
	new iBomb = create_entity("info_bomb_target");
	entity_set_origin(iBomb, Float:{8192.0,8192.0,8192.0})
	
	new iBuyZone = create_entity("info_map_parameters");
	DispatchKeyValue(iBuyZone, "buying", "3");
	DispatchSpawn(iBuyZone);
	
	g_pcvar_maxrounds = get_cvar_num("mp_maxrounds")
}

// Event Round Start (This is before freeze time)
public event_round_start()
{
	arrayset(g_MovingEnt, false, MAXENTS)
	arrayset(g_EntOwner, 0, MAXENTS)
	arrayset(g_LastMover, 0, MAXENTS)
	arrayset(g_OwnedEnts, 0, MAX_PLAYERS+1)
	
	g_RoundStartTime = get_gametime()
	g_ZombiesReleased = false
	
	if (get_pcvar_num(g_pcvar_resetent) == 1)
	{
		new cname[10], tname[7];
		for (new iEnt = g_MaxPlayers+1; iEnt < MAXENTS; iEnt++)
		{
			if (is_valid_ent(iEnt))
			{
				entity_get_string(iEnt, EV_SZ_classname, cname, 9);
				entity_get_string(iEnt, EV_SZ_targetname, tname, 6);
				if (!IsBlockLocked(iEnt) && iEnt != g_iEntBarrier && equal(cname, "func_wall") && !equal(tname, "ignore"))
				{
					if (g_InvisEnt[iEnt])
					{
						set_pev(iEnt,pev_solid,SOLID_BSP)
						set_pev(iEnt,pev_renderamt,Float:{255.0})
						set_pev(iEnt,pev_rendermode,0)
						g_InvisEnt[iEnt] = false
					}
					engfunc( EngFunc_SetOrigin, iEnt, Float:{ 0.0, 0.0, 0.0 } );
				}
			}
		}
	}
	ExecuteForward(g_fwNewGameStart, g_fwiFakeReturn)
}

// Log Event Round Start (This is AFTER freeze time)
public logevent_round_start()
{
	g_CanBuild = true
	
	set_pev(g_iEntBarrier,pev_solid,SOLID_BSP)
	set_pev(g_iEntBarrier,pev_rendermode,1)
	set_pev(g_iEntBarrier,pev_renderamt,Float:{150.0})
	
	set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 10.0, 0.1, 0.2, 1)
	new nLen, szMsg[128]
	nLen += format( szMsg[nLen], 127-nLen, "%L", LANG_SERVER, "WELCOME_MSG", VERSION);
	nLen += format( szMsg[nLen], 127-nLen, "%L", LANG_SERVER, "BIND_KEY");
	show_hudmessage(0, szMsg);
	
	print_color(0, "%s %s ^x04- ^x01%L", formatmodname, VERSION, LANG_SERVER, "ROUND_MSG")
	print_color(0, "%s Round: %d of %d", formatmodname, (g_RoundNum+1), g_pcvar_maxrounds)
	
	remove_task(BUILD_TASK)
	
	set_task(1.0, "CountDown", BUILD_TASK,_, _, "a", get_pcvar_num(g_pcvar_buildtime));
	count_down = (get_pcvar_num(g_pcvar_buildtime)-1);
	
	if (get_pcvar_num(g_pcvar_basecalc) == 1)
		set_task(5.0, "Base_Calc")
	
	ExecuteForward(g_fwGameStart, g_fwiFakeReturn)
}

public CountDown()
{
	count_down--
	new mins = count_down/60
	new secs = count_down%60
	if (count_down>=0)
	{
		client_print(0, print_center, "Timp de constructie - %d:%s%d", mins, (secs < 10 ? "0" : ""), secs)
	}
	
	if (mins != 0 && secs == 0)
	{
		new mmin[32]
		num_to_word(mins, mmin, 31)
		
		client_cmd(0, "spk ^"fvox/%s minutes remaining^"", mmin)
	}
	else if (mins == 0 && secs == 30)
	{
		new msec[32]
		num_to_word(secs, msec, 31)

		client_cmd(0, "spk ^"fvox/%s seconds remaining^"",  msec)
	}
	if (0<count_down<=10)
	{
		new msec[32]
		num_to_word(count_down, msec, 31)
		
		client_cmd(0, "spk ^"fvox/%s^"", msec)
	}
		
	if (count_down == 0)
	{
		Release_Zombies()
		remove_task(BUILD_TASK);
	}
}

public logevent_round_end()
{
	if (!g_CanBuild)
	{
		new players[32], num, player
		get_players(players, num)
		for (new i = 0; i < num; i++)
		{
			player = players
			
			if (g_pCurTeam[player] == g_pTeam[player])
				cs_set_user_team(player, (g_pTeam[player] = (g_pTeam[player] == CS_TEAM_T ? CS_TEAM_CT : CS_TEAM_T))) 
			else
				g_pTeam[player] = g_pTeam[player] == CS_TEAM_T ? CS_TEAM_CT : CS_TEAM_T
		}
		print_color(0, "^x04%L", LANG_SERVER, "TEAMS_SWAPPED")
		ExecuteForward(g_fwSwapTeams, g_fwiFakeReturn)
	}
	
	remove_task(BUILD_TASK)
		
	return PLUGIN_HANDLED
}

public client_death(g_attacker, g_victim, wpnindex, hitplace, TK)
{
	if (g_pEnt[g_victim])
		cmdStopEnt(g_victim)
		
	set_hudmessage(_, _, _, _, _, _, _, _, _, _, 4);
	show_hudmessage(g_victim, "");
	
	g_isalive[g_victim] = false
	
	if (TK == 0 && g_attacker != g_victim)
	{
		if (g_iszombie[g_attacker])
		{
			client_cmd(0, "spk %s", g_ZombKill1)
			new playername[35]
			get_user_name(g_victim, playername, 34)
			set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 5.0, 0.1, 0.2, 1)
			show_hudmessage(0, "%L",LANG_SERVER, "DEAD_ANNOUNCE", playername);
		}
	}
	
	if (g_iszombie[g_victim])
	{
		set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 10.0, 0.1, 0.2, 1)
		show_hudmessage(g_victim, "%L", LANG_SERVER, "DEAD_ZOMBIE", get_pcvar_num(g_pcvar_zresptime));
		set_task(get_pcvar_float(g_pcvar_zresptime), "Respawn_Zombie", g_victim)
	}
	if (!g_iszombie[g_victim])
	{
		set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 10.0, 0.1, 0.2, 1)
		show_hudmessage(g_victim, "%L", LANG_SERVER, "DEAD_SURVIVOR");
		cs_set_user_team(g_victim, cs_get_user_team(g_victim) == CS_TEAM_T ? CS_TEAM_CT:CS_TEAM_T)
		g_iszombie[g_victim] = true
		set_task(5.0, "Respawn_Zombie", g_victim)
	}
}

public ham_TakeDamage_Post(victim, inflictor, attacker, Float:damage, bits)
{
	if(get_pcvar_num(g_pcvar_knockback) == 1 && access(victim, PAIN_SHOCK_FREE) && g_iszombie[victim])
	{
		set_pdata_float(victim, fPainShock, 1.0, 5)
	}
}

public ham_TakeDamage(victim, inflictor, attacker, Float:damage, damagebits)
{
	if (!g_isalive[victim] || !g_isconnected[attacker]) return HAM_IGNORED
	
	if(g_CanBuild || victim == attacker)
		return HAM_SUPERCEDE
		
	return HAM_HANDLED
}

public client_disconnect(id)
{
	cmdStopEnt(id)

	g_isconnected[id] = false
	g_isalive[id] = false
	g_isbot[id] = false
	g_iszombie[id] = false
	
	return PLUGIN_CONTINUE
}

//Respawns late joiners, cts only if build time is still on
public client_putinserver(id)
{
	set_task(7.0,"Respawn_Human",id);
	g_isconnected[id] = true
	firsttime[id] = true

	// Set bot flag
	if (is_user_bot(id))
		g_isbot[id] = true
}

public Release_Zombies()
{
	g_CanBuild = false
	g_ZombiesReleased = true
	remove_task(BUILD_TASK);
	
	new weapon[32]
	new he, flash, smoke
	get_pcvar_string(g_pcvar_givenades,weapon,31)
	for(new i=0;i<strlen(weapon);i++)
	{
		switch(weapon)
		{
			case 'h': he++
			case 'f': flash++
			case 's': smoke++
		}
	}
	
	new players[32], num
	get_players(players, num)

	new player
	for(new i = 0; i < num; i++)
	{
		player = players
		if (g_isalive[player])
		{
			if (!g_iszombie[player])
			{
				cmdStopEnt(player)

				if(he) give_item(player,"weapon_hegrenade"), cs_set_user_bpammo(player,CSW_HEGRENADE,he)
				if(flash) give_item(player,"weapon_flashbang"), cs_set_user_bpammo(player,CSW_FLASHBANG,flash)
				if(smoke) give_item(player,"weapon_smokegrenade"), cs_set_user_bpammo(player,CSW_SMOKEGRENADE,smoke)

				if (g_PrimaryWeapon[player])
				{
					get_weaponname(g_PrimaryWeapon[player],weapon,31)
					engclient_cmd(player, weapon);
				}
			}
		}
	}
			
	set_pev(g_iEntBarrier,pev_solid,SOLID_NOT)
	set_pev(g_iEntBarrier,pev_renderamt,Float:{0.0})
	
	g_RoundNum++
	set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 10.0, 0.1, 0.2, 1)
	show_hudmessage(0, "%L", LANG_SERVER, "RELEASE_MSG");
	client_cmd(0, "spk %s", g_RoundStart)
	
	ExecuteForward(g_fwRoundStart,g_fwiFakeReturn)
}

//Called on zombie death function
public Respawn_Zombie(id)
{
	if (g_isconnected[id] && cs_get_user_team(id) == CS_TEAM_T)
	{
		if (get_user_health(id) ==MaxHP[id] || !is_user_alive(id))
			ExecuteHamB(Ham_CS_RoundRespawn, id)
		else
			client_print(id, print_center, "%L", LANG_SERVER, "FAIL_RESPAWN");
	}
}

//Called on al pllayers for late joiners, parent is above
public Respawn_Human(id)
{
	if (!g_isconnected[id] || g_isalive[id] || cs_get_user_team(id) == CS_TEAM_SPECTATOR || cs_get_user_team(id) == CS_TEAM_UNASSIGNED)
		return PLUGIN_HANDLED
		
	if (!g_isalive[id] && g_iszombie[id])
		ExecuteHamB(Ham_CS_RoundRespawn, id)
				
	if (!g_isalive[id] && g_iszombie[id])
		set_task(3.0,"Respawn_Human",id)
			
	if (g_CanBuild)
	{
		if (!g_isalive[id])
			ExecuteHamB(Ham_CS_RoundRespawn, id)
				
		if (!g_isalive[id])
			set_task(3.0,"Respawn_Human",id)
	}
	return PLUGIN_HANDLED
}

//Sets player health and weapons
public Add_Effects(id)
{
	if (!g_isconnected[id] || !g_isalive[id])
		return PLUGIN_HANDLED
	
	strip_user_weapons(id)
	give_item(id, "weapon_knife")
	
	if (g_iszombie[id])
	{
		MaxHP[id] = get_pcvar_float(g_pcvar_zombiehp)
		set_pev(id, pev_health, MaxHP[id]) // use decimal number
	}
	else
	{
		weapon_method_menu(id)
		MaxHP[id] = 100.0
	}
	ev_Health(id)
	return PLUGIN_HANDLED
}

//AmmoX Ensures BackPack ammo is always full
public ev_AmmoX(id)
{
	set_pdata_int(id, AMMO_SLOT + read_data(1), 200, 5)
} 

//Sets the "Game" description ie. Counter-Strike, in our case Base Builder
public fw_GetGameDescription()
{
	// Return the mod name so it can be easily identified
	forward_return(FMV_STRING, g_ModName)
	
	return FMRES_SUPERCEDE;
}

/*-------------------------------------------------------------------------------------------------|
|----------------------------------Begin Player Model Code---[0005]--------------------------------|
|-------------------------------------------------------------------------------------------------*/

public ham_PlayerSpawn_Post(id)
{
	if (!is_user_alive(id))
		return
	
	g_isalive[id] = true
	g_pCurTeam[id] = cs_get_user_team(id)
	g_iszombie[id] = g_pCurTeam[id] == CS_TEAM_T ? true : false
	
	Add_Effects(id)
	remove_task(id + MODELSET_TASK)
	if (g_iszombie[id])
	{
		copy(g_PlayerModel[id], charsmax(g_PlayerModel[]), g_ZombieModel1)
		new currentmodel[32]
		fm_get_user_model(id, currentmodel, charsmax(currentmodel))
		if (!equal(currentmodel, g_PlayerModel[id]))
		{
			if (get_gametime() - g_RoundStartTime < 5.0)
				set_task(5.0 * MODELCHANGE_DELAY, "fm_user_model_update", id + MODELSET_TASK)
			else
				fm_user_model_update(id + MODELSET_TASK)
		}
	}
	else if (g_HasCustomModel[id])
	{
		fm_reset_user_model(id)
	}
}

public fw_SetClientKeyValue(id, const infobuffer[], const key[])
{   
	if (g_HasCustomModel[id] && equal(key, "model"))
		return FMRES_SUPERCEDE
	return FMRES_IGNORED
}

public fw_ClientUserInfoChanged(id)
{
	if (!g_HasCustomModel[id])
		return FMRES_IGNORED
	static currentmodel[32]
	fm_get_user_model(id, currentmodel, charsmax(currentmodel))
	if (!equal(currentmodel, g_PlayerModel[id]) && !task_exists(id + MODELSET_TASK))
		fm_set_user_model(id + MODELSET_TASK)
	return FMRES_IGNORED
}

public fm_user_model_update(taskid)
{
	static Float:current_time
	current_time = get_gametime()
	
	if (current_time - g_ModelsTargetTime >= MODELCHANGE_DELAY)
	{
		fm_set_user_model(taskid)
		g_ModelsTargetTime = current_time
	}
	else
	{
		set_task((g_ModelsTargetTime + MODELCHANGE_DELAY) - current_time, "fm_set_user_model", taskid)
		g_ModelsTargetTime = g_ModelsTargetTime + MODELCHANGE_DELAY
	}
}

public fm_set_user_model(player)
{
	player -= MODELSET_TASK
	engfunc(EngFunc_SetClientKeyValue, player, engfunc(EngFunc_GetInfoKeyBuffer, player), "model", g_PlayerModel[player])
	g_HasCustomModel[player] = true
}

stock fm_get_user_model(player, model[], len)
{
	engfunc(EngFunc_InfoKeyValue, engfunc(EngFunc_GetInfoKeyBuffer, player), "model", model, len)
}

stock fm_reset_user_model(player)
{
	g_HasCustomModel[player] = false
	dllfunc(DLLFunc_ClientUserInfoChanged, player, engfunc(EngFunc_GetInfoKeyBuffer, player))
}

/*-------------------------------------------------------------------------------------------------|
|------------------------------------End Player Model Code-----------------------------------------|
|-------------------------------------------------------------------------------------------------*/

/*-------------------------------------------------------------------------------------------------|
|----------------------------------Begin Entity Mover Code---[0004]--------------------------------|
|-------------------------------------------------------------------------------------------------*/
public cmdMoveEnt(id)
{
	if (g_BuildBan[id] == true)
		return PLUGIN_HANDLED
	
	if (g_iszombie[id] && !access(id, AFTER_BUILD))
      		return PLUGIN_HANDLED 
			
	if (!g_CanBuild && !access(id, AFTER_BUILD))
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_TIME_UP")
		return PLUGIN_HANDLED 
	}
	
	if (!g_isalive[id] && !access(id, DEAD_BUILD))
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_DEAD")
		return PLUGIN_HANDLED 
	}

	if (g_pEnt[id] && is_valid_ent(g_pEnt[id])) 
		cmdStopEnt(id)
	
	new ent, bodypart
	get_user_aiming (id,ent,bodypart)
	
	if (!is_valid_ent(ent) || ent == g_iEntBarrier)
	{
		return PLUGIN_HANDLED
	}
	
	if (ent <= g_MaxPlayers && g_isalive[ent])
	{	
		return PLUGIN_HANDLED
	}
		
	if (IsBlockLocked(ent) || g_MovingEnt[ent])
	{
		return PLUGIN_HANDLED
	}

	if (get_pcvar_num(g_pcvar_claimable) == 1)
	{
		if (!g_EntOwner[ent])
		{
			if ((g_OwnedEnts[id]<get_pcvar_num(g_pcvar_maxclaimable)) || get_pcvar_num(g_pcvar_maxclaimable) == 0)
			{
				g_EntOwner[ent] = id
				g_OwnedEnts[id]++
			}
			else
			{
				client_print (id, print_center, "%L", LANG_SERVER, "FAIL_MAXOWNED", get_pcvar_num(g_pcvar_maxclaimable))
			}
		}
		else if (g_EntOwner[ent] != id && !access(id, AFTER_BUILD))
		{
			client_print (id, print_center, "%L", LANG_SERVER, "FAIL_ALREADYOWNED")
			return PLUGIN_HANDLED 
		}
	}
	
	new tname[7], cname[10];
	entity_get_string(ent, EV_SZ_targetname, tname, 6);
	entity_get_string(ent, EV_SZ_classname, cname, 9);
	if (!equal(cname, "func_wall") || equal(tname, "ignore"))
	{
		return PLUGIN_HANDLED
	}
	
	new origin[3], Float:entOrigin[3], Float:orig[3], Float:mins[3], Float:maxs[3]
	
	entity_get_vector(ent, EV_VEC_origin, orig);
	entity_get_vector(ent, EV_VEC_mins, mins);
	entity_get_vector(ent, EV_VEC_maxs, maxs);

	entOrigin[0] = (mins[0] + maxs[0]) / 2.0 + orig[0];
	entOrigin[1] = (mins[1] + maxs[1]) / 2.0 + orig[1];
	entOrigin[2] = (mins[2] + maxs[2]) / 2.0 + orig[2];
	
	get_user_origin(id, origin);
	IVecFVec(origin, orig)

	g_pDist[id] = get_distance_f(orig, entOrigin);
	
	if (get_pcvar_num(g_pcvar_entmindist)) //maximum
	{
		if (g_pDist[id] < get_pcvar_float(g_pcvar_entmindist)) //minimum
			g_pDist[id] = get_pcvar_float(g_pcvar_entsetdist);
		/*if (g_pDist[id] < get_pcvar_float(g_pcvar_entminoffset))
		{
			g_pOffset[id][0] = orig[0] - entOrigin[0]
			g_pOffset[id][1] = orig[1] - entOrigin[1]
			g_pOffset[id][2] = orig[2] - entOrigin[2]
		}*/
	}

	if (get_pcvar_num(g_pcvar_entmaxdist)) //maximum
	{
		if (g_pDist[id] > get_pcvar_float(g_pcvar_entmaxdist))
			return PLUGIN_HANDLED
	}
	
	//set_pev(ent,pev_solid, SOLID_NOT)
	set_pev(ent,pev_rendermode,1)
	set_pev(ent,pev_renderamt,Float:{100.0})
	set_pev(ent,pev_rendercolor,Float:{135.0, 206.0, 235.0})

	g_MovingEnt[ent] = true
	g_EntMover[ent] = id
	g_pEnt[id] = ent

	ExecuteForward(g_fwGrabEnt,g_fwiFakeReturn, id, ent)
	
	if (!g_CanBuild && access(id, AFTER_BUILD))
	{
		new adminauthid[35],adminname[35]
		get_user_authid (id,adminauthid,34)
		get_user_name(id,adminname,34)
		Log("[MOVE] Admin: %s || SteamID: %s moved an entity", adminname, adminauthid)
	}
	
	return PLUGIN_HANDLED
}

public fw_Player_PreThink(id)
{
	if (!g_pEnt[id] || !is_valid_ent(g_pEnt[id]))
		return FMRES_HANDLED
		
	new buttons = pev(id, pev_button)
	if (buttons & IN_ATTACK)
	{
		g_pDist[id] += 3.0;
		
		if (g_pDist[id] > get_pcvar_float(g_pcvar_entmaxdist))
		{
			g_pDist[id] = get_pcvar_float(g_pcvar_entmaxdist)
			client_print(id, print_center, "%L", LANG_SERVER, "OBJECT_MAX")
		}
		else
			client_print(id, print_center, "%L", LANG_SERVER, "OBJECT_PUSH")
	}
	else if (buttons & IN_ATTACK2)
	{
		g_pDist[id] -= 3.0;
			
		if (g_pDist[id] < get_pcvar_float(g_pcvar_entsetdist))
		{
			g_pDist[id] = get_pcvar_float(g_pcvar_entsetdist)
			client_print(id, print_center, "%L", LANG_SERVER, "OBJECT_MIN")
		}
		else
			client_print(id, print_center, "%L", LANG_SERVER, "OBJECT_PULL")
	}
	
	new origin[3], Float:aiming[3], Float:pOrigin[3], Float:mins[3], Float:maxs[3], Float:neworigin[3]
	
	if (!g_isconnected[id] || (g_pEnt[id] <= g_MaxPlayers)? !g_isconnected[id]:!is_valid_ent(g_pEnt[id]))
	{
		cmdStopEnt(id)
		return PLUGIN_HANDLED
	}
	
	entity_get_vector(g_pEnt[id], EV_VEC_mins, mins);
	entity_get_vector(g_pEnt[id], EV_VEC_maxs, maxs);
	
	get_user_origin(id, origin, 3);
	IVecFVec(origin, aiming);
	get_user_origin(id, origin);
	IVecFVec(origin, pOrigin);
	
	aiming[0] -= pOrigin[0];
	aiming[1] -= pOrigin[1];
	aiming[2] -= pOrigin[2];

	new Float:scalar = g_pDist[id] / vector_length(aiming);
	
	IVecFVec(origin, neworigin);

	neworigin[0] += aiming[0] * scalar - (mins[0] + maxs[0]) / 2.0;
	neworigin[1] += aiming[1] * scalar - (mins[1] + maxs[1]) / 2.0;
	neworigin[2] += aiming[2] * scalar - (mins[2] + maxs[2]) / 2.0;
		
	entity_set_origin(g_pEnt[id], neworigin);
	
	return FMRES_HANDLED
}

public cmdStopEnt(id)
{
	new ent = g_pEnt[id]
	g_MovingEnt[ent] = false
	//set_pev(ent,pev_solid, SOLID_BSP)
	set_pev(ent,pev_rendermode,0)
	set_pev(ent,pev_renderamt,Float:{255.0})
	set_pev(ent,pev_rendercolor,Float:{0.0, 0.0, 0.0})

	ExecuteForward(g_fwDropEnt,g_fwiFakeReturn, id, ent)
	
	g_EntMover[ent] = 0
	g_LastMover[ent] = id
	g_pEnt[id] = 0
}

public fw_Traceline(Float:start[3], Float:end[3], conditions, id, trace)
{
	if (!is_user_alive(id))  return PLUGIN_HANDLED
	
	new ent = get_tr2(trace, TR_pHit)
	
	if (is_valid_ent(ent))
	{
		new ent,body
		get_user_aiming(id,ent,body)
		
		new cname[10], tname[7];
		entity_get_string(ent, EV_SZ_classname, cname, 9);
		entity_get_string(ent, EV_SZ_targetname, tname, 6);
		if (equal(cname, "func_wall") && !equal(tname, "ignore") && ent != g_iEntBarrier && get_pcvar_num(g_pcvar_showmovers) == 1)
		{
			if (g_CanBuild || access(id, ADMIN_KICK))
			{
				if (IsBlockLocked(ent))
				{
					set_hudmessage(255, 0, 0, -1.0, 0.55, 1, 0.01, 3.0, 0.01, 0.01);
					ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_LOCKED");
					return PLUGIN_HANDLED
				}
				set_hudmessage(0, 50, 255, -1.0, 0.55, 1, 0.01, 3.0, 0.01, 0.01);
				if (get_pcvar_num(g_pcvar_claimable) == 0)
				{
					new currentmover[35], lastmover[35]
					if (g_EntMover[ent])
					{
						get_user_name(g_EntMover[ent],currentmover,34)
						if (!g_LastMover[ent]) ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_INFO1", currentmover);
					}
					if (g_LastMover[ent])
					{
						get_user_name(g_LastMover[ent],lastmover,34)
						if (!g_EntMover[ent]) ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_INFO2", lastmover);
					}
					if (g_LastMover[ent] && g_EntMover[ent]) ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_INFO3", currentmover, lastmover);
					else if (!g_LastMover[ent] && !g_EntMover[ent]) ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_INFO4");
				}
				else
				{
					if (g_EntOwner[ent])
					{
						new entowner[35]
						get_user_name(g_EntOwner[ent],entowner,34)
						ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_OWNER", entowner);
					}
					else 
					{
						ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_OWNER_NONE");
					}
				}
			}
		}
	}
	else ClearSyncHud(id, gHudSyncInfo);
	
	return PLUGIN_HANDLED
}

public cmdLockBlock(id)
{
	if (!access(id, LOCK_BLOCKS))
		return PLUGIN_HANDLED
		
	new ent, bodypart
	get_user_aiming (id,ent,bodypart)
	
	new tname[7], cname[10];
	entity_get_string(ent, EV_SZ_targetname, tname, 6);
	entity_get_string(ent, EV_SZ_classname, cname, 9);

	if (!ent || !is_valid_ent(ent) || is_user_alive(ent) || ent == g_iEntBarrier || !equal(cname, "func_wall") || equal(tname, "ignore")) return PLUGIN_HANDLED
	
	if (!IsBlockLocked(ent) && !g_MovingEnt[ent])
	{
		LockBlock(ent)
		set_pev(ent,pev_rendermode,1)
		set_pev(ent,pev_rendercolor,Float:{125.0, 0.0, 0.0})
		
		g_OwnedEnts[g_EntOwner[ent]]--
		g_EntOwner[ent] = 0
	}
	else if (IsBlockLocked(ent))
	{
		UnlockBlock(ent)
		set_pev(ent,pev_rendermode,0)
	}
	return PLUGIN_HANDLED
}

public cmdRemoveClaim(id)
{
	if (!access(id, LOCK_BLOCKS))
      		return PLUGIN_HANDLED 
		
	new ent, bodypart
	get_user_aiming (id,ent,bodypart)
	
	new tname[7], cname[10];
	entity_get_string(ent, EV_SZ_targetname, tname, 6);
	entity_get_string(ent, EV_SZ_classname, cname, 9);

	if (!ent || !is_valid_ent(ent) || is_user_alive(ent) || ent == g_iEntBarrier || !equal(cname, "func_wall") || equal(tname, "ignore") || IsBlockLocked(ent)) return PLUGIN_HANDLED

	g_OwnedEnts[g_EntOwner[ent]]--
	g_EntOwner[ent] = 0
	
	return PLUGIN_HANDLED
}

public cmdRemoveEnt(id)
{
	if (!access(id, REMOVE_BLOCK))
      		return PLUGIN_HANDLED 

	if (!g_isalive[id] && !access(id, DEAD_REMOVE))
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_REMOVE")
		return PLUGIN_HANDLED 
	}
      	
	new ent, bodypart
	get_user_aiming (id,ent,bodypart)
	
	if(!is_valid_ent(ent) || ent == g_iEntBarrier || (ent <= g_MaxPlayers && g_isalive[ent]))
		return PLUGIN_HANDLED
	
	if(IsBlockLocked(ent) || g_MovingEnt[ent])
		return PLUGIN_HANDLED

	new tname[7], cname[10];
	entity_get_string(ent, EV_SZ_targetname, tname, 6);
	entity_get_string(ent, EV_SZ_classname, cname, 9);
	if(!equal(cname, "func_wall"))
		return PLUGIN_HANDLED
	
	if(equal(tname, "ignore"))
		return PLUGIN_HANDLED
	
	g_OwnedEnts[g_EntOwner[ent]]--
	g_EntOwner[ent] = 0
	
	remove_entity(ent)
	
	new adminauthid[35],adminname[35]
	get_user_authid (id,adminauthid,34)
	get_user_name(id,adminname,34)
	Log("[REMOVE] Admin: %s || SteamID: %s removed an entity", adminname, adminauthid)
	
	return PLUGIN_HANDLED
}

public cmdResetEnts(id)
{
	if (!access(id, ADMIN_RESET))
		return PLUGIN_HANDLED
	
	new cname[10], tname[7];
	for (new iEnt = g_MaxPlayers+1; iEnt < MAXENTS; iEnt++)
	{
		if (is_valid_ent(iEnt))
		{
			entity_get_string(iEnt, EV_SZ_classname, cname, 9);
			entity_get_string(iEnt, EV_SZ_targetname, tname, 6);
			if (!IsBlockLocked(iEnt) && iEnt != g_iEntBarrier && equal(cname, "func_wall") && !equal(tname, "ignore"))
				engfunc( EngFunc_SetOrigin, iEnt, Float:{ 0.0, 0.0, 0.0 } );
		}
	}
	
	new adminauthid[35],adminname[35]
	get_user_authid (id,adminauthid,34)
	get_user_name(id,adminname,34)
	Log("[RESET-ENTS] Admin: %s || SteamID: %s reset the entities", adminname, adminauthid)
	
	return PLUGIN_HANDLED
}

public cmdResetAim(id)
{
	if (!access(id, ADMIN_RESET))
      		return PLUGIN_HANDLED 

	new ent, bodypart
	get_user_aiming (id,ent,bodypart)
	
	if(!is_valid_ent(ent) || ent == g_iEntBarrier || (ent <= g_MaxPlayers && g_isalive[ent]))
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_RESET")
		return PLUGIN_HANDLED
	}
	
	if(IsBlockLocked(ent) || g_MovingEnt[ent])
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_RESET")
		return PLUGIN_HANDLED
	}

	new tname[7], cname[10];
	entity_get_string(ent, EV_SZ_targetname, tname, 6);
	entity_get_string(ent, EV_SZ_classname, cname, 9);
	if(!equal(cname, "func_wall") || equal(tname, "ignore"))
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_RESET")
		return PLUGIN_HANDLED
	}
	
	engfunc( EngFunc_SetOrigin, ent, Float:{ 0.0, 0.0, 0.0 } );
	
	new adminauthid[35],adminname[35], targetauthid[35],targetname[35]
	get_user_authid (id,adminauthid,34)
	get_user_name(id,adminname,34)
	get_user_authid(g_EntOwner[ent],targetauthid,34)
	get_user_name(g_EntOwner[ent],targetname,34)
	Log("[REMOVE] Admin: %s || SteamID: %s reset a block belonging to Player: %s || SteamID: %s", adminname, adminauthid, targetauthid, targetname)
	
	g_OwnedEnts[g_EntOwner[ent]]--
	g_EntOwner[ent] = 0
	
	return PLUGIN_HANDLED
}


public cmdClearEnts(id)
{
	if (!access(id, ADMIN_RESET))
		return PLUGIN_HANDLED
	
	new cname[10], tname[7];
	for (new iEnt = g_MaxPlayers+1; iEnt < MAXENTS; iEnt++)
	{
		if (is_valid_ent(iEnt))
		{
			entity_get_string(iEnt, EV_SZ_classname, cname, 9);
			entity_get_string(iEnt, EV_SZ_targetname, tname, 6);
			if (!IsBlockLocked(iEnt) && iEnt != g_iEntBarrier && equal(cname, "func_wall") && !equal(tname, "ignore") && !g_LastMover[iEnt])
			{
				set_pev(iEnt,pev_solid,SOLID_NOT)
				set_pev(iEnt,pev_rendermode,1)
				set_pev(iEnt,pev_renderamt,Float:{0.0})
				g_InvisEnt[iEnt] = true
			}
		}
	}
	
	new adminauthid[35],adminname[35]
	get_user_authid (id,adminauthid,34)
	get_user_name(id,adminname,34)
	Log("[CLEAR-ENTS] Admin: %s || SteamID: %s reset the entities", adminname, adminauthid)
	
	return PLUGIN_HANDLED
}

/*-------------------------------------------------------------------------------------------------|
|------------------------------------End Entity Mover Code-----------------------------------------|
|-------------------------------------------------------------------------------------------------*/

// Ham Weapon Deploy Forward (forces knife only)
public ham_ItemDeploy_Post(weapon_ent)
{
	static owner
	owner = get_pdata_cbase(weapon_ent, OFFSET_WEAPONOWNER, OFFSET_LINUX_WEAPONS);
	
	static weaponid
	weaponid = cs_get_weapon_id(weapon_ent)
	
	g_CurrentWeapon[owner] = weaponid
	
	if (g_iszombie[owner] && !((1<<weaponid) & ZOMBIE_ALLOWED_WEAPONS_BITSUM))
	{
		g_CurrentWeapon[owner] = CSW_KNIFE
		engclient_cmd(owner, "weapon_knife")
	}
	else if (g_CanBuild && !g_iszombie[owner])
	{
		g_CurrentWeapon[owner] = CSW_KNIFE
		engclient_cmd(owner, "weapon_knife")
		client_print(owner, print_center, "%L", LANG_SERVER, "FAIL_KNIFE_ONLY");
	}
}

public msgRoundEnd(const MsgId, const MsgDest, const MsgEntity)
{
	static Message[192]
	get_msg_arg_string(2, Message, 191)
	
	set_hudmessage(255, 255, 255, -1.0, 0.40, 0, 6.0, 6.0, 0.1, 0.2, 1)
	
	if(equal(Message, "#Game_bomb_drop"))
		return PLUGIN_HANDLED
	
	if (equal(Message, "#Terrorists_Win"))
	{
		show_hudmessage(0, "Zombies Win!")
		set_msg_arg_string(2, "")
		client_cmd(0, "spk %s", g_WinZomb)
	}
	else if (equal(Message, "#Target_Saved") || equal(Message, "#CTs_Win"))
	{
		show_hudmessage(0, "Builders Win!")
		set_msg_arg_string(2, "")
		client_cmd(0, "spk %s", g_WinHum)
	}
	return PLUGIN_HANDLED
}

public ham_WeaponCleaner_Post(iEntity)
{
	call_think(iEntity)
}

/*-------------------------------------------------------------------------------------------------|
|----------------------------Begin Auto Join on Connect Code----[0003]-----------------------------|
|-------------------------------------------------------------------------------------------------*/

public message_show_menu(msgid, dest, id) 
{
	if (!(!get_user_team(id) && !g_isbot[id] && !access(id, ADMIN_IMMUNITY)))//
		return PLUGIN_CONTINUE

	static team_select[] = "#Team_Select"
	static menu_text_code[sizeof team_select]
	get_msg_arg_string(4, menu_text_code, sizeof menu_text_code - 1)
	if (!equal(menu_text_code, team_select))
		return PLUGIN_CONTINUE

	static param_menu_msgid[2]
	param_menu_msgid[0] = msgid
	set_task(AUTO_TEAM_JOIN_DELAY, "task_force_team_join", id, param_menu_msgid, sizeof param_menu_msgid)

	return PLUGIN_HANDLED
}

public message_vgui_menu(msgid, dest, id) 
{
	if (get_msg_arg_int(1) != TEAM_SELECT_VGUI_MENU_ID || !(!get_user_team(id) && !g_isbot[id] && !access(id, ADMIN_IMMUNITY)))// 
		return PLUGIN_CONTINUE
		
	static param_menu_msgid[2]
	param_menu_msgid[0] = msgid
	set_task(AUTO_TEAM_JOIN_DELAY, "task_force_team_join", id, param_menu_msgid, sizeof param_menu_msgid)

	return PLUGIN_HANDLED
}

public task_force_team_join(menu_msgid[], id) 
{
	if (get_user_team(id))
		return

	static msg_block
	msg_block = get_msg_block(menu_msgid[0])
	set_msg_block(menu_msgid[0], BLOCK_SET)
	engclient_cmd(id, "jointeam", "5")
	engclient_cmd(id, "joinclass", "5")
	set_msg_block(menu_msgid[0], msg_block)
	
	g_pTeam[id] = cs_get_user_team(id)
	g_pCurTeam[id] = cs_get_user_team(id)
}

/*-------------------------------------------------------------------------------------------------|
|----------------------------End Auto Join on Connect Code-----------------------------------------|
|-------------------------------------------------------------------------------------------------*/

public clcmd_changeteam(id)
{
	if (!access(id, ADMIN_IMMUNITY))
	{
		if (g_iszombie[id])
			client_print (id, print_center, "%L", LANG_SERVER, "FAIL_ZOMBIE")
		else if (g_CanBuild) 
			weapon_method_menu(id)
		else 
			client_print (id, print_center, "%L", LANG_SERVER, "FAIL_WEAPONS")
			
		return PLUGIN_HANDLED
	}
	return PLUGIN_CONTINUE
}

public clcmd_drop(id)
{
	client_print (id, print_center, "%L", LANG_SERVER, "FAIL_DROP")
	return PLUGIN_HANDLED
}

public clcmd_buy(id)
{
	client_print (id, print_center, "%L", LANG_SERVER, "FAIL_BUY")
	return PLUGIN_HANDLED
}

public Base_Calc()
{
	new players[32], num, ct, basenum
	get_players(players, num)
	new player
	for(new i = 0; i < num; i++)
	{
		player = players
		if (cs_get_user_team(player) == CS_TEAM_CT)
			ct++

		if (ct < 6)
			basenum = 2
		else
			basenum = (ct/3)
	}
	print_color(0, "%s %L", formatmodname, LANG_SERVER, "BASE_CALC", basenum)
}

public Fix_Spawns()
{
	new players[32], num
	get_players(players, num)
			
	new player
	for(new i = 0; i < num; i++)
	{
		player = players
		if (cs_get_user_team(player) == CS_TEAM_CT && !is_user_alive(player) && g_isconnected[player] && g_CanBuild)
			ExecuteHamB(Ham_CS_RoundRespawn, player)
	}
}

public msgScoreAttrib(msgid, dest, id)
{
	static attrib 
	attrib = get_msg_arg_int(2)
	
	if(attrib == (1<<1))
		set_msg_arg_int(2, ARG_BYTE, 0)
}

public msgStatusIcon(const iMsgId, const iMsgDest, const iPlayer)
{
	if(g_isalive[iPlayer] && g_isconnected[iPlayer]) 
	{
		static szMsg[8]
		get_msg_arg_string(2, szMsg, 7)
    
    		if (szMsg[0] == 'c' && szMsg[1] == '4') return PLUGIN_HANDLED
		else return PLUGIN_CONTINUE
    
		if(equal(szMsg, "buyzone"))
		{
			set_pdata_int(iPlayer, OFFSET_BUYZONE, get_pdata_int(iPlayer, OFFSET_BUYZONE) & ~(1<<0))
			return PLUGIN_HANDLED
		}
	}
	return PLUGIN_CONTINUE
} 

/*public fw_CreateNamedEntity(entclassname)
{
	static classname[10]
	engfunc(EngFunc_SzFromIndex, entclassname, classname, 9)
	
	return (classname[7] == 'c' && classname[8] == '4') ? FMRES_SUPERCEDE : FMRES_IGNORED
}*/

public cmdBuildBan(id)
{
	if (access(id, BUILD_BAN))
	{
		new arg[32]
		read_argv(1, arg, 31)
		new player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)
		g_BuildBan[player] = true
		cmdStopEnt(player)
		
		new adminauthid[35],adminname[35],playername[35],playerauthid[35]
		get_user_name(id,adminname,34)
		get_user_authid (id,adminauthid,34)
		get_user_name(player, playername, 34)
		get_user_authid (player,playerauthid,34)
		Log("[MOVE] Admin: %s || SteamID: %s banned Player: %s || SteamID: %s from building", adminname, adminauthid, playername, playerauthid)
		
		client_print(id, print_console, "%L", LANG_SERVER, "BUILD_BAN1", playername)
		client_print(player, print_center, "%L", LANG_SERVER, "BUILD_BAN2")
	}
}

public cmdBuildUnban(id)
{
	if (access(id, BUILD_BAN))
	{
		new arg[32], playername[35]
	
		read_argv(1, arg, 31)
		new player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)
		get_user_name(player, playername, 34)
		client_print(id, print_console, "%L", LANG_SERVER, "UNBUILD_BAN1", playername)
		g_BuildBan[player] = false
		print_color(player, "%s %L", formatmodname, LANG_SERVER, "UNBUILD_BAN2")
	}
}

public cmdRevive(id)
{
	if (access(id, REVIVE))
	{
		new arg[32]
		read_argv(1, arg, 31)
		new player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)

		if (is_user_alive(player))
		{
			client_print(id, print_console, "%L", LANG_SERVER, "FAIL_REVIVE")
			return PLUGIN_HANDLED
		}
		
		ExecuteHamB(Ham_CS_RoundRespawn, player)
		
		new adminauthid[35],adminname[35],playername[35],playerauthid[35]
		get_user_name(id,adminname,34)
		get_user_authid (id,adminauthid,34)
		get_user_name(player, playername, 34)
		get_user_authid (player,playerauthid,34)
		Log("[REVIVE] Admin: %s || SteamID: %s revived Player: %s || SteamID: %s", adminname, adminauthid, playername, playerauthid)
		
		client_print(id, print_console, "%L", LANG_SERVER, "REVIVE1", playername)
		client_print(player, print_center, "%L", LANG_SERVER, "REVIVE2")
	}
	return PLUGIN_HANDLED
}


public cmdGiveGuns(id)
{
	if (access(id, ADMIN_GUNS))
	{
		new arg[32]
		read_argv(1, arg, 31)
		new player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)
		
		new playername[35]
		get_user_name(player, playername, 34)
		
		if (g_isalive[player])
		{
			weapon_method_menu(player)
			
			client_print(id, print_console, "%L", LANG_SERVER, "GIVEGUNS1", playername)
			client_print(player, print_center, "%L", LANG_SERVER, "GIVEGUNS2")
		}
		else
		{
			client_print(id, print_console, "%L", LANG_SERVER, "GIVEGUNS3", playername)
		}
	}
	return PLUGIN_HANDLED
}

public cmdSwap(id)
{
	if (access(id, SWAP))
	{
		new arg[32]
		read_argv(1, arg, 31)
		new player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)

		if (!is_user_connected(player)) return PLUGIN_HANDLED
		
		cs_set_user_team(player, cs_get_user_team(player) == CS_TEAM_T ? CS_TEAM_CT:CS_TEAM_T)
			
		g_iszombie[id] = cs_get_user_team(id) == CS_TEAM_T ? true : false
		
		if (is_user_alive(player))
			ExecuteHamB(Ham_CS_RoundRespawn, player)
		
		new adminauthid[35],adminname[35],playername[35],playerauthid[35]
		get_user_name(id,adminname,34)
		get_user_authid (id,adminauthid,34)
		get_user_name(player, playername, 34)
		get_user_authid (player,playerauthid,34)
		Log("[TEAM-SWAP] Admin: %s || SteamID: %s swapped Player: %s || SteamID: %s", adminname, adminauthid, playername, playerauthid)
		
		client_print(id, print_console, "%L", LANG_SERVER, "SWAP1", playername)
		client_print(player, print_center, "%L", LANG_SERVER, "SWAP2")
	}
	return PLUGIN_HANDLED
}

public cmdStartRound(id)
{
	if (access(id, START_ROUND))
	{
		if (count_down<10)
		{
			client_print(id, print_console, "%L", LANG_SERVER, "FAIL_START_ROUND")
			return PLUGIN_HANDLED
		}
		
		Release_Zombies()
		
		new adminauthid[35],adminname[35]
		get_user_name(id,adminname,34)
		get_user_authid (id,adminauthid,34)
		Log("[START_ROUND] Admin: %s || SteamID: %s started the round", adminname, adminauthid)
		
		client_print(id, print_center, "%L", LANG_SERVER, "START_ROUND")
		client_print(id, print_chat, "^x04%L", LANG_SERVER, "START_ROUND")
	}
	return PLUGIN_HANDLED
}


public cmdSay(id)
{
	new arg[64], arg1[31], arg2[32]
	read_args(arg1, charsmax(arg1));
	remove_quotes(arg1);
	read_args(arg,63)
	remove_quotes(arg)
	strtok(arg,arg1,255,arg2,255,' ',1)
	trim(arg2)
	
	if(arg1[0] == '/')
	{
		if (equali(arg1, "/cmds") == 1 || equali(arg1, "/commands") == 1)
		{
			print_color(id, "%s /respawn, /fixspawn, /help, /round, /guns", formatmodname)
			if (access(id, ADMIN_KICK))
				print_color(id, "%s Admin: /fixspawns, /respawns, removeaim, lockaim, unclaimaim", formatmodname)
			return PLUGIN_HANDLED
		}

		if (equali(arg1, "/respawn") == 1 || equali(arg1, "/revive") == 1)
		{
			Respawn_Zombie(id)
			return PLUGIN_HANDLED
		}
		
		if (equali(arg1, "/fixspawn") == 1)
		{
			if (g_isconnected[id] && !g_iszombie[id] && g_CanBuild)
				ExecuteHamB(Ham_CS_RoundRespawn, id)
				
			return PLUGIN_HANDLED
		}
		if (equali(arg1, "/help") == 1 || equali(arg1, "/rules") == 1)
		{
			set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 15.0, 0.1, 0.2, 2)
			new nLen, szHelp[512]
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "WELCOME_MSG", VERSION);
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "BIND_KEY");
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "RULE1");
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "RULE2");
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "RULE3");
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "RULE4");
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "RULE5");
			show_hudmessage(id, szHelp);
			
			return PLUGIN_HANDLED
		}

		if (equali(arg1, "/round") == 1)
		{
			if (g_ZombiesReleased) print_color(id, "%s Round: %d of %d", formatmodname, (g_RoundNum), g_pcvar_maxrounds)
			else if (!g_ZombiesReleased) print_color(id, "%s Round: %d of %d", formatmodname, (g_RoundNum+1), g_pcvar_maxrounds)
			
			return PLUGIN_HANDLED
		}
	
		if (equali(arg1, "/guns") == 1)
		{
			if(!g_isalive[id] || !g_isconnected[id] || g_iszombie[id])
				return PLUGIN_HANDLED
			
			if(!g_CanBuild && !access(id, ADMIN_GUNS))
				return PLUGIN_HANDLED	
		
			weapon_method_menu(id)
			
			return PLUGIN_HANDLED
		}
	
		if (equali(arg1, "/fixspawns") == 1 && access(id, BAD_SPAWN))
		{
			new players[32], num
			get_players(players, num)
				
			new player
			for(new i = 0; i < num; i++)
			{
				player = players
				if (cs_get_user_team(player) == CS_TEAM_CT && !is_user_alive(player) && g_isconnected[player] && g_CanBuild)
					ExecuteHamB(Ham_CS_RoundRespawn, player)
			}
			return PLUGIN_HANDLED
		}
		
		if (equali(arg1, "/respawns") == 1 && access(id, BAD_SPAWN))
		{
			new players[32], num
			get_players(players, num)
				
			new player
			for(new i = 0; i < num; i++)
			{
				player = players
				if (cs_get_user_team(player) == CS_TEAM_T && !is_user_alive(player) && g_isconnected[player])
					ExecuteHamB(Ham_CS_RoundRespawn, player)
			}
			return PLUGIN_HANDLED
		}
	}
	return PLUGIN_CONTINUE
}

/*-------------------------------------------------------------------------------------------------|
|----------------------------------Begin Status Text Code---[0006]---------------------------------|
|-------------------------------------------------------------------------------------------------*/
public msgStatusValue()
{
	//Block the name info, of person you aim at
	set_msg_block(gmsgStatusText, BLOCK_SET);
}

public ev_SetTeam(id)
{
	g_friend[id] = read_data(2)
}

public ev_ShowStatus(id) //called when id looks at someone
{
	new name[32], pid = read_data(2);
	
	get_user_name(pid, name, 31);
	new color1 = 0, color2 = 0;

	if (get_user_team(pid) == 1)
		color1 = 255;
	else
		color2 = 255;

	new Float:height=0.30
	//height=0.60

	if (g_friend[id] == 1)	// friend
	{
		new clip, ammo, wpnid = get_user_weapon(pid, clip, ammo);
		new wpnname[32];

		if (wpnid)
			xmod_get_wpnname(wpnid, wpnname, 31);

		set_hudmessage(color1, 50, color2, -1.0, height, 1, 0.01, 3.0, 0.01, 0.01);
		new nLen, szStatus[512]
		nLen += format( szStatus[nLen], 511-nLen, "%L", LANG_SERVER, "PLAYER_INFO1", name, get_user_health(pid), wpnname);
		ShowSyncHudMsg(id, gHudSyncInfo, szStatus);
	} 
	if (g_friend[id] != 1) //enemy
	{
		set_hudmessage(color1, 50, color2, -1.0, height, 1, 0.01, 3.0, 0.01, 0.01);
		ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "PLAYER_INFO2", name);
	}
}

public ev_HideStatus(id)
{
	ClearSyncHud(id, gHudSyncInfo);
}
/*-------------------------------------------------------------------------------------------------|
|------------------------------------------End Player Model Code-----------------------------------|
|-------------------------------------------------------------------------------------------------*/

/*-------------------------------------------------------------------------------------------------|
|-------------------------------Begin Guns Menu Code-[0001]----------------------------------------|
|-------------------------------------------------------------------------------------------------*/

//Call this on player spawn
public weapon_method_menu(id)
{
	if(firsttime[id])
	{
		firsttime[id] = false
		prim_weapons_menu(id,0)
	}
	else
	{
		cur_offset[id] = 0
		show_menu(id,(1<<0)|(1<<1),"\rAlege-ti Armele^n^n\y1. \yArme noi^n\y2. \yVechile Arme",-1,"WeaponMethodMenu")
	}
}

public weapon_method_pushed(id,key)
{
	switch(key)
	{
		case 0: prim_weapons_menu(id,0)
		case 1: give_weapons(id)
	}
	return PLUGIN_HANDLED;
}

public prim_weapons_menu(id,offset)
{
	if(offset<0) offset = 0

	new cvar_value[32]
	get_pcvar_string(g_pcvar_allowedweps,cvar_value,31)
	new flags = read_flags(cvar_value)

	new keys, curnum, menu[2048]
	for(new i=offset;i<19;i++)
	{
		if(flags & power(2,i))
		{
			options_on_menu[curnum][id] = i
			keys += (1<<curnum)
	
			curnum++
			format(menu,2047,"%s^n%d. %s",menu,curnum,WEAPONNAMES)
	
			if(curnum==8)
			break;
		}
	}

	format(menu,2047,"\yArme:\w^n%s^n",menu)
	if(curnum==8 && offset<12)
	{
		keys += (1<<8)
		format(menu,2047,"%s^n9. Next",menu)
	}
	if(offset)
	{
		keys += (1<<9)
		format(menu,2047,"%s^n0. Back",menu)
	}

	show_menu(id,keys,menu,-1,"PrimaryWeaponSelect")
}

public prim_weapons_pushed(id,key)
{
	if(key<8)
	{
		weapon_picked[0][id] = options_on_menu[key][id]
		cur_offset[id] = 0
		sec_weapons_menu(id,0)
	}
	else
	{
		if(key==8)
			cur_offset[id] += 8
		if(key==9)
			cur_offset[id] -= 8
		prim_weapons_menu(id,cur_offset[id])
	}
	return ;
}

public sec_weapons_menu(id,offset)
{
	if(offset<0) offset = 0

	new cvar_value[32]
	get_pcvar_string(g_pcvar_allowedweps,cvar_value,31)
	new flags = read_flags(cvar_value)

	new keys, curnum, menu[2048]
	for(new i=18;i<24;i++)
	{
		if(flags & power(2,i))
		{
		options_on_menu[curnum][id] = i
		keys += (1<<curnum)

		curnum++
		format(menu,2047,"%s^n%d. %s",menu,curnum,WEAPONNAMES[i])
		}
	}

	format(menu,2047,"\yPistoale:\w^n%s",menu)

	show_menu(id,keys,menu,-1,"SecWeaponSelect")
}

public sec_weapons_pushed(id,key)
{
	if(key<8)
	{
		weapon_picked[1][id] = options_on_menu[key][id]
	}
	give_weapons(id)
	return ;
}

public give_weapons(id)
{
	strip_user_weapons(id)
	give_item(id,"weapon_knife")
   
	new weapon[32]
	new csw = csw_contant(weapon_picked[0][id])
	get_weaponname(csw,weapon,31)
	give_item(id,weapon)
	cs_set_user_bpammo(id,csw,999)
	g_PrimaryWeapon[id] = csw

	csw = csw_contant(weapon_picked[1][id])
	get_weaponname(csw,weapon,31)
	give_item(id,weapon)
	cs_set_user_bpammo(id,csw,999)
}

public csw_contant(weapon)
{
	new num = 29
	switch(weapon)
	{
		case 0: num = 3
		case 1: num = 5
		case 2: num = 7
		case 3: num = 8
		case 4: num = 12
		case 5: num = 13
		case 6: num = 14
		case 7: num = 15
		case 8: num = 18
		case 9: num = 19
		case 10: num = 20
		case 11: num = 21
		case 12: num = 22
		case 13: num = 23
		case 14: num = 24
		case 15: num = 27
		case 16: num = 28
		case 17: num = 30
		case 18: num = 1
		case 19: num = 10
		case 20: num = 11
		case 21: num = 16
		case 22: num = 17
		case 23: num = 26
		case 24:
		{
			new s_weapon[32]
		
			get_pcvar_string(g_pcvar_allowedweps,s_weapon,31)
		   
			new flags = read_flags(s_weapon)
			do
			{
				num = random_num(0,18)
				if(!(num & flags))
				{
					num = -1
				}
			}
			while(num==-1)
			num = csw_contant(num)
		}
		case 25:
		{
			new s_weapon[32]

			get_pcvar_string(g_pcvar_allowedweps,s_weapon,31)
		
			new flags = read_flags(s_weapon)
			do
			{
				num = random_num(18,23)
				if(!(num & flags))
				{
					num = -1
				}
			}
			while(num==-1)
			num = csw_contant(num)
		}
	}
	return num;
}

/*-------------------------------------------------------------------------------------------------|
|---------------------------------End Guns Menu Code-----------------------------------------------|
|-------------------------------------------------------------------------------------------------*/

public ev_Health(id)
{
	if (is_user_alive(id))
	{
		set_hudmessage(255, 255, 255, -1.0, 0.9, 0, 12.0, 12.0, 0.1, 0.2, 4);
		show_hudmessage(id, "%L", LANG_SERVER, "PLAYER_HEALTH", get_user_health(id));
		
		set_task(11.9, "ev_Health", id);
	}
}

public msgHealth(msgid, dest, id)
{
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE;
	
	static hp;
	hp = get_msg_arg_int(1);
	
	if(hp > 255 && (hp % 256) == 0)
		set_msg_arg_int(1, ARG_BYTE, ++hp);
	
	return PLUGIN_CONTINUE;
}

Log(const message_fmt[], any:...)
{
	static message[256];
	vformat(message, sizeof(message) - 1, message_fmt, 2);
	
	static filename[96];
	static dir[64];
	if( !dir[0] )
	{
		get_basedir(dir, sizeof(dir) - 1);
		add(dir, sizeof(dir) - 1, "/logs");
	}
	
	format_time(filename, sizeof(filename) - 1, "%m-%d-%Y");
	format(filename, sizeof(filename) - 1, "%s/ADMIN_ACTIVITY_%s.log", dir, filename);
	
	log_to_file(filename, "%s", message);
}

print_color(target, const message[], any:...)
{
	static buffer[512], i, argscount
	argscount = numargs()
	
	// Send to everyone
	if (!target)
	{
		static player
		for (player = 1; player <= g_MaxPlayers; player++)
		{
			if (!g_isconnected[player])
				continue;

			static changed[5], changedcount
			changedcount = 0

			for (i = 2; i < argscount; i++)
			{
				if (getarg(i) == LANG_PLAYER)
				{
					setarg(i, 0, player)
					changed[changedcount] = i
					changedcount++
				}
			}
			vformat(buffer, charsmax(buffer), message, 3)

			message_begin(MSG_ONE_UNRELIABLE, gmsgSayText, _, player)
			write_byte(player)
			write_string(buffer)
			message_end()
			
			for (i = 0; i < changedcount; i++)
				setarg(changed[i], 0, LANG_PLAYER)
		}
	}
	// Send to specific target
	else
	{
		vformat(buffer, charsmax(buffer), message, 3)

		message_begin(MSG_ONE, gmsgSayText, _, target)
		write_byte(target)
		write_string(buffer)
		message_end()
	}
}


Vezi daca este bine.. nu stiu exact daca asta ai vrut, dar testeaza-l. astept reply.:D
User avatar
-Turbo-
Membru, skill +4
Membru, skill +4
Posts: 1664
Joined: 11 Nov 2012, 01:28
Detinator Steam: Da
CS Status: Bored !
Detinator server CS: Da
SteamID: kingforbidden
Reputatie: Utilizator neserios ( tepar )
Restrictie moderator
Ban scos ( achitat )
Nume anterior: Turbo19973
Location: Botosani
Has thanked: 49 times
Been thanked: 212 times

13 Jul 2013, 21:34

Code: Select all

2. basebuilder65 = sa arate meniu la arme tot cu portocaliu ca pe unele harti nu se vede meniul deoarce e alb
Nu exista culoarea portocaliu in meniu,insa o poti face galbena :P
User avatar
FlyingSnow
Membru, skill +2
Membru, skill +2
Posts: 825
Joined: 01 Oct 2012, 02:22
Detinator Steam: Da
Detinator server CS: Dap.
SteamID: Nu-i public.
Has thanked: 26 times
Been thanked: 52 times
Contact:

13 Jul 2013, 22:08

Uita-te la al meu, am colorat cu galben :-?
User avatar
-Turbo-
Membru, skill +4
Membru, skill +4
Posts: 1664
Joined: 11 Nov 2012, 01:28
Detinator Steam: Da
CS Status: Bored !
Detinator server CS: Da
SteamID: kingforbidden
Reputatie: Utilizator neserios ( tepar )
Restrictie moderator
Ban scos ( achitat )
Nume anterior: Turbo19973
Location: Botosani
Has thanked: 49 times
Been thanked: 212 times

13 Jul 2013, 23:28

? | Afiseaza codul
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta>
#include <engine>

#define NORMAL DontChange
#define GREEN DontChange
#define TEAM_COLOR DontChange
#define RED Red
#define BLUE Blue
#define GREY Grey
#define ColorChat client_print_color

#define VERSION "1.0"

#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )

#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame

#pragma semicolon 1

enum _:Colors {
	DontChange,
	Red,
	Blue,
	Grey
};

new const g_prefix[] = "[Base Builder Orizont]";

new const g_ModelSuperKnife[] = "models/bb/superknife.mdl";
new const g_ModelSuperDeagle[] = "models/bb/v_golden_deagle.mdl";

new bool:g_bHasSuperKnife[33],
	bool:g_bHasSuperSpeed[33],
	bool:g_bHasSuperM249[33],
	bool:g_bHasSuperAWP[33],
	bool:g_bHasSuperDeagle[33],
	bool:g_bHasGunsKit[33];
	

new g_iMaxPlayers;

new g_pCvarCostSuperCut,
	g_pCvarCostLowGrav,
	g_pCvarQuantityLowGrav,
	g_pCvarCostSpeed,
	g_pCvarQuantitySpeed,
	g_pCvarQuantityHealthCT,
	g_pCvarCostHealthCT,
	g_pCvarCostHE,
	g_pCvarCostFlash,
	g_pCvarCostSmoke,
	g_pCvarCostSuperM249,
	g_pCvarCostSuperAWP,
	g_pCvarCostSuperDeagle,
	g_pCvarCostKitGuns,
	g_pCvarQuantityHealthT1,
	g_pCvarCostHealthT1,
	g_pCvarQuantityHealthT2,
	g_pCvarCostHealthT2,
	g_pCvarCostInvisinsibilite,
	g_pCvarTimeInvisinsibilite;


public plugin_init()
{
	register_plugin("Base Builder Orizont", VERSION, "GaBy");

	register_clcmd("say /shop", "ShowShop");
	register_clcmd("say_team /shop", "ShowShop");
	register_clcmd("say shop", "ShowShop");
	register_clcmd("say_team shop", "ShowShop");

	// Cvars Mixtes
	g_pCvarCostSuperCut = register_cvar("shopbb_supercut", "16000");
	g_pCvarCostLowGrav = register_cvar("shopbb_grav", "8000");
	g_pCvarQuantityLowGrav = register_cvar("shopbb_quant_grav", "0.150");
	g_pCvarCostSpeed = register_cvar("shopbb_speed", "8000");
	g_pCvarQuantitySpeed = register_cvar("shopbb_quantity_speed", "500.0");
	
	// Cvars CT
	g_pCvarQuantityHealthCT = register_cvar("shopbb_vie_ct", "150");
	g_pCvarCostHealthCT = register_cvar("shopbb_prix_vie_ct", "5000");
	g_pCvarCostHE = register_cvar("shopbb_he", "2500");
	g_pCvarCostFlash = register_cvar("shopbb_flash", "2500");
	g_pCvarCostSmoke = register_cvar("shopbb_smoke", "2500");
	g_pCvarCostSuperM249 = register_cvar("shopbb_super_m249", "8000");
	g_pCvarCostSuperAWP = register_cvar("shopbb_super_awp", "10000");
	g_pCvarCostSuperDeagle = register_cvar("shopbb_super_deagle", "16000");
	g_pCvarCostKitGuns = register_cvar("shopbb_kit_guns", "16000");
	
	// Cvars T
	g_pCvarQuantityHealthT1 = register_cvar("shopbb_health_t1", "2000");
	g_pCvarCostHealthT1 = register_cvar("shopbb_prix_health_t1", "8000");
	g_pCvarQuantityHealthT2 = register_cvar("shopbb_health_t2", "5000");
	g_pCvarCostHealthT2 = register_cvar("shopbb_prix_health_t2", "16000");
	g_pCvarCostInvisinsibilite = register_cvar("shopbb_invins", "10000");
	g_pCvarTimeInvisinsibilite = register_cvar("shopbb_time_invins", "10.0");

	RegisterHam(Ham_Spawn, "player", "Player_Spawn_Post", 1);
	RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage_Pre");
	RegisterHam(Ham_Item_Deploy, "weapon_knife", "ham_ItemDeploy_Post_KNI", 1);
	RegisterHam(Ham_Item_Deploy, "weapon_deagle", "ham_ItemDeploy_Post_DGL", 1);
	RegisterHam(Ham_Player_ResetMaxSpeed, "player", "Player_ResetMaxSpeed",  1);
	
	g_iMaxPlayers = get_maxplayers();
}
 
public client_putinserver( id )
{ 
	g_bHasSuperKnife[id] = false;
	g_bHasSuperSpeed[id] = false;
	g_bHasSuperM249[id] = false;
	g_bHasSuperAWP[id] = false;
	g_bHasSuperDeagle[id] = false;
	g_bHasGunsKit[id] = false;
}
 
public ShowShop(id)
{
	if ( is_user_alive(id) )
	{
		new Text[64];
		
		if(cs_get_user_team(id) == CS_TEAM_T)
		{
			new menu1 = menu_create("\r[Zombie Shop (BaseBuilder Orizont)]", "ZombieShop");
			formatex(Text, charsmax(Text), "\ySpeed \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSpeed));
			menu_additem(menu1, Text, "0");
			formatex(Text, charsmax(Text), "\yGravity \y[\r%d $\y]", get_pcvar_num(g_pCvarCostLowGrav));
			menu_additem(menu1, Text, "1");
			formatex(Text, charsmax(Text), "\ySuper Cut \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperCut));
			menu_additem(menu1, Text, "2");
			formatex(Text, charsmax(Text), "\y+%d HP \y[\r%d $\y]", get_pcvar_num(g_pCvarQuantityHealthT1), get_pcvar_num(g_pCvarCostHealthT1));
			menu_additem(menu1, Text, "3");
			formatex(Text, charsmax(Text), "\y+%d HP \y[\r%d $\y]", get_pcvar_num(g_pCvarQuantityHealthT2), get_pcvar_num(g_pCvarCostHealthT2));
			menu_additem(menu1, Text, "4");
			formatex(Text, charsmax(Text), "\yInvincible \y[\r%d $\y]", get_pcvar_num(g_pCvarCostInvisinsibilite));
			menu_additem(menu1, Text, "5");

			menu_setprop(menu1, MPROP_EXITNAME, "Exit");

			menu_display(id, menu1);
		}

		else if(cs_get_user_team(id) == CS_TEAM_CT)
		{
			new menu2 = menu_create ("\r[Human Shop (BaseBuilder Orizont)]", "BaseBuilderShop");	
			formatex(Text, charsmax(Text), "\ySuper Cut \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperCut));
			menu_additem(menu2, Text, "0");
			formatex(Text, charsmax(Text), "\ySpeed \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSpeed));
			menu_additem(menu2, Text, "1");
			formatex(Text, charsmax(Text), "\yGravity \y[\r%d $\y]", get_pcvar_num(g_pCvarCostLowGrav));
			menu_additem(menu2, Text, "2");
			formatex(Text, charsmax(Text), "\y+%d HP \y[\r%d $\y]", get_pcvar_num(g_pCvarQuantityHealthCT), get_pcvar_num(g_pCvarCostHealthCT));
			menu_additem(menu2, Text, "3");
			formatex(Text, charsmax(Text), "\yGrenade \y[\r%d $\y]", get_pcvar_num(g_pCvarCostHE));
			menu_additem(menu2, Text, "4");
			formatex(Text, charsmax(Text), "\yFlash \y[\r%d $\y]", get_pcvar_num(g_pCvarCostFlash));
			menu_additem(menu2, Text, "5");
			formatex(Text, charsmax(Text), "\ySmoke \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSmoke));
			menu_additem(menu2, Text, "6");
			formatex(Text, charsmax(Text), "\ySuper M249 \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperM249));
			menu_additem(menu2, Text, "7");
			formatex(Text, charsmax(Text), "\ySuper AWP \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperAWP));
			menu_additem(menu2, Text, "8");
			formatex(Text, charsmax(Text), "\ySuper Deagle \y[\r%d $\y]", get_pcvar_num(g_pCvarCostSuperDeagle));
			menu_additem(menu2, Text, "9");
			formatex(Text, charsmax(Text), "\yKit Guns \y[\r%d $\y]", get_pcvar_num(g_pCvarCostKitGuns));
			menu_additem(menu2, Text, "10");

			menu_display(id, menu2);
		}
	}
}

public ZombieShop(id, menu1, item)
{
	if (item == MENU_EXIT || !is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_T) 
	{
		menu_destroy(menu1);
		return PLUGIN_HANDLED;
	}
	
	new iMoney = cs_get_user_money(id);

	switch(item)
	{
		case 0:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSpeed))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSpeed));
				g_bHasSuperSpeed[id] = true;
				set_user_maxspeed(id, get_pcvar_float(g_pCvarQuantitySpeed));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super Speed^1!", g_prefix);
			}
				
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 1:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostLowGrav))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostLowGrav));
				set_user_gravity(id, get_pcvar_float(g_pCvarQuantityLowGrav));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Low Gravity^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 2:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSuperCut))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperCut));
				g_bHasSuperKnife[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super Cut^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}
	   
		case 3:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostHealthT1))
			{			 
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostHealthT1));
				set_user_health(id, get_user_health(id) + get_pcvar_num(g_pCvarQuantityHealthT1));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3%d HP^1!", g_prefix, get_pcvar_num(g_pCvarQuantityHealthT1));
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}
	   
		case 4:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostHealthT2))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostHealthT2));
				set_user_health(id, get_user_health(id) + get_pcvar_num(g_pCvarQuantityHealthT2));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3%d HP^1!", g_prefix, get_pcvar_num(g_pCvarQuantityHealthT2));
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}
	  
		case 5:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostInvisinsibilite))
			{
				cs_set_user_money(id, cs_get_user_money(id) - get_pcvar_num(g_pCvarCostInvisinsibilite));
				set_user_godmode(id, 1);
				set_task(0.0 + get_pcvar_float(g_pCvarTimeInvisinsibilite), "RemoveGodMode", id);
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat l'^3invincibilite^1 pentru^3 cateva secunde^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}	  
	}
	menu_destroy(menu1);
	return PLUGIN_HANDLED;
}

public RemoveGodMode(id)
{
	set_user_godmode(id, 0);
	client_print_color(id, DontChange, "^4%s ^1Nu mai esti invincibil!", g_prefix);
}

public BaseBuilderShop(id, menu2, item)
{
	if (item == MENU_EXIT || !is_user_alive(id) || cs_get_user_team(id) != CS_TEAM_CT) 
	{
		menu_destroy(menu2);
		return PLUGIN_HANDLED;
	}
	
	new iMoney = cs_get_user_money(id);

	switch(item)
	{
		case 0:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSuperCut))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperCut));
				g_bHasSuperKnife[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super Cut^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 1:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSpeed))
			{			 
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSpeed));
				g_bHasSuperSpeed[id] = true;
				set_user_maxspeed(id, get_pcvar_float(g_pCvarQuantitySpeed));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super Speed^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}
	   
		case 2:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostLowGrav))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostLowGrav));
				set_user_gravity(id, get_pcvar_float(g_pCvarQuantityLowGrav));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Low Gravity^1!", g_prefix);
			}
				
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}
	   
		case 3:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostHealthCT))
			{			 
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostHealthCT));
				set_user_health(id, get_user_health(id) + get_pcvar_num(g_pCvarQuantityHealthCT));
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3%d HP^1!", g_prefix, get_pcvar_num(g_pCvarQuantityHealthCT));
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 4:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostHE))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostHE));
				give_item(id, "weapon_hegrenade");
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat un ^3HE^1!", g_prefix);
			}

			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 5:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostFlash))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostFlash));
				give_item(id, "weapon_flashbang");
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat un ^3Flash^1!", g_prefix);
			}
					
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 6:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSmoke))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSmoke));
				give_item(id, "weapon_smokegrenade");
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat un ^3Smoke^1!", g_prefix);
			}
				
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 7:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSuperM249))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperM249));
				give_item(id, "weapon_m249");
				cs_set_user_bpammo(id, CSW_M249, 200);
				g_bHasSuperM249[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super M249^1!", g_prefix);
			}
				
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}

		case 8:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSuperAWP))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperAWP));
				give_item(id, "weapon_awp");
				cs_set_user_bpammo(id, CSW_AWP, 30);
				g_bHasSuperAWP[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super AWP^1!", g_prefix);
			}
			
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}	
		
		case 9:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostSuperDeagle))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostSuperDeagle));
				give_item(id, "weapon_deagle");
				cs_set_user_bpammo(id, CSW_DEAGLE, 35);
				g_bHasSuperDeagle[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Super Deagle^1!", g_prefix);
			}
			
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}	

		case 10:
		{
			if ( iMoney >= get_pcvar_num(g_pCvarCostKitGuns))
			{
				cs_set_user_money(id, iMoney - get_pcvar_num(g_pCvarCostKitGuns));
				give_item(id, "weapon_deagle");
				give_item(id, "weapon_m4a1");
				give_item(id, "weapon_hegrenade");
				cs_set_user_bpammo(id, CSW_DEAGLE, 35);
				cs_set_user_bpammo(id, CSW_M4A1, 90);
				g_bHasGunsKit[id] = true;
				client_print_color(id, DontChange, "^4%s ^1Ai cumparat ^3Kit Guns^1!", g_prefix);
			}
			
			else
			{
				client_print_color(id, DontChange, "^4%s ^1Nu ai destui ^3Bani^1!", g_prefix);
			}
		}		
	}
	menu_destroy(menu2);
	return PLUGIN_HANDLED;
}
 
public Player_Spawn_Post( id )
{
	if(is_user_alive(id))
	{
		client_print(id, print_chat, "Tasteaza /shop pentru a-ti iteme!");
		g_bHasSuperKnife[id] = false;
		g_bHasSuperSpeed[id] = false;
		g_bHasSuperM249[id] = false;
		g_bHasSuperAWP[id] = false;
		g_bHasSuperDeagle[id] = false;
		g_bHasGunsKit[id] = false;
	}
}
 
public client_disconnect(id)
{
	g_bHasSuperKnife[id] = false;
	g_bHasSuperSpeed[id] = false;
	g_bHasSuperM249[id] = false;
	g_bHasSuperAWP[id] = false;
	g_bHasSuperDeagle[id] = false;
	g_bHasGunsKit[id] = false;
}
 
 
public plugin_precache()
{
	precache_model(g_ModelSuperKnife);
	precache_model(g_ModelSuperDeagle);
}
 
public ham_TakeDamage_Pre(victim, inflictor, attacker, Float:damage, damage_bits)
{
	if( !IsPlayer( attacker ) || !is_user_alive( attacker ) || inflictor != attacker )
	{
		return;
	}

	if ( g_bHasSuperKnife[attacker] && get_user_weapon(attacker) == CSW_KNIFE )
	{
		SetHamParamFloat( 4, damage * 231 );
	}
	
	if ( g_bHasSuperM249[attacker] && get_user_weapon(attacker) == CSW_M249 )
	{
		SetHamParamFloat( 4, damage * 2 );
	}
	
	if ( g_bHasSuperAWP[attacker] && get_user_weapon(attacker) == CSW_AWP )
	{
		SetHamParamFloat( 4, damage * 2 );
	}
	
	if ( g_bHasSuperDeagle[attacker] && get_user_weapon(attacker) == CSW_DEAGLE )
	{
		SetHamParamFloat( 4, damage * 4 );
	}
	
	if ( g_bHasGunsKit[attacker] && ( get_user_weapon(attacker) == CSW_M4A1 || CSW_DEAGLE ) )
	{
		SetHamParamFloat( 4, damage * 2 );
	}  
}
 
 
public ham_ItemDeploy_Post_KNI(weapon_ent)
{
	static owner;
	owner = get_pdata_cbase(weapon_ent, 41, 4);

	if(is_user_alive(owner) && g_bHasSuperKnife[owner])
	{
		set_pev(owner, pev_viewmodel2, g_ModelSuperKnife);
	}
}

public ham_ItemDeploy_Post_DGL(weapon_ent)
{
	static owner;
	owner = get_pdata_cbase(weapon_ent, 41, 4);

	if(is_user_alive(owner) && ( g_bHasSuperDeagle[owner] || g_bHasGunsKit[owner] ) )
	{
		set_pev(owner, pev_viewmodel2, g_ModelSuperDeagle);
	}
}

public Player_ResetMaxSpeed(id)
{
	if( is_user_alive(id) && get_user_maxspeed(id) !=  -1.0 && g_bHasSuperSpeed[id])
	{
		set_user_maxspeed(id, get_pcvar_float(g_pCvarQuantitySpeed));
	}
}

stock const g_szTeamName[Colors][] = 
{
	"UNASSIGNED",
	"TERRORIST",
	"CT",
	"SPECTATOR"
};

stock client_print_color(id, iColor=DontChange, const szMsg[], any:...)
{
	if( id && !is_user_connected(id) )
	{
		return 0;
	}

	if( iColor > Grey )
	{
		iColor = DontChange;
	}

	new szMessage[192];
	if( iColor == DontChange )
	{
		szMessage[0] = 0x04;
	}
	else
	{
		szMessage[0] = 0x03;
	}

	new iParams = numargs();

	if(id)
	{
		if( iParams == 3 )
		{
			copy(szMessage[1], charsmax(szMessage)-1, szMsg);
		}
		else
		{
			vformat(szMessage[1], charsmax(szMessage)-1, szMsg, 4);
		}

		if( iColor )
		{
			new szTeam[11];
			get_user_team(id, szTeam, charsmax(szTeam));

			Send_TeamInfo(id, id, g_szTeamName[iColor]);
			Send_SayText(id, id, szMessage);
			Send_TeamInfo(id, id, szTeam);
		}
		else
		{
			Send_SayText(id, id, szMessage);
		}
	} 
	return 1;
}

stock Send_TeamInfo(iReceiver, iPlayerId, szTeam[])
{
	static iTeamInfo = 0;
	if( !iTeamInfo )
	{
		iTeamInfo = get_user_msgid("TeamInfo");
	}
	message_begin(iReceiver ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, iTeamInfo, .player=iReceiver);
	write_byte(iPlayerId);
	write_string(szTeam);
	message_end();
}

stock Send_SayText(iReceiver, iPlayerId, szMessage[])
{
	static iSayText = 0;
	if( !iSayText )
	{
		iSayText = get_user_msgid("SayText");
	}
	message_begin(iReceiver ? MSG_ONE_UNRELIABLE : MSG_BROADCAST, iSayText, .player=iReceiver);
	write_byte(iPlayerId);
	write_string(szMessage);
	message_end();
}
User avatar
FlyingSnow
Membru, skill +2
Membru, skill +2
Posts: 825
Joined: 01 Oct 2012, 02:22
Detinator Steam: Da
Detinator server CS: Dap.
SteamID: Nu-i public.
Has thanked: 26 times
Been thanked: 52 times
Contact:

15 Jul 2013, 13:31

Testeaza | Afiseaza codul
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <fun>
#include <csx>

// Plugin Version
new VERSION[]="6.4"
new formatmodname[] = "^x01 [^x04 Base Builder Orizont^x01 ]"

//Models
new const g_ZombieModel1[] = "orizont_zombie"

//Sounds
new g_RoundStart[] = "basebuilder/round_start.wav"
new g_ZombKill1[] = "basebuilder/zombie_kill1.wav"

new g_WinZomb[] = "basebuilder/zombies_win.wav"
new g_WinHum[] = "basebuilder/humans_win.wav"

#define AFTER_BUILD ADMIN_LEVEL_A
#define DEAD_BUILD ADMIN_LEVEL_B
#define REMOVE_BLOCK ADMIN_LEVEL_C
#define DEAD_REMOVE ADMIN_LEVEL_D
#define LOCK_BLOCKS ADMIN_LEVEL_E
#define PAIN_SHOCK_FREE ADMIN_KICK
#define BAD_SPAWN ADMIN_KICK
#define BUILD_BAN ADMIN_KICK
#define REVIVE ADMIN_BAN
#define SWAP ADMIN_KICK
#define START_ROUND ADMIN_BAN
#define RESET ADMIN_BAN
#define MEMBERSHIP ADMIN_LEVEL_E
#define ADMIN_GUNS ADMIN_KICK
#define ADMIN_RESET ADMIN_BAN

#define BUILD_TASK 10000
#define MODELSET_TASK 20000

#define MAX_PLAYERS 32
#define AMMO_SLOT 376
#define MODELCHANGE_DELAY 0.5
#define MAXENTS 1365
#define AUTO_TEAM_JOIN_DELAY 0.1
#define TEAM_SELECT_VGUI_MENU_ID 2

#if cellbits == 32
    #define OFFSET_BUYZONE 235
#else
    #define OFFSET_BUYZONE 268
#endif

#define LockBlock(%1)     ( entity_set_int( %1, EV_INT_iuser1, 1 ) )
#define UnlockBlock(%1)   ( entity_set_int( %1, EV_INT_iuser1, 0 ) )
#define IsBlockLocked(%1) ( entity_get_int( %1, EV_INT_iuser1 ) == 1 )

// CS Weapon CBase Offsets (win32)
const OFFSET_WEAPONOWNER = 41
// Linux diff's
const OFFSET_LINUX_WEAPONS = 4

new gmsgStatusText, gmsgSayText
new gHudSyncInfo, g_MaxPlayers, g_ModName[32]
const fPainShock = 108

new bool:g_CanBuild, bool:g_ZombiesReleased
new g_RoundNum, count_down, g_iEntBarrier
new bool:g_BuildBan[MAX_PLAYERS+1]
new g_pEnt[MAX_PLAYERS+1], Float:g_pDist[MAX_PLAYERS+1], bool:g_MovingEnt[MAXENTS], g_EntMover[MAXENTS],
	g_LastMover[MAXENTS], g_EntOwner[MAXENTS], bool:g_InvisEnt[MAXENTS], g_OwnedEnts[MAX_PLAYERS+1]
new CsTeams:g_pTeam[MAX_PLAYERS+1], CsTeams:g_pCurTeam[MAX_PLAYERS+1]
new g_CurrentWeapon[MAX_PLAYERS+1], g_PrimaryWeapon[MAX_PLAYERS+1], Float:MaxHP[MAX_PLAYERS+1]

//Cached Stuff for Players
new g_isconnected[MAX_PLAYERS+1], g_isalive[MAX_PLAYERS+1], g_isbot[MAX_PLAYERS+1],
	g_iszombie[MAX_PLAYERS+1], g_friend[MAX_PLAYERS+1]

//Custom Model Stuff
new Float:g_ModelsTargetTime, Float:g_RoundStartTime
new g_HasCustomModel[MAX_PLAYERS+1], g_PlayerModel[MAX_PLAYERS+1][32]

// Allowed weapons for zombies
const ZOMBIE_ALLOWED_WEAPONS_BITSUM = (1<<CSW_KNIFE)

//CVARS
new g_pcvar_buildtime, g_pcvar_zombiehp, g_pcvar_maxrounds, g_pcvar_basecalc, g_pcvar_resetent,
	g_pcvar_showmovers, g_pcvar_knockback, g_pcvar_allowedweps, g_pcvar_givenades,
	g_pcvar_entmindist, g_pcvar_entsetdist, g_pcvar_entmaxdist, g_pcvar_maxclaimable,
	g_pcvar_claimable, g_pcvar_zresptime

new g_fwRoundStart, g_fwGrabEnt, g_fwDropEnt, g_fwNewGameStart, g_fwGameStart, g_fwSwapTeams
new g_fwiFakeReturn
	
//CSDM-Style Weapons Menu
new bool:firsttime[MAX_PLAYERS+1]
new weapon_picked[2][MAX_PLAYERS+1],cur_offset[MAX_PLAYERS+1],options_on_menu[8][MAX_PLAYERS+1]

//Weapon Names (For Guns Menu)
static const WEAPONNAMES[24][23] = { "\ySchmidt Scout", "\yXM1014 M4", "\yIngram MAC-10", "\ySteyr AUG A1", "\yUMP 45", "\ySG-550 Auto-Sniper",
			"\yIMI Galil", "\yFamas", "\yAWP Magnum Sniper", "\yMP5 Navy", "\yM249 Para Machinegun", "\yM3 Super 90", "\yM4A1 Carbine",
			"\ySchmidt TMP", "\yG3SG1 Auto-Sniper", "\ySG-552 Commando", "\yAK-47 Kalashnikov", "\yES P90", "\yP228 Compact",
			"\yDual Elite Berettas", "\yFiveseven", "\yUSP .45 ACP Tactical", "\yGlock 18C", "\yDesert Eagle .50 AE"
}

// Weapon entity names
new const WEAPONENTNAMES[][] = { "", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10",
			"weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550",
			"weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249",
			"weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552",
			"weapon_ak47", "weapon_knife", "weapon_p90" }

public plugin_init()
{
	register_plugin("Base Builder Zombie Mod", VERSION, "Tirant")
	register_cvar("base_builder", VERSION, FCVAR_SPONLY|FCVAR_SERVER)
	set_cvar_string("base_builder", VERSION)
	
	//Basic mod functions/timers
	g_pcvar_buildtime = register_cvar("bb_build_time", "150.0")
	g_pcvar_zombiehp = register_cvar("bb_zombie_health", "3000.0")
	g_pcvar_basecalc = register_cvar("bb_calc_maxbase", "0")
	g_pcvar_showmovers = register_cvar("bb_show_moving", "1")
	g_pcvar_knockback = register_cvar("bb_pain_shock_free", "0")
	g_pcvar_entmaxdist = register_cvar("bb_max_move_dist", "960")
	g_pcvar_entmindist = register_cvar("bb_min_move_dist", "25")
	g_pcvar_entsetdist = register_cvar("bb_min_dist_set", "50")
	g_pcvar_resetent = register_cvar("bb_reset_blocks", "1")
	g_pcvar_maxclaimable = register_cvar("bb_claim_max", "999")
	g_pcvar_claimable = register_cvar("bb_claim_mode", "1")
	g_pcvar_zresptime = register_cvar("bb_zombie_respawn_time", "2.0")
	
	//Guns Menu
	g_pcvar_givenades = register_cvar("bb_give_nades","hs") 	//h f s, put multiple letters for multiple nades
	g_pcvar_allowedweps = register_cvar("bb_weapons","abcdeghijlmnqrstuvwx")
	
	register_dictionary("basebuilder.txt");
	
	//Client Commands
	register_clcmd("+grab","cmdMoveEnt") 							//command to move stuff around
	register_clcmd("-grab","cmdStopEnt") 							//command to move stuff around
	
	register_clcmd("say", "cmdSay",0, "<target> ")
	register_clcmd("say_team", "cmdSay",0, "<target> ")

	//Admin Commands
	register_concmd("removeaim","cmdRemoveEnt",0," - Deletes an object") 			//Removes an object (C alive, D dead)
	register_concmd("lockaim","cmdLockBlock",0," - Locks/Unlocks an object form moving")
	register_concmd("unclaimaim","cmdRemoveClaim",0," - Removes a claim on an object")	//Makes block claimable by everyone
	register_concmd("resetaim","cmdResetAim",0," - Resets an object")
	
	register_concmd("bb_buildban","cmdBuildBan",0,"<player>") 				//Bans targeted player from building
	register_concmd("bb_unbuildban","cmdBuildUnban",0,"<player>") 				//Unbans   "	   "     "     "
	register_concmd("bb_revive","cmdRevive",0,"<player>")
	register_concmd("bb_guns","cmdGiveGuns",0,"<player>")					//revives targetted player
	register_concmd("bb_swap","cmdSwap",0,"<player>")					//swaps the selected player to the opposite team
	register_concmd("bb_startround","cmdStartRound",0," - Ends the build phase")		//do i really have to explain this?
	register_concmd("bb_reset","cmdResetEnts",0," - Resets all entities")
	register_concmd("bb_clear","cmdClearEnts",0," - Deleted all unused entities")
	
	//Blocked Commands
	register_clcmd("drop", "clcmd_drop")
	register_clcmd("buy", "clcmd_buy")
	
	register_forward(FM_GetGameDescription, "fw_GetGameDescription")
	register_forward(FM_SetClientKeyValue, "fw_SetClientKeyValue")
	register_forward(FM_ClientUserInfoChanged, "fw_ClientUserInfoChanged")
	register_forward(FM_PlayerPreThink, "fw_Player_PreThink")
	if (get_pcvar_num(g_pcvar_showmovers) == 1)
		register_forward(FM_TraceLine, "fw_Traceline")
	
	RegisterHam(Ham_Touch, "weapon_shield", "ham_WeaponCleaner_Post", 1)
	RegisterHam(Ham_Touch, "weaponbox", "ham_WeaponCleaner_Post", 1)
	RegisterHam(Ham_Spawn, "player", "ham_PlayerSpawn_Post", 1)
	RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage")
	RegisterHam(Ham_TakeDamage, "player", "ham_TakeDamage_Post", 1)
	for (new i = 1; i < sizeof WEAPONENTNAMES; i++)
		if (WEAPONENTNAMES[0]) RegisterHam(Ham_Item_Deploy, WEAPONENTNAMES, "ham_ItemDeploy_Post", 1)
	
	register_message(get_user_msgid("TextMsg"), "msgRoundEnd")
	register_message(get_user_msgid("StatusIcon"), "msgStatusIcon")
	register_message(get_user_msgid("StatusValue"), "msgStatusValue");
	register_message(get_user_msgid("Health"), "msgHealth");
	register_message(get_user_msgid("ScoreAttrib"), "msgScoreAttrib")
	
	register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
	register_event("AmmoX", "ev_AmmoX", "be", "1=1", "1=2", "1=3", "1=4", "1=5", "1=6", "1=7", "1=8", "1=9", "1=10")
	register_event("StatusValue", "ev_SetTeam", "be", "1=1");
	register_event("StatusValue", "ev_ShowStatus", "be", "1=2", "2!0");
	register_event("StatusValue", "ev_HideStatus", "be", "1=1", "2=0");
	register_event("Health", "ev_Health", "be", "1>0");
	
	register_logevent("logevent_round_start",2, "1=Round_Start")
	register_logevent("logevent_round_end", 2, "1=Round_End")
	
	register_menucmd(register_menuid("WeaponMethodMenu"),(1<<0)|(1<<1)|(1<<2),"weapon_method_pushed")
	register_menucmd(register_menuid("PrimaryWeaponSelect"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"prim_weapons_pushed")
	register_menucmd(register_menuid("SecWeaponSelect"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7),"sec_weapons_pushed")
	
	set_msg_block(get_user_msgid("ClCorpse"), BLOCK_SET)
	
	//Formats the Mod Name
	formatex(g_ModName, charsmax(g_ModName), "Base Builder %s", VERSION)
	
	gmsgSayText = get_user_msgid("SayText")
	gmsgStatusText = get_user_msgid("StatusText");
	gHudSyncInfo = CreateHudSyncObj();
	g_MaxPlayers = get_maxplayers();

	g_fwNewGameStart = CreateMultiForward("bb_new_round",ET_IGNORE)
	g_fwGameStart = CreateMultiForward("bb_timer_started",ET_IGNORE)
	g_fwRoundStart = CreateMultiForward("bb_zombies_released",ET_IGNORE)
	g_fwSwapTeams = CreateMultiForward("bb_teams_swapped",ET_IGNORE)
	g_fwGrabEnt = CreateMultiForward("bb_ent_grabbed",ET_IGNORE, FP_CELL, FP_CELL)
	g_fwDropEnt = CreateMultiForward("bb_ent_dropped",ET_IGNORE, FP_CELL, FP_CELL)
	
	server_cmd("sv_skyname dust")
	server_cmd("mp_freezetime 0")
	server_cmd("mp_flashlight 0")

	register_clcmd("chooseteam", "clcmd_changeteam")
	register_clcmd("jointeam", "clcmd_changeteam")
	register_message(get_user_msgid("ShowMenu"), "message_show_menu")
	register_message(get_user_msgid("VGUIMenu"), "message_vgui_menu")
	server_cmd("mp_limitteams 1")
	server_cmd("mp_autoteambalance 1")

	g_iEntBarrier = find_ent_by_tname( -1, "barrier" );
}

public plugin_precache()
{
	engfunc(EngFunc_PrecacheSound, g_RoundStart)
	engfunc(EngFunc_PrecacheSound, g_ZombKill1)
	engfunc(EngFunc_PrecacheSound, g_WinZomb)
	engfunc(EngFunc_PrecacheSound, g_WinHum)
	
	new szModel[64];
	formatex(szModel, charsmax(szModel), "models/player/%s/%s.mdl", g_ZombieModel1, g_ZombieModel1 );
	engfunc(EngFunc_PrecacheModel, szModel)
	
	new iBomb = create_entity("info_bomb_target");
	entity_set_origin(iBomb, Float:{8192.0,8192.0,8192.0})
	
	new iBuyZone = create_entity("info_map_parameters");
	DispatchKeyValue(iBuyZone, "buying", "3");
	DispatchSpawn(iBuyZone);
	
	g_pcvar_maxrounds = get_cvar_num("mp_maxrounds")
}

// Event Round Start (This is before freeze time)
public event_round_start()
{
	arrayset(g_MovingEnt, false, MAXENTS)
	arrayset(g_EntOwner, 0, MAXENTS)
	arrayset(g_LastMover, 0, MAXENTS)
	arrayset(g_OwnedEnts, 0, MAX_PLAYERS+1)
	
	g_RoundStartTime = get_gametime()
	g_ZombiesReleased = false
	
	if (get_pcvar_num(g_pcvar_resetent) == 1)
	{
		new cname[10], tname[7];
		for (new iEnt = g_MaxPlayers+1; iEnt < MAXENTS; iEnt++)
		{
			if (is_valid_ent(iEnt))
			{
				entity_get_string(iEnt, EV_SZ_classname, cname, 9);
				entity_get_string(iEnt, EV_SZ_targetname, tname, 6);
				if (!IsBlockLocked(iEnt) && iEnt != g_iEntBarrier && equal(cname, "func_wall") && !equal(tname, "ignore"))
				{
					if (g_InvisEnt[iEnt])
					{
						set_pev(iEnt,pev_solid,SOLID_BSP)
						set_pev(iEnt,pev_renderamt,Float:{255.0})
						set_pev(iEnt,pev_rendermode,0)
						g_InvisEnt[iEnt] = false
					}
					engfunc( EngFunc_SetOrigin, iEnt, Float:{ 0.0, 0.0, 0.0 } );
				}
			}
		}
	}
	ExecuteForward(g_fwNewGameStart, g_fwiFakeReturn)
}

// Log Event Round Start (This is AFTER freeze time)
public logevent_round_start()
{
	g_CanBuild = true
	
	set_pev(g_iEntBarrier,pev_solid,SOLID_BSP)
	set_pev(g_iEntBarrier,pev_rendermode,1)
	set_pev(g_iEntBarrier,pev_renderamt,Float:{150.0})
	
	set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 10.0, 0.1, 0.2, 1)
	new nLen, szMsg[128]
	nLen += format( szMsg[nLen], 127-nLen, "%L", LANG_SERVER, "WELCOME_MSG", VERSION);
	nLen += format( szMsg[nLen], 127-nLen, "%L", LANG_SERVER, "BIND_KEY");
	show_hudmessage(0, szMsg);
	
	print_color(0, "%s %s ^x04- ^x01%L", formatmodname, VERSION, LANG_SERVER, "ROUND_MSG")
	print_color(0, "%s Round: %d of %d", formatmodname, (g_RoundNum+1), g_pcvar_maxrounds)
	
	remove_task(BUILD_TASK)
	
	set_task(1.0, "CountDown", BUILD_TASK,_, _, "a", get_pcvar_num(g_pcvar_buildtime));
	count_down = (get_pcvar_num(g_pcvar_buildtime)-1);
	
	if (get_pcvar_num(g_pcvar_basecalc) == 1)
		set_task(5.0, "Base_Calc")
	
	ExecuteForward(g_fwGameStart, g_fwiFakeReturn)
}

public CountDown()
{
	count_down--
	new mins = count_down/60
	new secs = count_down%60
	if (count_down>=0)
	{
		client_print(0, print_center, "Timp de constructie - %d:%s%d", mins, (secs < 10 ? "0" : ""), secs)
	}
	
	if (mins != 0 && secs == 0)
	{
		new mmin[32]
		num_to_word(mins, mmin, 31)
		
		client_cmd(0, "spk ^"fvox/%s minutes remaining^"", mmin)
	}
	else if (mins == 0 && secs == 30)
	{
		new msec[32]
		num_to_word(secs, msec, 31)

		client_cmd(0, "spk ^"fvox/%s seconds remaining^"",  msec)
	}
	if (0<count_down<=10)
	{
		new msec[32]
		num_to_word(count_down, msec, 31)
		
		client_cmd(0, "spk ^"fvox/%s^"", msec)
	}
		
	if (count_down == 0)
	{
		Release_Zombies()
		remove_task(BUILD_TASK);
	}
}

public logevent_round_end()
{
	if (!g_CanBuild)
	{
		new players[32], num, player
		get_players(players, num)
		for (new i = 0; i < num; i++)
		{
			player = players
			
			if (g_pCurTeam[player] == g_pTeam[player])
				cs_set_user_team(player, (g_pTeam[player] = (g_pTeam[player] == CS_TEAM_T ? CS_TEAM_CT : CS_TEAM_T))) 
			else
				g_pTeam[player] = g_pTeam[player] == CS_TEAM_T ? CS_TEAM_CT : CS_TEAM_T
		}
		print_color(0, "^x04%L", LANG_SERVER, "TEAMS_SWAPPED")
		ExecuteForward(g_fwSwapTeams, g_fwiFakeReturn)
	}
	
	remove_task(BUILD_TASK)
		
	return PLUGIN_HANDLED
}

public client_death(g_attacker, g_victim, wpnindex, hitplace, TK)
{
	if (g_pEnt[g_victim])
		cmdStopEnt(g_victim)
		
	set_hudmessage(_, _, _, _, _, _, _, _, _, _, 4);
	show_hudmessage(g_victim, "");
	
	g_isalive[g_victim] = false
	
	if (TK == 0 && g_attacker != g_victim)
	{
		if (g_iszombie[g_attacker])
		{
			client_cmd(0, "spk %s", g_ZombKill1)
			new playername[35]
			get_user_name(g_victim, playername, 34)
			set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 5.0, 0.1, 0.2, 1)
			show_hudmessage(0, "%L",LANG_SERVER, "DEAD_ANNOUNCE", playername);
		}
	}
	
	if (g_iszombie[g_victim])
	{
		set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 10.0, 0.1, 0.2, 1)
		show_hudmessage(g_victim, "%L", LANG_SERVER, "DEAD_ZOMBIE", get_pcvar_num(g_pcvar_zresptime));
		set_task(get_pcvar_float(g_pcvar_zresptime), "Respawn_Zombie", g_victim)
	}
	if (!g_iszombie[g_victim])
	{
		set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 10.0, 0.1, 0.2, 1)
		show_hudmessage(g_victim, "%L", LANG_SERVER, "DEAD_SURVIVOR");
		cs_set_user_team(g_victim, cs_get_user_team(g_victim) == CS_TEAM_T ? CS_TEAM_CT:CS_TEAM_T)
		g_iszombie[g_victim] = true
		set_task(5.0, "Respawn_Zombie", g_victim)
	}
}

public ham_TakeDamage_Post(victim, inflictor, attacker, Float:damage, bits)
{
	if(get_pcvar_num(g_pcvar_knockback) == 1 && access(victim, PAIN_SHOCK_FREE) && g_iszombie[victim])
	{
		set_pdata_float(victim, fPainShock, 1.0, 5)
	}
}

public ham_TakeDamage(victim, inflictor, attacker, Float:damage, damagebits)
{
	if (!g_isalive[victim] || !g_isconnected[attacker]) return HAM_IGNORED
	
	if(g_CanBuild || victim == attacker)
		return HAM_SUPERCEDE
		
	return HAM_HANDLED
}

public client_disconnect(id)
{
	cmdStopEnt(id)

	g_isconnected[id] = false
	g_isalive[id] = false
	g_isbot[id] = false
	g_iszombie[id] = false
	
	return PLUGIN_CONTINUE
}

//Respawns late joiners, cts only if build time is still on
public client_putinserver(id)
{
	set_task(7.0,"Respawn_Human",id);
	g_isconnected[id] = true
	firsttime[id] = true

	// Set bot flag
	if (is_user_bot(id))
		g_isbot[id] = true
}

public Release_Zombies()
{
	g_CanBuild = false
	g_ZombiesReleased = true
	remove_task(BUILD_TASK);
	
	new weapon[32]
	new he, flash, smoke
	get_pcvar_string(g_pcvar_givenades,weapon,31)
	for(new i=0;i<strlen(weapon);i++)
	{
		switch(weapon)
		{
			case 'h': he++
			case 'f': flash++
			case 's': smoke++
		}
	}
	
	new players[32], num
	get_players(players, num)

	new player
	for(new i = 0; i < num; i++)
	{
		player = players
		if (g_isalive[player])
		{
			if (!g_iszombie[player])
			{
				cmdStopEnt(player)

				if(he) give_item(player,"weapon_hegrenade"), cs_set_user_bpammo(player,CSW_HEGRENADE,he)
				if(flash) give_item(player,"weapon_flashbang"), cs_set_user_bpammo(player,CSW_FLASHBANG,flash)
				if(smoke) give_item(player,"weapon_smokegrenade"), cs_set_user_bpammo(player,CSW_SMOKEGRENADE,smoke)

				if (g_PrimaryWeapon[player])
				{
					get_weaponname(g_PrimaryWeapon[player],weapon,31)
					engclient_cmd(player, weapon);
				}
			}
		}
	}
			
	set_pev(g_iEntBarrier,pev_solid,SOLID_NOT)
	set_pev(g_iEntBarrier,pev_renderamt,Float:{0.0})
	
	g_RoundNum++
	set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 10.0, 0.1, 0.2, 1)
	show_hudmessage(0, "%L", LANG_SERVER, "RELEASE_MSG");
	client_cmd(0, "spk %s", g_RoundStart)
	
	ExecuteForward(g_fwRoundStart,g_fwiFakeReturn)
}

//Called on zombie death function
public Respawn_Zombie(id)
{
	if (g_isconnected[id] && cs_get_user_team(id) == CS_TEAM_T)
	{
		if (get_user_health(id) ==MaxHP[id] || !is_user_alive(id))
			ExecuteHamB(Ham_CS_RoundRespawn, id)
		else
			client_print(id, print_center, "%L", LANG_SERVER, "FAIL_RESPAWN");
	}
}

//Called on al pllayers for late joiners, parent is above
public Respawn_Human(id)
{
	if (!g_isconnected[id] || g_isalive[id] || cs_get_user_team(id) == CS_TEAM_SPECTATOR || cs_get_user_team(id) == CS_TEAM_UNASSIGNED)
		return PLUGIN_HANDLED
		
	if (!g_isalive[id] && g_iszombie[id])
		ExecuteHamB(Ham_CS_RoundRespawn, id)
				
	if (!g_isalive[id] && g_iszombie[id])
		set_task(3.0,"Respawn_Human",id)
			
	if (g_CanBuild)
	{
		if (!g_isalive[id])
			ExecuteHamB(Ham_CS_RoundRespawn, id)
				
		if (!g_isalive[id])
			set_task(3.0,"Respawn_Human",id)
	}
	return PLUGIN_HANDLED
}

//Sets player health and weapons
public Add_Effects(id)
{
	if (!g_isconnected[id] || !g_isalive[id])
		return PLUGIN_HANDLED
	
	strip_user_weapons(id)
	give_item(id, "weapon_knife")
	
	if (g_iszombie[id])
	{
		MaxHP[id] = get_pcvar_float(g_pcvar_zombiehp)
		set_pev(id, pev_health, MaxHP[id]) // use decimal number
	}
	else
	{
		weapon_method_menu(id)
		MaxHP[id] = 100.0
	}
	ev_Health(id)
	return PLUGIN_HANDLED
}

//AmmoX Ensures BackPack ammo is always full
public ev_AmmoX(id)
{
	set_pdata_int(id, AMMO_SLOT + read_data(1), 200, 5)
} 

//Sets the "Game" description ie. Counter-Strike, in our case Base Builder
public fw_GetGameDescription()
{
	// Return the mod name so it can be easily identified
	forward_return(FMV_STRING, g_ModName)
	
	return FMRES_SUPERCEDE;
}

/*-------------------------------------------------------------------------------------------------|
|----------------------------------Begin Player Model Code---[0005]--------------------------------|
|-------------------------------------------------------------------------------------------------*/

public ham_PlayerSpawn_Post(id)
{
	if (!is_user_alive(id))
		return
	
	g_isalive[id] = true
	g_pCurTeam[id] = cs_get_user_team(id)
	g_iszombie[id] = g_pCurTeam[id] == CS_TEAM_T ? true : false
	
	Add_Effects(id)
	remove_task(id + MODELSET_TASK)
	if (g_iszombie[id])
	{
		copy(g_PlayerModel[id], charsmax(g_PlayerModel[]), g_ZombieModel1)
		new currentmodel[32]
		fm_get_user_model(id, currentmodel, charsmax(currentmodel))
		if (!equal(currentmodel, g_PlayerModel[id]))
		{
			if (get_gametime() - g_RoundStartTime < 5.0)
				set_task(5.0 * MODELCHANGE_DELAY, "fm_user_model_update", id + MODELSET_TASK)
			else
				fm_user_model_update(id + MODELSET_TASK)
		}
	}
	else if (g_HasCustomModel[id])
	{
		fm_reset_user_model(id)
	}
}

public fw_SetClientKeyValue(id, const infobuffer[], const key[])
{   
	if (g_HasCustomModel[id] && equal(key, "model"))
		return FMRES_SUPERCEDE
	return FMRES_IGNORED
}

public fw_ClientUserInfoChanged(id)
{
	if (!g_HasCustomModel[id])
		return FMRES_IGNORED
	static currentmodel[32]
	fm_get_user_model(id, currentmodel, charsmax(currentmodel))
	if (!equal(currentmodel, g_PlayerModel[id]) && !task_exists(id + MODELSET_TASK))
		fm_set_user_model(id + MODELSET_TASK)
	return FMRES_IGNORED
}

public fm_user_model_update(taskid)
{
	static Float:current_time
	current_time = get_gametime()
	
	if (current_time - g_ModelsTargetTime >= MODELCHANGE_DELAY)
	{
		fm_set_user_model(taskid)
		g_ModelsTargetTime = current_time
	}
	else
	{
		set_task((g_ModelsTargetTime + MODELCHANGE_DELAY) - current_time, "fm_set_user_model", taskid)
		g_ModelsTargetTime = g_ModelsTargetTime + MODELCHANGE_DELAY
	}
}

public fm_set_user_model(player)
{
	player -= MODELSET_TASK
	engfunc(EngFunc_SetClientKeyValue, player, engfunc(EngFunc_GetInfoKeyBuffer, player), "model", g_PlayerModel[player])
	g_HasCustomModel[player] = true
}

stock fm_get_user_model(player, model[], len)
{
	engfunc(EngFunc_InfoKeyValue, engfunc(EngFunc_GetInfoKeyBuffer, player), "model", model, len)
}

stock fm_reset_user_model(player)
{
	g_HasCustomModel[player] = false
	dllfunc(DLLFunc_ClientUserInfoChanged, player, engfunc(EngFunc_GetInfoKeyBuffer, player))
}

/*-------------------------------------------------------------------------------------------------|
|------------------------------------End Player Model Code-----------------------------------------|
|-------------------------------------------------------------------------------------------------*/

/*-------------------------------------------------------------------------------------------------|
|----------------------------------Begin Entity Mover Code---[0004]--------------------------------|
|-------------------------------------------------------------------------------------------------*/
public cmdMoveEnt(id)
{
	if (g_BuildBan[id] == true)
		return PLUGIN_HANDLED
	
	if (g_iszombie[id] && !access(id, AFTER_BUILD))
      		return PLUGIN_HANDLED 
			
	if (!g_CanBuild && !access(id, AFTER_BUILD))
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_TIME_UP")
		return PLUGIN_HANDLED 
	}
	
	if (!g_isalive[id] && !access(id, DEAD_BUILD))
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_DEAD")
		return PLUGIN_HANDLED 
	}

	if (g_pEnt[id] && is_valid_ent(g_pEnt[id])) 
		cmdStopEnt(id)
	
	new ent, bodypart
	get_user_aiming (id,ent,bodypart)
	
	if (!is_valid_ent(ent) || ent == g_iEntBarrier)
	{
		return PLUGIN_HANDLED
	}
	
	if (ent <= g_MaxPlayers && g_isalive[ent])
	{	
		return PLUGIN_HANDLED
	}
		
	if (IsBlockLocked(ent) || g_MovingEnt[ent])
	{
		return PLUGIN_HANDLED
	}

	if (get_pcvar_num(g_pcvar_claimable) == 1)
	{
		if (!g_EntOwner[ent])
		{
			if ((g_OwnedEnts[id]<get_pcvar_num(g_pcvar_maxclaimable)) || get_pcvar_num(g_pcvar_maxclaimable) == 0)
			{
				g_EntOwner[ent] = id
				g_OwnedEnts[id]++
			}
			else
			{
				client_print (id, print_center, "%L", LANG_SERVER, "FAIL_MAXOWNED", get_pcvar_num(g_pcvar_maxclaimable))
			}
		}
		else if (g_EntOwner[ent] != id && !access(id, AFTER_BUILD))
		{
			client_print (id, print_center, "%L", LANG_SERVER, "FAIL_ALREADYOWNED")
			return PLUGIN_HANDLED 
		}
	}
	
	new tname[7], cname[10];
	entity_get_string(ent, EV_SZ_targetname, tname, 6);
	entity_get_string(ent, EV_SZ_classname, cname, 9);
	if (!equal(cname, "func_wall") || equal(tname, "ignore"))
	{
		return PLUGIN_HANDLED
	}
	
	new origin[3], Float:entOrigin[3], Float:orig[3], Float:mins[3], Float:maxs[3]
	
	entity_get_vector(ent, EV_VEC_origin, orig);
	entity_get_vector(ent, EV_VEC_mins, mins);
	entity_get_vector(ent, EV_VEC_maxs, maxs);

	entOrigin[0] = (mins[0] + maxs[0]) / 2.0 + orig[0];
	entOrigin[1] = (mins[1] + maxs[1]) / 2.0 + orig[1];
	entOrigin[2] = (mins[2] + maxs[2]) / 2.0 + orig[2];
	
	get_user_origin(id, origin);
	IVecFVec(origin, orig)

	g_pDist[id] = get_distance_f(orig, entOrigin);
	
	if (get_pcvar_num(g_pcvar_entmindist)) //maximum
	{
		if (g_pDist[id] < get_pcvar_float(g_pcvar_entmindist)) //minimum
			g_pDist[id] = get_pcvar_float(g_pcvar_entsetdist);
		/*if (g_pDist[id] < get_pcvar_float(g_pcvar_entminoffset))
		{
			g_pOffset[id][0] = orig[0] - entOrigin[0]
			g_pOffset[id][1] = orig[1] - entOrigin[1]
			g_pOffset[id][2] = orig[2] - entOrigin[2]
		}*/
	}

	if (get_pcvar_num(g_pcvar_entmaxdist)) //maximum
	{
		if (g_pDist[id] > get_pcvar_float(g_pcvar_entmaxdist))
			return PLUGIN_HANDLED
	}
	
	//set_pev(ent,pev_solid, SOLID_NOT)
	set_pev(ent,pev_rendermode,1)
	set_pev(ent,pev_renderamt,Float:{100.0})
	set_pev(ent,pev_rendercolor,Float:{135.0, 206.0, 235.0})

	g_MovingEnt[ent] = true
	g_EntMover[ent] = id
	g_pEnt[id] = ent

	ExecuteForward(g_fwGrabEnt,g_fwiFakeReturn, id, ent)
	
	if (!g_CanBuild && access(id, AFTER_BUILD))
	{
		new adminauthid[35],adminname[35]
		get_user_authid (id,adminauthid,34)
		get_user_name(id,adminname,34)
		Log("[MOVE] Admin: %s || SteamID: %s moved an entity", adminname, adminauthid)
	}
	
	return PLUGIN_HANDLED
}

public fw_Player_PreThink(id)
{
	if (!g_pEnt[id] || !is_valid_ent(g_pEnt[id]))
		return FMRES_HANDLED
		
	new buttons = pev(id, pev_button)
	if (buttons & IN_ATTACK)
	{
		g_pDist[id] += 3.0;
		
		if (g_pDist[id] > get_pcvar_float(g_pcvar_entmaxdist))
		{
			g_pDist[id] = get_pcvar_float(g_pcvar_entmaxdist)
			client_print(id, print_center, "%L", LANG_SERVER, "OBJECT_MAX")
		}
		else
			client_print(id, print_center, "%L", LANG_SERVER, "OBJECT_PUSH")
	}
	else if (buttons & IN_ATTACK2)
	{
		g_pDist[id] -= 3.0;
			
		if (g_pDist[id] < get_pcvar_float(g_pcvar_entsetdist))
		{
			g_pDist[id] = get_pcvar_float(g_pcvar_entsetdist)
			client_print(id, print_center, "%L", LANG_SERVER, "OBJECT_MIN")
		}
		else
			client_print(id, print_center, "%L", LANG_SERVER, "OBJECT_PULL")
	}
	
	new origin[3], Float:aiming[3], Float:pOrigin[3], Float:mins[3], Float:maxs[3], Float:neworigin[3]
	
	if (!g_isconnected[id] || (g_pEnt[id] <= g_MaxPlayers)? !g_isconnected[id]:!is_valid_ent(g_pEnt[id]))
	{
		cmdStopEnt(id)
		return PLUGIN_HANDLED
	}
	
	entity_get_vector(g_pEnt[id], EV_VEC_mins, mins);
	entity_get_vector(g_pEnt[id], EV_VEC_maxs, maxs);
	
	get_user_origin(id, origin, 3);
	IVecFVec(origin, aiming);
	get_user_origin(id, origin);
	IVecFVec(origin, pOrigin);
	
	aiming[0] -= pOrigin[0];
	aiming[1] -= pOrigin[1];
	aiming[2] -= pOrigin[2];

	new Float:scalar = g_pDist[id] / vector_length(aiming);
	
	IVecFVec(origin, neworigin);

	neworigin[0] += aiming[0] * scalar - (mins[0] + maxs[0]) / 2.0;
	neworigin[1] += aiming[1] * scalar - (mins[1] + maxs[1]) / 2.0;
	neworigin[2] += aiming[2] * scalar - (mins[2] + maxs[2]) / 2.0;
		
	entity_set_origin(g_pEnt[id], neworigin);
	
	return FMRES_HANDLED
}

public cmdStopEnt(id)
{
	new ent = g_pEnt[id]
	g_MovingEnt[ent] = false
	//set_pev(ent,pev_solid, SOLID_BSP)
	set_pev(ent,pev_rendermode,0)
	set_pev(ent,pev_renderamt,Float:{255.0})
	set_pev(ent,pev_rendercolor,Float:{0.0, 0.0, 0.0})

	ExecuteForward(g_fwDropEnt,g_fwiFakeReturn, id, ent)
	
	g_EntMover[ent] = 0
	g_LastMover[ent] = id
	g_pEnt[id] = 0
}

public fw_Traceline(Float:start[3], Float:end[3], conditions, id, trace)
{
	if (!is_user_alive(id))  return PLUGIN_HANDLED
	
	new ent = get_tr2(trace, TR_pHit)
	
	if (is_valid_ent(ent))
	{
		new ent,body
		get_user_aiming(id,ent,body)
		
		new cname[10], tname[7];
		entity_get_string(ent, EV_SZ_classname, cname, 9);
		entity_get_string(ent, EV_SZ_targetname, tname, 6);
		if (equal(cname, "func_wall") && !equal(tname, "ignore") && ent != g_iEntBarrier && get_pcvar_num(g_pcvar_showmovers) == 1)
		{
			if (g_CanBuild || access(id, ADMIN_KICK))
			{
				if (IsBlockLocked(ent))
				{
					set_hudmessage(255, 0, 0, -1.0, 0.55, 1, 0.01, 3.0, 0.01, 0.01);
					ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_LOCKED");
					return PLUGIN_HANDLED
				}
				set_hudmessage(0, 50, 255, -1.0, 0.55, 1, 0.01, 3.0, 0.01, 0.01);
				if (get_pcvar_num(g_pcvar_claimable) == 0)
				{
					new currentmover[35], lastmover[35]
					if (g_EntMover[ent])
					{
						get_user_name(g_EntMover[ent],currentmover,34)
						if (!g_LastMover[ent]) ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_INFO1", currentmover);
					}
					if (g_LastMover[ent])
					{
						get_user_name(g_LastMover[ent],lastmover,34)
						if (!g_EntMover[ent]) ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_INFO2", lastmover);
					}
					if (g_LastMover[ent] && g_EntMover[ent]) ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_INFO3", currentmover, lastmover);
					else if (!g_LastMover[ent] && !g_EntMover[ent]) ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_INFO4");
				}
				else
				{
					if (g_EntOwner[ent])
					{
						new entowner[35]
						get_user_name(g_EntOwner[ent],entowner,34)
						ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_OWNER", entowner);
					}
					else 
					{
						ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "OBJECT_OWNER_NONE");
					}
				}
			}
		}
	}
	else ClearSyncHud(id, gHudSyncInfo);
	
	return PLUGIN_HANDLED
}

public cmdLockBlock(id)
{
	if (!access(id, LOCK_BLOCKS))
		return PLUGIN_HANDLED
		
	new ent, bodypart
	get_user_aiming (id,ent,bodypart)
	
	new tname[7], cname[10];
	entity_get_string(ent, EV_SZ_targetname, tname, 6);
	entity_get_string(ent, EV_SZ_classname, cname, 9);

	if (!ent || !is_valid_ent(ent) || is_user_alive(ent) || ent == g_iEntBarrier || !equal(cname, "func_wall") || equal(tname, "ignore")) return PLUGIN_HANDLED
	
	if (!IsBlockLocked(ent) && !g_MovingEnt[ent])
	{
		LockBlock(ent)
		set_pev(ent,pev_rendermode,1)
		set_pev(ent,pev_rendercolor,Float:{125.0, 0.0, 0.0})
		
		g_OwnedEnts[g_EntOwner[ent]]--
		g_EntOwner[ent] = 0
	}
	else if (IsBlockLocked(ent))
	{
		UnlockBlock(ent)
		set_pev(ent,pev_rendermode,0)
	}
	return PLUGIN_HANDLED
}

public cmdRemoveClaim(id)
{
	if (!access(id, LOCK_BLOCKS))
      		return PLUGIN_HANDLED 
		
	new ent, bodypart
	get_user_aiming (id,ent,bodypart)
	
	new tname[7], cname[10];
	entity_get_string(ent, EV_SZ_targetname, tname, 6);
	entity_get_string(ent, EV_SZ_classname, cname, 9);

	if (!ent || !is_valid_ent(ent) || is_user_alive(ent) || ent == g_iEntBarrier || !equal(cname, "func_wall") || equal(tname, "ignore") || IsBlockLocked(ent)) return PLUGIN_HANDLED

	g_OwnedEnts[g_EntOwner[ent]]--
	g_EntOwner[ent] = 0
	
	return PLUGIN_HANDLED
}

public cmdRemoveEnt(id)
{
	if (!access(id, REMOVE_BLOCK))
      		return PLUGIN_HANDLED 

	if (!g_isalive[id] && !access(id, DEAD_REMOVE))
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_REMOVE")
		return PLUGIN_HANDLED 
	}
      	
	new ent, bodypart
	get_user_aiming (id,ent,bodypart)
	
	if(!is_valid_ent(ent) || ent == g_iEntBarrier || (ent <= g_MaxPlayers && g_isalive[ent]))
		return PLUGIN_HANDLED
	
	if(IsBlockLocked(ent) || g_MovingEnt[ent])
		return PLUGIN_HANDLED

	new tname[7], cname[10];
	entity_get_string(ent, EV_SZ_targetname, tname, 6);
	entity_get_string(ent, EV_SZ_classname, cname, 9);
	if(!equal(cname, "func_wall"))
		return PLUGIN_HANDLED
	
	if(equal(tname, "ignore"))
		return PLUGIN_HANDLED
	
	g_OwnedEnts[g_EntOwner[ent]]--
	g_EntOwner[ent] = 0
	
	remove_entity(ent)
	
	new adminauthid[35],adminname[35]
	get_user_authid (id,adminauthid,34)
	get_user_name(id,adminname,34)
	Log("[REMOVE] Admin: %s || SteamID: %s removed an entity", adminname, adminauthid)
	
	return PLUGIN_HANDLED
}

public cmdResetEnts(id)
{
	if (!access(id, ADMIN_RESET))
		return PLUGIN_HANDLED
	
	new cname[10], tname[7];
	for (new iEnt = g_MaxPlayers+1; iEnt < MAXENTS; iEnt++)
	{
		if (is_valid_ent(iEnt))
		{
			entity_get_string(iEnt, EV_SZ_classname, cname, 9);
			entity_get_string(iEnt, EV_SZ_targetname, tname, 6);
			if (!IsBlockLocked(iEnt) && iEnt != g_iEntBarrier && equal(cname, "func_wall") && !equal(tname, "ignore"))
				engfunc( EngFunc_SetOrigin, iEnt, Float:{ 0.0, 0.0, 0.0 } );
		}
	}
	
	new adminauthid[35],adminname[35]
	get_user_authid (id,adminauthid,34)
	get_user_name(id,adminname,34)
	Log("[RESET-ENTS] Admin: %s || SteamID: %s reset the entities", adminname, adminauthid)
	
	return PLUGIN_HANDLED
}

public cmdResetAim(id)
{
	if (!access(id, ADMIN_RESET))
      		return PLUGIN_HANDLED 

	new ent, bodypart
	get_user_aiming (id,ent,bodypart)
	
	if(!is_valid_ent(ent) || ent == g_iEntBarrier || (ent <= g_MaxPlayers && g_isalive[ent]))
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_RESET")
		return PLUGIN_HANDLED
	}
	
	if(IsBlockLocked(ent) || g_MovingEnt[ent])
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_RESET")
		return PLUGIN_HANDLED
	}

	new tname[7], cname[10];
	entity_get_string(ent, EV_SZ_targetname, tname, 6);
	entity_get_string(ent, EV_SZ_classname, cname, 9);
	if(!equal(cname, "func_wall") || equal(tname, "ignore"))
	{
		client_print (id, print_center, "%L", LANG_SERVER, "FAIL_RESET")
		return PLUGIN_HANDLED
	}
	
	engfunc( EngFunc_SetOrigin, ent, Float:{ 0.0, 0.0, 0.0 } );
	
	new adminauthid[35],adminname[35], targetauthid[35],targetname[35]
	get_user_authid (id,adminauthid,34)
	get_user_name(id,adminname,34)
	get_user_authid(g_EntOwner[ent],targetauthid,34)
	get_user_name(g_EntOwner[ent],targetname,34)
	Log("[REMOVE] Admin: %s || SteamID: %s reset a block belonging to Player: %s || SteamID: %s", adminname, adminauthid, targetauthid, targetname)
	
	g_OwnedEnts[g_EntOwner[ent]]--
	g_EntOwner[ent] = 0
	
	return PLUGIN_HANDLED
}


public cmdClearEnts(id)
{
	if (!access(id, ADMIN_RESET))
		return PLUGIN_HANDLED
	
	new cname[10], tname[7];
	for (new iEnt = g_MaxPlayers+1; iEnt < MAXENTS; iEnt++)
	{
		if (is_valid_ent(iEnt))
		{
			entity_get_string(iEnt, EV_SZ_classname, cname, 9);
			entity_get_string(iEnt, EV_SZ_targetname, tname, 6);
			if (!IsBlockLocked(iEnt) && iEnt != g_iEntBarrier && equal(cname, "func_wall") && !equal(tname, "ignore") && !g_LastMover[iEnt])
			{
				set_pev(iEnt,pev_solid,SOLID_NOT)
				set_pev(iEnt,pev_rendermode,1)
				set_pev(iEnt,pev_renderamt,Float:{0.0})
				g_InvisEnt[iEnt] = true
			}
		}
	}
	
	new adminauthid[35],adminname[35]
	get_user_authid (id,adminauthid,34)
	get_user_name(id,adminname,34)
	Log("[CLEAR-ENTS] Admin: %s || SteamID: %s reset the entities", adminname, adminauthid)
	
	return PLUGIN_HANDLED
}

/*-------------------------------------------------------------------------------------------------|
|------------------------------------End Entity Mover Code-----------------------------------------|
|-------------------------------------------------------------------------------------------------*/

// Ham Weapon Deploy Forward (forces knife only)
public ham_ItemDeploy_Post(weapon_ent)
{
	static owner
	owner = get_pdata_cbase(weapon_ent, OFFSET_WEAPONOWNER, OFFSET_LINUX_WEAPONS);
	
	static weaponid
	weaponid = cs_get_weapon_id(weapon_ent)
	
	g_CurrentWeapon[owner] = weaponid
	
	if (g_iszombie[owner] && !((1<<weaponid) & ZOMBIE_ALLOWED_WEAPONS_BITSUM))
	{
		g_CurrentWeapon[owner] = CSW_KNIFE
		engclient_cmd(owner, "weapon_knife")
	}
	else if (g_CanBuild && !g_iszombie[owner])
	{
		g_CurrentWeapon[owner] = CSW_KNIFE
		engclient_cmd(owner, "weapon_knife")
		client_print(owner, print_center, "%L", LANG_SERVER, "FAIL_KNIFE_ONLY");
	}
}

public msgRoundEnd(const MsgId, const MsgDest, const MsgEntity)
{
	static Message[192]
	get_msg_arg_string(2, Message, 191)
	
	set_hudmessage(255, 255, 255, -1.0, 0.40, 0, 6.0, 6.0, 0.1, 0.2, 1)
	
	if(equal(Message, "#Game_bomb_drop"))
		return PLUGIN_HANDLED
	
	if (equal(Message, "#Terrorists_Win"))
	{
		show_hudmessage(0, "Zombies Win!")
		set_msg_arg_string(2, "")
		client_cmd(0, "spk %s", g_WinZomb)
	}
	else if (equal(Message, "#Target_Saved") || equal(Message, "#CTs_Win"))
	{
		show_hudmessage(0, "Builders Win!")
		set_msg_arg_string(2, "")
		client_cmd(0, "spk %s", g_WinHum)
	}
	return PLUGIN_HANDLED
}

public ham_WeaponCleaner_Post(iEntity)
{
	call_think(iEntity)
}

/*-------------------------------------------------------------------------------------------------|
|----------------------------Begin Auto Join on Connect Code----[0003]-----------------------------|
|-------------------------------------------------------------------------------------------------*/

public message_show_menu(msgid, dest, id) 
{
	if (!(!get_user_team(id) && !g_isbot[id] && !access(id, ADMIN_IMMUNITY)))//
		return PLUGIN_CONTINUE

	static team_select[] = "#Team_Select"
	static menu_text_code[sizeof team_select]
	get_msg_arg_string(4, menu_text_code, sizeof menu_text_code - 1)
	if (!equal(menu_text_code, team_select))
		return PLUGIN_CONTINUE

	static param_menu_msgid[2]
	param_menu_msgid[0] = msgid
	set_task(AUTO_TEAM_JOIN_DELAY, "task_force_team_join", id, param_menu_msgid, sizeof param_menu_msgid)

	return PLUGIN_HANDLED
}

public message_vgui_menu(msgid, dest, id) 
{
	if (get_msg_arg_int(1) != TEAM_SELECT_VGUI_MENU_ID || !(!get_user_team(id) && !g_isbot[id] && !access(id, ADMIN_IMMUNITY)))// 
		return PLUGIN_CONTINUE
		
	static param_menu_msgid[2]
	param_menu_msgid[0] = msgid
	set_task(AUTO_TEAM_JOIN_DELAY, "task_force_team_join", id, param_menu_msgid, sizeof param_menu_msgid)

	return PLUGIN_HANDLED
}

public task_force_team_join(menu_msgid[], id) 
{
	if (get_user_team(id))
		return

	static msg_block
	msg_block = get_msg_block(menu_msgid[0])
	set_msg_block(menu_msgid[0], BLOCK_SET)
	engclient_cmd(id, "jointeam", "5")
	engclient_cmd(id, "joinclass", "5")
	set_msg_block(menu_msgid[0], msg_block)
	
	g_pTeam[id] = cs_get_user_team(id)
	g_pCurTeam[id] = cs_get_user_team(id)
}

/*-------------------------------------------------------------------------------------------------|
|----------------------------End Auto Join on Connect Code-----------------------------------------|
|-------------------------------------------------------------------------------------------------*/

public clcmd_changeteam(id)
{
	if (!access(id, ADMIN_IMMUNITY))
	{
		if (g_iszombie[id])
			client_print (id, print_center, "%L", LANG_SERVER, "FAIL_ZOMBIE")
		else if (g_CanBuild) 
			weapon_method_menu(id)
		else 
			client_print (id, print_center, "%L", LANG_SERVER, "FAIL_WEAPONS")
			
		return PLUGIN_HANDLED
	}
	return PLUGIN_CONTINUE
}

public clcmd_drop(id)
{
	client_print (id, print_center, "%L", LANG_SERVER, "FAIL_DROP")
	return PLUGIN_HANDLED
}

public clcmd_buy(id)
{
	client_print (id, print_center, "%L", LANG_SERVER, "FAIL_BUY")
	return PLUGIN_HANDLED
}

public Base_Calc()
{
	new players[32], num, ct, basenum
	get_players(players, num)
	new player
	for(new i = 0; i < num; i++)
	{
		player = players
		if (cs_get_user_team(player) == CS_TEAM_CT)
			ct++

		if (ct < 6)
			basenum = 2
		else
			basenum = (ct/3)
	}
	print_color(0, "%s %L", formatmodname, LANG_SERVER, "BASE_CALC", basenum)
}

public Fix_Spawns()
{
	new players[32], num
	get_players(players, num)
			
	new player
	for(new i = 0; i < num; i++)
	{
		player = players
		if (cs_get_user_team(player) == CS_TEAM_CT && !is_user_alive(player) && g_isconnected[player] && g_CanBuild)
			ExecuteHamB(Ham_CS_RoundRespawn, player)
	}
}

public msgScoreAttrib(msgid, dest, id)
{
	static attrib 
	attrib = get_msg_arg_int(2)
	
	if(attrib == (1<<1))
		set_msg_arg_int(2, ARG_BYTE, 0)
}

public msgStatusIcon(const iMsgId, const iMsgDest, const iPlayer)
{
	if(g_isalive[iPlayer] && g_isconnected[iPlayer]) 
	{
		static szMsg[8]
		get_msg_arg_string(2, szMsg, 7)
    
    		if (szMsg[0] == 'c' && szMsg[1] == '4') return PLUGIN_HANDLED
		else return PLUGIN_CONTINUE
    
		if(equal(szMsg, "buyzone"))
		{
			set_pdata_int(iPlayer, OFFSET_BUYZONE, get_pdata_int(iPlayer, OFFSET_BUYZONE) & ~(1<<0))
			return PLUGIN_HANDLED
		}
	}
	return PLUGIN_CONTINUE
} 

/*public fw_CreateNamedEntity(entclassname)
{
	static classname[10]
	engfunc(EngFunc_SzFromIndex, entclassname, classname, 9)
	
	return (classname[7] == 'c' && classname[8] == '4') ? FMRES_SUPERCEDE : FMRES_IGNORED
}*/

public cmdBuildBan(id)
{
	if (access(id, BUILD_BAN))
	{
		new arg[32]
		read_argv(1, arg, 31)
		new player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)
		g_BuildBan[player] = true
		cmdStopEnt(player)
		
		new adminauthid[35],adminname[35],playername[35],playerauthid[35]
		get_user_name(id,adminname,34)
		get_user_authid (id,adminauthid,34)
		get_user_name(player, playername, 34)
		get_user_authid (player,playerauthid,34)
		Log("[MOVE] Admin: %s || SteamID: %s banned Player: %s || SteamID: %s from building", adminname, adminauthid, playername, playerauthid)
		
		client_print(id, print_console, "%L", LANG_SERVER, "BUILD_BAN1", playername)
		client_print(player, print_center, "%L", LANG_SERVER, "BUILD_BAN2")
	}
}

public cmdBuildUnban(id)
{
	if (access(id, BUILD_BAN))
	{
		new arg[32], playername[35]
	
		read_argv(1, arg, 31)
		new player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)
		get_user_name(player, playername, 34)
		client_print(id, print_console, "%L", LANG_SERVER, "UNBUILD_BAN1", playername)
		g_BuildBan[player] = false
		print_color(player, "%s %L", formatmodname, LANG_SERVER, "UNBUILD_BAN2")
	}
}

public cmdRevive(id)
{
	if (access(id, REVIVE))
	{
		new arg[32]
		read_argv(1, arg, 31)
		new player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)

		if (is_user_alive(player))
		{
			client_print(id, print_console, "%L", LANG_SERVER, "FAIL_REVIVE")
			return PLUGIN_HANDLED
		}
		
		ExecuteHamB(Ham_CS_RoundRespawn, player)
		
		new adminauthid[35],adminname[35],playername[35],playerauthid[35]
		get_user_name(id,adminname,34)
		get_user_authid (id,adminauthid,34)
		get_user_name(player, playername, 34)
		get_user_authid (player,playerauthid,34)
		Log("[REVIVE] Admin: %s || SteamID: %s revived Player: %s || SteamID: %s", adminname, adminauthid, playername, playerauthid)
		
		client_print(id, print_console, "%L", LANG_SERVER, "REVIVE1", playername)
		client_print(player, print_center, "%L", LANG_SERVER, "REVIVE2")
	}
	return PLUGIN_HANDLED
}


public cmdGiveGuns(id)
{
	if (access(id, ADMIN_GUNS))
	{
		new arg[32]
		read_argv(1, arg, 31)
		new player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)
		
		new playername[35]
		get_user_name(player, playername, 34)
		
		if (g_isalive[player])
		{
			weapon_method_menu(player)
			
			client_print(id, print_console, "%L", LANG_SERVER, "GIVEGUNS1", playername)
			client_print(player, print_center, "%L", LANG_SERVER, "GIVEGUNS2")
		}
		else
		{
			client_print(id, print_console, "%L", LANG_SERVER, "GIVEGUNS3", playername)
		}
	}
	return PLUGIN_HANDLED
}

public cmdSwap(id)
{
	if (access(id, SWAP))
	{
		new arg[32]
		read_argv(1, arg, 31)
		new player = cmd_target(id, arg, CMDTARGET_ALLOW_SELF)

		if (!is_user_connected(player)) return PLUGIN_HANDLED
		
		cs_set_user_team(player, cs_get_user_team(player) == CS_TEAM_T ? CS_TEAM_CT:CS_TEAM_T)
			
		g_iszombie[id] = cs_get_user_team(id) == CS_TEAM_T ? true : false
		
		if (is_user_alive(player))
			ExecuteHamB(Ham_CS_RoundRespawn, player)
		
		new adminauthid[35],adminname[35],playername[35],playerauthid[35]
		get_user_name(id,adminname,34)
		get_user_authid (id,adminauthid,34)
		get_user_name(player, playername, 34)
		get_user_authid (player,playerauthid,34)
		Log("[TEAM-SWAP] Admin: %s || SteamID: %s swapped Player: %s || SteamID: %s", adminname, adminauthid, playername, playerauthid)
		
		client_print(id, print_console, "%L", LANG_SERVER, "SWAP1", playername)
		client_print(player, print_center, "%L", LANG_SERVER, "SWAP2")
	}
	return PLUGIN_HANDLED
}

public cmdStartRound(id)
{
	if (access(id, START_ROUND))
	{
		if (count_down<10)
		{
			client_print(id, print_console, "%L", LANG_SERVER, "FAIL_START_ROUND")
			return PLUGIN_HANDLED
		}
		
		Release_Zombies()
		
		new adminauthid[35],adminname[35]
		get_user_name(id,adminname,34)
		get_user_authid (id,adminauthid,34)
		Log("[START_ROUND] Admin: %s || SteamID: %s started the round", adminname, adminauthid)
		
		client_print(id, print_center, "%L", LANG_SERVER, "START_ROUND")
		client_print(id, print_chat, "^x04%L", LANG_SERVER, "START_ROUND")
	}
	return PLUGIN_HANDLED
}


public cmdSay(id)
{
	new arg[64], arg1[31], arg2[32]
	read_args(arg1, charsmax(arg1));
	remove_quotes(arg1);
	read_args(arg,63)
	remove_quotes(arg)
	strtok(arg,arg1,255,arg2,255,' ',1)
	trim(arg2)
	
	if(arg1[0] == '/')
	{
		if (equali(arg1, "/cmds") == 1 || equali(arg1, "/commands") == 1)
		{
			print_color(id, "%s /respawn, /fixspawn, /help, /round, /guns", formatmodname)
			if (access(id, ADMIN_KICK))
				print_color(id, "%s Admin: /fixspawns, /respawns, removeaim, lockaim, unclaimaim", formatmodname)
			return PLUGIN_HANDLED
		}

		if (equali(arg1, "/respawn") == 1 || equali(arg1, "/revive") == 1)
		{
			Respawn_Zombie(id)
			return PLUGIN_HANDLED
		}
		
		if (equali(arg1, "/fixspawn") == 1)
		{
			if (g_isconnected[id] && !g_iszombie[id] && g_CanBuild)
				ExecuteHamB(Ham_CS_RoundRespawn, id)
				
			return PLUGIN_HANDLED
		}
		if (equali(arg1, "/help") == 1 || equali(arg1, "/rules") == 1)
		{
			set_hudmessage(255, 255, 255, -1.0, 0.45, 0, 1.0, 15.0, 0.1, 0.2, 2)
			new nLen, szHelp[512]
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "WELCOME_MSG", VERSION);
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "BIND_KEY");
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "RULE1");
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "RULE2");
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "RULE3");
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "RULE4");
			nLen += format( szHelp[nLen], 511-nLen, "%L", LANG_SERVER, "RULE5");
			show_hudmessage(id, szHelp);
			
			return PLUGIN_HANDLED
		}

		if (equali(arg1, "/round") == 1)
		{
			if (g_ZombiesReleased) print_color(id, "%s Round: %d of %d", formatmodname, (g_RoundNum), g_pcvar_maxrounds)
			else if (!g_ZombiesReleased) print_color(id, "%s Round: %d of %d", formatmodname, (g_RoundNum+1), g_pcvar_maxrounds)
			
			return PLUGIN_HANDLED
		}
	
		if (equali(arg1, "/guns") == 1)
		{
			if(!g_isalive[id] || !g_isconnected[id] || g_iszombie[id])
				return PLUGIN_HANDLED
			
			if(!g_CanBuild && !access(id, ADMIN_GUNS))
				return PLUGIN_HANDLED	
		
			weapon_method_menu(id)
			
			return PLUGIN_HANDLED
		}
	
		if (equali(arg1, "/fixspawns") == 1 && access(id, BAD_SPAWN))
		{
			new players[32], num
			get_players(players, num)
				
			new player
			for(new i = 0; i < num; i++)
			{
				player = players
				if (cs_get_user_team(player) == CS_TEAM_CT && !is_user_alive(player) && g_isconnected[player] && g_CanBuild)
					ExecuteHamB(Ham_CS_RoundRespawn, player)
			}
			return PLUGIN_HANDLED
		}
		
		if (equali(arg1, "/respawns") == 1 && access(id, BAD_SPAWN))
		{
			new players[32], num
			get_players(players, num)
				
			new player
			for(new i = 0; i < num; i++)
			{
				player = players
				if (cs_get_user_team(player) == CS_TEAM_T && !is_user_alive(player) && g_isconnected[player])
					ExecuteHamB(Ham_CS_RoundRespawn, player)
			}
			return PLUGIN_HANDLED
		}
	}
	return PLUGIN_CONTINUE
}

/*-------------------------------------------------------------------------------------------------|
|----------------------------------Begin Status Text Code---[0006]---------------------------------|
|-------------------------------------------------------------------------------------------------*/
public msgStatusValue()
{
	//Block the name info, of person you aim at
	set_msg_block(gmsgStatusText, BLOCK_SET);
}

public ev_SetTeam(id)
{
	g_friend[id] = read_data(2)
}

public ev_ShowStatus(id) //called when id looks at someone
{
	new name[32], pid = read_data(2);
	
	get_user_name(pid, name, 31);
	new color1 = 0, color2 = 0;

	if (get_user_team(pid) == 1)
		color1 = 255;
	else
		color2 = 255;

	new Float:height=0.30
	//height=0.60

	if (g_friend[id] == 1)	// friend
	{
		new clip, ammo, wpnid = get_user_weapon(pid, clip, ammo);
		new wpnname[32];

		if (wpnid)
			xmod_get_wpnname(wpnid, wpnname, 31);

		set_hudmessage(color1, 50, color2, -1.0, height, 1, 0.01, 3.0, 0.01, 0.01);
		new nLen, szStatus[512]
		nLen += format( szStatus[nLen], 511-nLen, "%L", LANG_SERVER, "PLAYER_INFO1", name, get_user_health(pid), wpnname);
		ShowSyncHudMsg(id, gHudSyncInfo, szStatus);
	} 
	if (g_friend[id] != 1) //enemy
	{
		set_hudmessage(color1, 50, color2, -1.0, height, 1, 0.01, 3.0, 0.01, 0.01);
		ShowSyncHudMsg(id, gHudSyncInfo, "%L", LANG_SERVER, "PLAYER_INFO2", name);
	}
}

public ev_HideStatus(id)
{
	ClearSyncHud(id, gHudSyncInfo);
}
/*-------------------------------------------------------------------------------------------------|
|------------------------------------------End Player Model Code-----------------------------------|
|-------------------------------------------------------------------------------------------------*/

/*-------------------------------------------------------------------------------------------------|
|-------------------------------Begin Guns Menu Code-[0001]----------------------------------------|
|-------------------------------------------------------------------------------------------------*/

//Call this on player spawn
public weapon_method_menu(id)
{
	if(firsttime[id])
	{
		firsttime[id] = false
		prim_weapons_menu(id,0)
	}
	else
	{
		cur_offset[id] = 0
		show_menu(id,(1<<0)|(1<<1),"\rAlege-ti Armele^n^n\y1. \yArme noi^n\y2. \yVechile Arme",-1,"WeaponMethodMenu")
	}
}

public weapon_method_pushed(id,key)
{
	switch(key)
	{
		case 0: prim_weapons_menu(id,0)
		case 1: give_weapons(id)
	}
	return PLUGIN_HANDLED;
}

public prim_weapons_menu(id,offset)
{
	if(offset<0) offset = 0

	new cvar_value[32]
	get_pcvar_string(g_pcvar_allowedweps,cvar_value,31)
	new flags = read_flags(cvar_value)

	new keys, curnum, menu[2048]
	for(new i=offset;i<19;i++)
	{
		if(flags & power(2,i))
		{
			options_on_menu[curnum][id] = i
			keys += (1<<curnum)
	
			curnum++
			format(menu,2047,"%s^n%d. %s",menu,curnum,WEAPONNAMES)
	
			if(curnum==8)
			break;
		}
	}

	format(menu,2047,"\yArme:\w^n%s^n",menu)
	if(curnum==8 && offset<12)
	{
		keys += (1<<8)
		format(menu,2047,"%s^n9. Next",menu)
	}
	if(offset)
	{
		keys += (1<<9)
		format(menu,2047,"%s^n0. Back",menu)
	}

	show_menu(id,keys,menu,-1,"PrimaryWeaponSelect")
}

public prim_weapons_pushed(id,key)
{
	if(key<8)
	{
		weapon_picked[0][id] = options_on_menu[key][id]
		cur_offset[id] = 0
		sec_weapons_menu(id,0)
	}
	else
	{
		if(key==8)
			cur_offset[id] += 8
		if(key==9)
			cur_offset[id] -= 8
		prim_weapons_menu(id,cur_offset[id])
	}
	return ;
}

public sec_weapons_menu(id,offset)
{
	if(offset<0) offset = 0

	new cvar_value[32]
	get_pcvar_string(g_pcvar_allowedweps,cvar_value,31)
	new flags = read_flags(cvar_value)

	new keys, curnum, menu[2048]
	for(new i=18;i<24;i++)
	{
		if(flags & power(2,i))
		{
		options_on_menu[curnum][id] = i
		keys += (1<<curnum)

		curnum++
		format(menu,2047,"%s^n%d. %s",menu,curnum,WEAPONNAMES[i])
		}
	}

	format(menu,2047,"\yPistoale:\w^n%s",menu)

	show_menu(id,keys,menu,-1,"SecWeaponSelect")
}

public sec_weapons_pushed(id,key)
{
	if(key<8)
	{
		weapon_picked[1][id] = options_on_menu[key][id]
	}
	give_weapons(id)
	return ;
}

public give_weapons(id)
{
	strip_user_weapons(id)
	give_item(id,"weapon_knife")
   
	new weapon[32]
	new csw = csw_contant(weapon_picked[0][id])
	get_weaponname(csw,weapon,31)
	give_item(id,weapon)
	cs_set_user_bpammo(id,csw,999)
	g_PrimaryWeapon[id] = csw

	csw = csw_contant(weapon_picked[1][id])
	get_weaponname(csw,weapon,31)
	give_item(id,weapon)
	cs_set_user_bpammo(id,csw,999)
}

public csw_contant(weapon)
{
	new num = 29
	switch(weapon)
	{
		case 0: num = 3
		case 1: num = 5
		case 2: num = 7
		case 3: num = 8
		case 4: num = 12
		case 5: num = 13
		case 6: num = 14
		case 7: num = 15
		case 8: num = 18
		case 9: num = 19
		case 10: num = 20
		case 11: num = 21
		case 12: num = 22
		case 13: num = 23
		case 14: num = 24
		case 15: num = 27
		case 16: num = 28
		case 17: num = 30
		case 18: num = 1
		case 19: num = 10
		case 20: num = 11
		case 21: num = 16
		case 22: num = 17
		case 23: num = 26
		case 24:
		{
			new s_weapon[32]
		
			get_pcvar_string(g_pcvar_allowedweps,s_weapon,31)
		   
			new flags = read_flags(s_weapon)
			do
			{
				num = random_num(0,18)
				if(!(num & flags))
				{
					num = -1
				}
			}
			while(num==-1)
			num = csw_contant(num)
		}
		case 25:
		{
			new s_weapon[32]

			get_pcvar_string(g_pcvar_allowedweps,s_weapon,31)
		
			new flags = read_flags(s_weapon)
			do
			{
				num = random_num(18,23)
				if(!(num & flags))
				{
					num = -1
				}
			}
			while(num==-1)
			num = csw_contant(num)
		}
	}
	return num;
}

/*-------------------------------------------------------------------------------------------------|
|---------------------------------End Guns Menu Code-----------------------------------------------|
|-------------------------------------------------------------------------------------------------*/

public ev_Health(id)
{
	if (is_user_alive(id))
	{
		set_hudmessage(255, 255, 255, -1.0, 0.9, 0, 12.0, 12.0, 0.1, 0.2, 4);
		show_hudmessage(id, "%L", LANG_SERVER, "PLAYER_HEALTH", get_user_health(id));
		
		set_task(11.9, "ev_Health", id);
	}
}

public msgHealth(msgid, dest, id)
{
	if(!is_user_alive(id))
		return PLUGIN_CONTINUE;
	
	static hp;
	hp = get_msg_arg_int(1);
	
	if(hp > 255 && (hp % 256) == 0)
		set_msg_arg_int(1, ARG_BYTE, ++hp);
	
	return PLUGIN_CONTINUE;
}

Log(const message_fmt[], any:...)
{
	static message[256];
	vformat(message, sizeof(message) - 1, message_fmt, 2);
	
	static filename[96];
	static dir[64];
	if( !dir[0] )
	{
		get_basedir(dir, sizeof(dir) - 1);
		add(dir, sizeof(dir) - 1, "/logs");
	}
	
	format_time(filename, sizeof(filename) - 1, "%m-%d-%Y");
	format(filename, sizeof(filename) - 1, "%s/ADMIN_ACTIVITY_%s.log", dir, filename);
	
	log_to_file(filename, "%s", message);
}

print_color(target, const message[], any:...)
{
	static buffer[512], i, argscount
	argscount = numargs()
	
	// Send to everyone
	if (!target)
	{
		static player
		for (player = 1; player <= g_MaxPlayers; player++)
		{
			if (!g_isconnected[player])
				continue;

			static changed[5], changedcount
			changedcount = 0

			for (i = 2; i < argscount; i++)
			{
				if (getarg(i) == LANG_PLAYER)
				{
					setarg(i, 0, player)
					changed[changedcount] = i
					changedcount++
				}
			}
			vformat(buffer, charsmax(buffer), message, 3)

			message_begin(MSG_ONE_UNRELIABLE, gmsgSayText, _, player)
			write_byte(player)
			write_string(buffer)
			message_end()
			
			for (i = 0; i < changedcount; i++)
				setarg(changed[i], 0, LANG_PLAYER)
		}
	}
	// Send to specific target
	else
	{
		vformat(buffer, charsmax(buffer), message, 3)

		message_begin(MSG_ONE, gmsgSayText, _, target)
		write_byte(target)
		write_string(buffer)
		message_end()
	}
}


Testeaza iar :P.
User avatar
FlyingSnow
Membru, skill +2
Membru, skill +2
Posts: 825
Joined: 01 Oct 2012, 02:22
Detinator Steam: Da
Detinator server CS: Dap.
SteamID: Nu-i public.
Has thanked: 26 times
Been thanked: 52 times
Contact:

15 Jul 2013, 14:39

N-ai pentru ce :D :)
mIRr0r# =D
Membru, skill 0
Membru, skill 0
Posts: 45
Joined: 27 Apr 2013, 21:55
Detinator Steam: Nu
CS Status: BB.DEVILCS.RO
Has thanked: 10 times
Been thanked: 1 time
Contact:

15 Jul 2013, 18:30

flyngsnow ai putea sa-mi lasi id tau te rog sau sa dai add alexirimia14
Image
Server: (25:47) Bb.Proskill.Ro # BaseBuilder 6.5 , Cautam Admini
Ip: 95.64.36.30:27015
Name: PSR @ mIRr-0r.dll
Functie: Detinator + FTP
Rank/Top15: 1
User avatar
FlyingSnow
Membru, skill +2
Membru, skill +2
Posts: 825
Joined: 01 Oct 2012, 02:22
Detinator Steam: Da
Detinator server CS: Dap.
SteamID: Nu-i public.
Has thanked: 26 times
Been thanked: 52 times
Contact:

16 Jul 2013, 11:08

Post Reply

Return to “Cereri”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests