// * Info
// 	Name : Alien Wave
// 	Version      :  1.45
// 	Created by   : Bioko (alias Kal4nger)
// 	Release date : XX.03.2009
// 	Website : http://alienwave.comoj.com
// 	Copyrights (c) 2009 Biokoxo Studio (Bioko)
//
// PLEASE RESPECT THE WORK OF ALIEN WAVE
// TEAM BY DON'T EDITING THESE. THANK YOU :P
// Free to report all bugs to me, at bioko.xo@gmail.com
//
// *******************************************

block load
{
	es_setinfo es_alienwave_version v1.45
	es_makepublic es_alienwave_version

	es_setinfo aw_assaultalien_health 800
	es_setinfo aw_assaultalien_speed 1.3
	es_setinfo aw_supportalien_health 1500
	es_setinfo aw_supportalien_speed 1.1
	es_setinfo aw_reconalien_health 550
	es_setinfo aw_reconalien_speed 1.6
	es_setinfo aw_human_health 150
	es_setinfo aw_human_speed 1
	es_setinfo aw_alien_count 4
	es_setinfo aw_bots_leave_on_human_join 1
	es_setinfo aw_unlimited_ammo 0
	es_setinfo aw_cleaner 0

	es_setinfo napalm_oldnoisy server_var(eventscripts_noisy)
	es_setinfo eventscripts_noisy 1
	es_doblock corelib/noisy_on
	
	es_set amount 200
	es_setinfo auser 0
	es_set deadplayer 0
	es_set tempuserid 0
	es_set tempidteam 0
	es_set aw_alien_team 0
	es_set aw_aecu_team 0
	es_set aw_gamemode 0
	es_set aw_spawnmode 0
	
   es_setinfo napalm_oldnoisy server_var(eventscripts_noisy)
   es_setinfo eventscripts_noisy 1
   es_setinfo napalm_damage -15
   es_setinfo napalm_radius 250
	
	exec aw_downloadlist.cfg
	exec aw_alienwave.cfg
	
	mp_restartgame 5
	
	es_load popup

	es_xdoblock alienwave/powerpopup
	es_xdoblock alienwave/armorspopup
	es_xdoblock alienwave/arsenalpopup
	es_xdoblock alienwave/equipementpopup
	es_xdoblock alienwave/help_popup
	es_xdoblock alienwave/welcome_popup
	es_xdoblock alienwave/alienpopup

	repeat create end_round "es_xdoblock alienwave/endround"
	
	es_msg #green [AW] = Loading Alien Wave Mod (v1.45) =
	es_msg #green [AW] ...
	es_msg #green [AW] ...
	es_msg #green [AW] ...
	es_msg #green [AW] = Alien Wave Mod have been successfully loaded =
}

block unload
{
	es_xset amount 200
	es_xsetinfo auser 0
	es_xset deadplayer 0
	es_xset tempuserid 0
	es_xset tempidteam 0
	exec server.cfg
	mp_restartgame 5

	es_setinfo eventscripts_noisy server_var(napalm_oldnoisy)
	es_unload popup

	es_msg #green [AW] = Unloading Alien Wave Mod (v1.45) =
	es_msg #green [AW] ...
	es_msg #green [AW] ...
	es_msg #green [AW] ...
	es_msg #green [AW] = Alien Wave Mod have been succesfully unloaded =
}

event es_map_start
{
	net_maxfilesize 90
	phys_pushscale 3
	es_xsetinfo time_mapstart 0
	es_xgettime time_mapstart
	es_xforcevalue mp_buytime 4
	es_xforcevalue mp_roundtime 4
	es_xforcevalue mp_autoteambalance 1
	es mp_limitteams server_var(aw_alien_count)
	mp_dynamicpricing 0
	mp_flashlight 1
	mp_dynamicpricing 0
	mp friendlyfire 0
	mp_c4timer 50
	bot_defer_to_human 0
	bot_difficulty 3
	bot_join_after_player 1
	bot_quota_mode normal
	bot_auto_vacate 0
	bot_auto_follow 1
	bot_allow_rogues 1
	bot_eco_limit 16001
	bot_quota "32"
	bot_chatter off

	exec aw_downloadlist.cfg
	exec aw_alienwave.cfg

	if (de_ in server_var(eventscripts_currentmap)) do
	{
		es_xsetinfo aw_gamemode "demolition"
		es_xsetinfo aw_spawnmode "operation"
		es_xsetinfo aw_alien_team 3
		es_xsetinfo aw_aecu_team 2
		es_xforcevalue bot_join_team ct
		es_xforcevalue bot_join_team ct
		es_xforcevalue mp_humanteam t
	}
	else do
	{
		if (cs_ in server_var(eventscripts_currentmap)) do
		{
			es_xsetinfo aw_gamemode "extraction"
			es_xsetinfo aw_spawnmode "operation"
			es_xsetinfo aw_alien_team 2
			es_xsetinfo aw_aecu_team 3
			es_xforcevalue bot_join_team t
			es_xforcevalue mp_humanteam ct
		}
		else do
		{
			if (zm in server_var(eventscripts_currentmap)) do
			{
				es_xsetinfo aw_gamemode "contamination"
				es_xsetinfo aw_spawnmode "infection"
				es_xsetinfo aw_alien_team 2
				es_xsetinfo aw_aecu_team 3
				es_xforcevalue bot_join_team t
				es_xforcevalue mp_humanteam ct
			}
			else do
			{
				es_xsetinfo aw_gamemode "invasion"
				es_xsetinfo aw_spawnmode "operation"
				es_xsetinfo aw_alien_team 2
				es_xsetinfo aw_aecu_team 3
				es_xforcevalue bot_join_team t
				es_xforcevalue mp_humanteam ct
			}
		}
	}
}

event round_start
{
	if (server_var(aw_gamemode) equalto "demolition") do
	{
		es_delayed 1 es_centermsg =[ DESTROY THE TARGET ]=
		es_delayed 0.5 foreach player tempuserid #human "es_playsound server_var(tempuserid) alienwave/demolition_start_new.mp3 1.0"
		es_delayed 3 es_msg #multi #green[AW]#default Plant the bomb on the specify target and avoid to be killed !
		es_delayed 5 es_msg #multi #green[AW]#default Type #lightgreen!help#default if you need help. You are playing #lightgreenALIEN WAVE Mod#default created by #greenBIOKO#default. Our website #greenALIENWAVE.COMOJ.COM
	}
	
	if (server_var(aw_gamemode) equalto "extraction") do
	{
		es_delayed 1 es_centermsg =[ EXTRACT THE SURVIVORS ]=
		es_delayed 1.5 foreach player tempuserid #human "es_playsound server_var(tempuserid) alienwave/extraction_start_new.mp3 1.0"
		es_delayed 3 es_msg #multi #green[AW]#default There is few survivors in this sector, you must extract them before it's too late.
		es_delayed 5 es_msg #multi #green[AW]#default Type #lightgreen!help#default if you need help. You are playing #lightgreenALIEN WAVE Mod#default created by #greenBIOKO#default. Our website #greenALIENWAVE.COMOJ.COM
	}
	
	if (server_var(aw_gamemode) equalto "invasion") do
	{
		es_delayed 1 es_centermsg =[ FIGHT OR DIE ]=
		es_delayed 1.5 foreach player tempuserid #human "es_playsound server_var(tempuserid) alienwave/invasion_start.mp3 1.0"
		es_delayed 3 es_msg #multi #green[AW]#default Aliens are invading your sector ! You must keep this sector clean and try to kill many aliens as you can.
		es_delayed 5 es_msg #multi #green[AW]#default Type #lightgreen!help#default if you need help. You are playing #lightgreenALIEN WAVE Mod#default created by #greenBIOKO#default. Our website #greenALIENWAVE.COMOJ.COM
	}
	
	if (server_var(aw_gamemode) equalto "contamination") do
	{
		es_delayed 1 es_centermsg =[ SURVIVE UNTIL IT'S ENDING ]=
		es_delayed 1.5 foreach player tempuserid #human "es_playsound server_var(tempuserid) alienwave/demolition_start_new.mp3 1.0"
		es_delayed 3 es_msg #multi #green[AW]#default Aliens are invading your sector ! You must keep this sector clean and try to kill many aliens as you can.
		es_delayed 5 es_msg #multi #green[AW]#default Type #lightgreen!help#default if you need help. You are playing #lightgreenALIEN WAVE Mod#default created by #greenBIOKO#default. Our website #greenALIENWAVE.COMOJ.COM
	}
	
	es_xsetinfo randplay 0
	es_xrand randplay 1 14
	if (server_var(randplay) == 1) then es_delayed 29 foreach player tempuserid #human "es_playsound server_var(tempuserid) music/HL2_song2.mp3 1.0"
	if (server_var(randplay) == 2) then es_delayed 29 foreach player tempuserid #human "es_playsound server_var(tempuserid) music/HL2_song16.mp3 1.0"
	if (server_var(randplay) == 3) then es_delayed 29 foreach player tempuserid #human "es_playsound server_var(tempuserid) music/HL2_song14.mp3 1.0"
	if (server_var(randplay) == 4) then es_delayed 29 foreach player tempuserid #human "es_playsound server_var(tempuserid) music/HL2_song29.mp3 1.0"
	if (server_var(randplay) == 5) then es_delayed 29 foreach player tempuserid #human "es_playsound server_var(tempuserid) music/HL2_song20_submix4.mp3 1.0"
	if (server_var(randplay) == 6) then es_delayed 29 foreach player tempuserid #human "es_playsound server_var(tempuserid) music/HL2_song20_submix0.mp3 1.0"
	if (server_var(randplay) == 7) then es_delayed 29 foreach player tempuserid #human "es_playsound server_var(tempuserid) music/HL1_song17.mp3 1.0"
	if (server_var(randplay) == 8) then es_delayed 29 foreach player tempuserid #human "es_playsound server_var(tempuserid) music/HL1_song15.mp3 1.0"
	if (server_var(randplay) == 9) then es_delayed 29 foreach player tempuserid #human "es_playsound server_var(tempuserid) music/HL1_song25_remix3.mp3 1.0"
	if (server_var(randplay) == 10) then es_delayed 29 foreach player tempuserid #human "es_playsound server_var(tempuserid) music/HL2_song31.mp3 1.0"
	if (server_var(randplay) == 11) then es_delayed 29 foreach player tempuserid #human "es_playsound server_var(tempuserid) music/HL2_song1.mp3 1.0"
	if (server_var(randplay) == 12) then es_delayed 29 foreach player tempuserid #human "es_playsound server_var(tempuserid) music/HL2_song3.mp3 1.0"
	if (server_var(randplay) == 14) then es_delayed 29 foreach player tempuserid #human "es_playsound server_var(tempuserid) music/HL1_song10.mp3 1.0"

	if (server_var(aw_bots_leave_on_human_join) equalto 1) do bot_auto_vacate 1
	if (server_var(aw_unlimited_ammo) equalto 1) do eventscripts_noisy 1
}

event player_blind
{	
	es_setplayerprop event_var(userid) "CCSPlayer.m_flFlashDuration" 0
	es_setplayerprop event_var(userid) "CCSPlayer.m_flFlashMaxAlpha" 0
	
	if (event_var(es_userteam) equalto server_var(aw_alien_team)) do
	{
		es_setplayerprop event_var(userid) "CBasePlayer.m_fFlags" 32
		es_delayed 10 es_xsetplayerprop event_var(userid) "CBasePlayer.m_fFlags" 66177
	}
}

event weapon_fire
{
	if (server_var(aw_unlimited_ammo) equalto 1) do
	{
		es playerset ammo event_var(userid) event_var(weapon) 0
	}

   if (event_var(weapon) = "hegrenade") then es_xdelayed 0.1 es_xdoblock alienwave/props
}

event weapon_fire_on_empty
{
	if (server_var(aw_unlimited_ammo) equalto 1) do
	{
		es playerset clip event_var(userid) event_var(weapon) server_var(amount)
	}
}

event player_team
{
	es_delayed 10 est_spawn event_var(userid)
	
	if (event_var(team) > 1) do
	{
		if (event_var(oldteam) < 2) do
		{
			es popup send welcome_popup event_var(userid)
		}
	}
}

event player_spawn
{
	if (event_var(es_userteam) equalto server_var(aw_alien_team)) do
	{
		es_xsetinfo randskin 0
		es_xrand randskin 1 3

		if (server_var(randskin) == 1) do
		{
			es playerset model event_var(userid) "player/slow/aliendrone_v3/slow_alien"
			es playerset health event_var(userid) server_var(aw_assaultalien_health)
			es playerset speed event_var(userid) server_var(aw_assaultalien_speed)
			es_emitsound player event_var(userid) npc/fast_zombie/fz_scream1.wav 1.0 0.5
			es_tell event_var(userid) #multi #green[AW]#default You have spawned as an assault alien !
		}

		if (server_var(randskin) == 2) do
		{
			es playerset model event_var(userid) "player/elis/vd/verdugo"
			es playerset health event_var(userid) server_var(aw_reconalien_health)
			es playerset event_var(userid) server_var(aw_reconalien_speed)
			es_emitsound player event_var(userid) npc/fast_zombie/fz_scream1.wav 1.0 0.5
			es_tell event_var(userid) #multi #green[AW]#default You have spawned as a recon alien !
		}

		if (server_var(randskin) == 3) do
		{
			es playerset model event_var(userid) "player/slow/krall/slow"
			es playerset health event_var(userid) server_var(aw_supportalien_health)
			es playerset event_var(userid) server_var(aw_supportalien_speed)
			es_emitsound player event_var(userid) npc/zombie_poison/pz_call1.wav 1.0 0.5
			es_tell event_var(userid) #multi #green[AW]#default You have spawned as a support alien !
		}
		
		es es_setplayerprop event_var(userid) CBasePlayer.m_iDefaultFOV 360
		es usermsg shake event_var(userid) 15 4
		es popup send alienpopup event_var(userid)
		es est_stripplayer event_var(userid)
		es_give event_var(userid) weapon_knife
		es_give event_var(userid) item_nvgs
	}
	
	if (event_var(es_userteam) equalto server_var(aw_aecu_team)) do
	{
		es playerset health event_var(userid) server_var(aw_human_health)
		es playerset speed event_var(userid) server_var(aw_human_speed)
		es playerset model event_var(userid) "player/slow/nailgunner/slow.mdl"
		
		es_setplayerprop event_var(userid) CBasePlayer.m_iDefaultFOV 90
		es est_SetGravity event_var(userid) 1.0
		
		es popup send powermenu event_var(userid)
		es est_stripplayer event_var(userid)
		
		es_give event_var(userid) weapon_m4a1
		es_give event_var(userid) weapon_deagle
		es_give event_var(userid) weapon_knife
		es_give event_var(userid) weapon_hegrenade
		es_give event_var(userid) weapon_flashbang
		es give event_var(userid) item_nvgs
		es_give event_var(userid) item_assaultsuit

		if (de_ in server_var(eventscripts_currentmap)) do
		{
			es_give event_var(userid) weapon_c4
		}
	}

	if (server_var(aw_spawnmode) equalto "battle") do
	{
		est_deleteragdolls
	}

	if (server_var(aw_cleaner) equalto 1) do
	{
		est_deleteragdolls
	}
}

event player_say
{

	if (event_var(text) equalto "!help") do
	{
		es popup send help_popup event_var(userid)
	}
	
	if (event_var(text) equalto "!respawn") do
	{
		es_tell event_var(userid) #multi #green[AW]#default The spawnmode is set to#green server_var(aw_spawnmode)#default.
		es_tell event_var(userid) #multi #green[AW]#default #greenBattle#default = 5 secs before respawn for everyone
		es_tell event_var(userid) #multi #green[AW]#default #greenOperation#default = 30 secs before respawn for humans and 15 secs for Aliens
		es_tell event_var(userid) #multi #green[AW]#default #greenInfection#default = Humans spawn in the Alien Team and 20 secs before respawn for aliens
	}

	if (event_var(text) equalto "!health") do
	{
		if (event_var(es_userdead) == 0) do
		{
			es_tell event_var(userid) #multi #green[AW]#default Your current health is #green event_var(es_userhealth) hp.
		}
		else do
		{
			es_tell event_var(userid) #multi #green[AW]#default You cannot see how much you got HP because you are dead !
		}
	}
}

event round_freeze_end
{
	repeat start end_round 290 1
}

event player_hurt
{
	if (event_var(es_userteam) equalto server_var(aw_alien_team)) do
	{
		es_xsetinfo randplay 0
		es_xrand randplay 1 3
		if (server_var(randplay) == 1) then es_emitsound player event_var(userid) npc/headcrab/pain1.wav 1.0 0.5
		if (server_var(randplay) == 2) then es_emitsound player event_var(userid) npc/headcrab/pain2.wav 1.0 0.5
		if (server_var(randplay) == 3) then es_emitsound player event_var(userid) npc/headcrab/pain3.wav 1.0 0.5
		
        if (event_var(weapon) = "knife") do
		{
			if (event_var(es_attackerteam) notequalto event_var(es_userteam)) do
			{
				es_xsetinfo humansknifercash 0
				es_getplayerprop humansknifercash event_var(userid) "CCSPlayer.m_iAccount"
	            es_math humansknifercash + 50
			}
		}
		
		es_delayed 1 if (event_var(weapon) = "hegrenade") then es_fire event_var(userid) !self ignite
	}

	if (event_var(es_userteam) equalto server_var(aw_aecu_team)) do
	{
		es_xsetinfo randplay 0
		es_xrand randplay 1 3
		if (server_var(randplay) == 1) then es_emitsound player event_var(userid) npc/combine_soldier/pain1.wav 1.0 0.5
		if (server_var(randplay) == 2) then es_emitsound player event_var(userid) npc/combine_soldier/pain2.wav 1.0 0.5
		if (server_var(randplay) == 3) then es_emitsound player event_var(userid) npc/combine_soldier/pain3.wav 1.0 0.5
	}
}

event player_death
{
	if (event_var(es_userteam) equalto server_var(aw_alien_team)) do
	{
		es_xsetinfo randplay 0
		es_xrand randplay 1 2
		if (server_var(randplay) == 1) then es_emitsound player event_var(userid) npc/headcrab/die1.wav 1.0 0.5
		if (server_var(randplay) == 2) then es_emitsound player event_var(userid) npc/headcrab/die2.wav 1.0 0.5

		if (event_var(weapon) = "knife") do
		{
			if (event_var(es_attackerteam) notequalto event_var(es_userteam)) do
			{
				es_xset alien_knifer 0
				es_getplayername alien_knifer event_var(attacker)

				es_msg #multi #green[AW]#default Just LOL !!#lightgreen server_var(alien_knifer)#default killed the alien#lightgreen event_var(es_username)#default with a knife !!! GG
			}
		}

		if (server_var(aw_spawnmode) equalto "battle") do
		{
			es_delayed 5 est_spawn event_var(userid)
			es_tell event_var(userid) #multi #green[AW]#default You have been killed ! You will respawn in 5 sec !
		}
		if (server_var(aw_spawnmode) equalto "operation") do
		{
			es_delayed 15 est_spawn event_var(userid)
			es_tell event_var(userid) #multi #green[AW]#default You have been killed ! You will respawn in nearly 15 sec...
		}
		if (server_var(aw_spawnmode) equalto "infection") do
		{
			es_tell event_var(userid) #multi #green[AW]#default You have been killed ! You will respawn in nearly 20 sec...
			es_delayed 20 est_spawn event_var(userid)
		}
	}

	if (event_var(es_userteam) equalto server_var(aw_aecu_team)) do
	{
		es_xsetinfo randplay 0
		es_xrand randplay 1 4

		if (server_var(randplay) == 1) then es_emitsound player event_var(userid) npc/metropolice/die1.wav 1.0 0.5
		if (server_var(randplay) == 2) then es_emitsound player event_var(userid) npc/metropolice/die2.wav 1.0 0.5
		if (server_var(randplay) == 3) then es_emitsound player event_var(userid) npc/metropolice/die3.wav 1.0 0.5
		if (server_var(randplay) == 4) then es_emitsound player event_var(userid) npc/metropolice/die4.wav 1.0 0.5

		if (server_var(aw_spawnmode) equalto "battle") do
		{
			es_delayed 5 est_spawn event_var(userid)
			es_tell event_var(userid) #multi #green[AW]#default You have been killed ! You will respawn in 5 sec !
		}
		if (server_var(aw_spawnmode) equalto "operation") do
		{
			es_delayed 30 est_spawn event_var(userid)
			es_tell event_var(userid) #multi #green[AW]#default You have been killed ! You will respawn in 30 sec ...
		}
		if (server_var(aw_spawnmode) equalto "infection") do
		{
			es_tell event_var(userid) #multi #green[AW]#default You have been killed ! You will spawn as an alien...
			es est_team event_var(userid) server_var(aw_alien_team) 0
		}	
	}
}

event item_pickup
{
	if (event_var(es_userteam) equalto server_var(aw_alien_team)) do
	{
		if (event_var(item) notequalto "knife") do
		{
			es est_RemoveWeapon event_var(userid) 1
			es est_RemoveWeapon event_var(userid) 2
			es est_RemoveWeapon event_var(userid) 4
			es est_RemoveWeapon event_var(userid) 5
			es est_RemoveWeapon event_var(userid) 6
		}
	}
}

event round_end
{
	if (server_var(aw_gamemode) equalto "demolition") do
	{
		if (event_var(winner) equalto server_var(aw_alien_team)) do
		{
			es_centermsg =[ ALIENS WIN ]=
			es_msg #multi #green[AW]#default Aliens succed to protect the target from AECU bombing !
			es_delayed 0.1 foreach player tempuserid #human "es_playsound server_var(tempuserid) alienwave/aliens_won_new.mp3 1.0"
		}

		if (event_var(winner) equalto server_var(aw_aecu_team)) do
		{
			es_xcentermsg =[ AECU WIN ]=
			es_xmsg #multi #green[AW]#default The AECU has destroyed the target, aliens must now reply !
			es_delayed 0.1 foreach player tempuserid #human "es_playsound server_var(tempuserid) alienwave/aecu_won_new.mp3 1.0"
		}
	}
	else do
	{
		if (server_var(aw_gamemode) equalto "extraction") do
		{
			if (event_var(winner) equalto server_var(aw_alien_team)) do
			{
				es_centermsg =[ ALIENS WIN ]=
				es_msg #multi #green[AW]#default Aliens have succed to push back the AECU strike, no one know what they will do with the survivors !
				es_delayed 0.1 foreach player tempuserid #human "es_playsound server_var(tempuserid) alienwave/aliens_won_new.mp3 1.0"
			}

			if (event_var(winner) equalto server_var(aw_aecu_team)) do
			{
				es_xcentermsg =[ AECU WIN ]=
				es_xmsg #multi #green[AW]#default Survivors are ready for evacuate, the AECU won !
				es_delayed 0.1 foreach player tempuserid #human "es_playsound server_var(tempuserid) alienwave/aecu_won_new.mp3 1.0"
			}
		}
	}
	else do
	{
		if (server_var(aw_gamemode) equalto "invasion") do
		{
			if (event_var(winner) equalto server_var(aw_alien_team)) do
			{
				es_centermsg =[ ALIENS WIN ]=
				es_msg #multi #green[AW]#default There now any soldiers of the AECU in this area, aliens won !
				es_delayed 0.1 foreach player tempuserid #human "es_playsound server_var(tempuserid) alienwave/aliens_won_new.mp3 1.0"
			}
			
			if (event_var(winner) equalto server_var(aw_aecu_team)) do
			{
				es_xcentermsg =[ AECU WIN ]=
				es_xmsg #multi #green[AW]#default Aliens must reply and this position is now preserve from the Alien Wave, AECU won !
				es_delayed 0.1 foreach player tempuserid #human "es_playsound server_var(tempuserid) alienwave/aecu_won_new.mp3 1.0"
			}
		}
	}
	else do
	{
		if (server_var(aw_gamemode) equalto "contamination") do
		{
			if (event_var(winner) equalto server_var(aw_alien_team)) do
			{
				es_centermsg =[ ALIENS WIN ]=
				es_msg #multi #green[AW]#default There now any soldiers of the AECU in this area, aliens won !
				es_delayed 0.1 foreach player tempuserid #human "es_playsound server_var(tempuserid) alienwave/aliens_won_new.mp3 1.0"
			}
			
			if (event_var(winner) equalto server_var(aw_aecu_team)) do
			{
				es_xcentermsg =[ AECU WIN ]=
				es_xmsg #multi #green[AW]#default Aliens must reply and this position is now preserve from the Alien Wave, AECU won !
				es_delayed 0.1 foreach player tempuserid #human "es_playsound server_var(tempuserid) alienwave/aecu_won_new.mp3 1.0"
			}
		}
	}
	repeat stop end_round
}

block endround
{
	if (event_var(winner) equalto server_var(aw_aecu_team)) do
	{
		es_xcentermsg =[ AECU WIN ]=
		es_xmsg #multi #green[AW]#default Aliens must reply and this position is now preserve from the Alien Wave, AECU won !
		
		es_xdelayed 5.24 refcount increment sv_cheats 1
		es_xdelayed 5.25 endround
		es_xdelayed 5.26 refcount decrement sv_cheats 0
		
		es_delayed 0.1 foreach player tempuserid #human "es_playsound server_var(tempuserid) alienwave/aecu_won_new.mp3 1.0"
	}
}

block props
{
   es_fire event_var(userid) hegrenade_projectile ignite
   es_setinfo grenid 0
   es_getentityindex grenid hegrenade_projectile
   
   if (server_var(grenid) > 0 ) do
   {
      if (server_var(napalm_damage) notlessthan 0) then es_xsetindexprop server_var(grenid) "CBaseCSGrenadeProjectile.baseclass.m_flDamage" server_var(napalm_damage)
      if (server_var(napalm_radius) notlessthan 0) then es_xsetindexprop server_var(grenid) "CBaseCSGrenadeProjectile.baseclass.m_DmgRadius" server_var(napalm_radius)
   }
}

block powerpopup
{
	popup create powermenu
	popup addline powermenu "==[ AECU STOCK ]=="
	popup addline powermenu "->1. AECU Armors"
	popup addline powermenu "->2. AECU Arsenal"
	popup addline powermenu "->3. AECU Equipement"
	popup addline powermenu "->0. Exit"
	popup menuselect powermenu alienwave/powermenu
}
block powermenu
{
	if (server_var(_popup_choice) == 1) do
	{
		es popup send armorsmenu server_var(_popup_userid)
	}
	if (server_var(_popup_choice) == 2) do
	{
		es popup send assaultmenu server_var(_popup_userid)
	}
	if (server_var(_popup_choice) == 3) do
	{
		es popup send equipementmenu server_var(_popup_userid)
	}
}

block armorspopup
{
	popup create armorsmenu
	popup addline armorsmenu "==[ AECU ARMORS ]=="
	popup addline armorsmenu "->1. Veteran Armor (+ speed and 200 heatlh) - $3000"
	popup addline armorsmenu "->2. Elit Armor (++ speed and 300 health) - $6000"
	popup addline armorsmenu "->3. Commando Armor (+++ speed and 400 health) - $9000"
	popup addline armorsmenu "->4. Back"
	popup addline armorsmenu "->0. Exit"
	popup menuselect armorsmenu alienwave/armorsmenu
}

block armorsmenu
{
	if (server_var(_popup_choice) == 1) do
	{
        es_xsetinfo veteranarmorbuyercash 0
        es_getmoney veteranarmorbuyercash server_var(_popup_userid)
		
		if (server_var(veteranarmorbuyercash) >= 3000) do
		{
			es_math server_var(veteranarmorbuyercash) - 3000
			es playerset cashadd server_var(_popup_userid) -3000
			es_emitsound player server_var(_popup_userid) items\battery_pickup.wav 1.0 0.5
			es_tell server_var(_popup_userid) #multi #green[AW]#default You have purchased a#lightgreen Veteran Armor#default for#green $3000#default.	
			es playerset health server_var(_popup_userid) 200
			es playerset speed server_var(_popup_userid) 1.1
			es popup send powermenu server_var(_popup_userid)
		}
		
        else do
        {
            es_tell server_var(_popup_userid) #multi #green[AW]#default Sorry, but you need you need #green$3000#default.
			es_emitsound player server_var(_popup_userid) items\suitchargeno1.wav 1.0 0.5
			es popup send powermenu server_var(_popup_userid)
        }
	}
	
	if (server_var(_popup_choice) == 2) do
	{
        es_xsetinfo elitarmorbuyercash 0
		es_getplayerprop elitarmorbuyercash server_var(_popup_userid) "CCSPlayer.m_iAccount"

		if (server_var(elitarmorbuyercash) >= 6000) do
		{
			es_math server_var(elitarmorbuyercash) - 6000
			es playerset cashadd server_var(_popup_userid) -6000
			es_emitsound player server_var(_popup_userid) items\battery_pickup.wav 1.0 0.5
			es_tell server_var(_popup_userid) #multi #green[AW]#default You have purchased an#lightgreen Elit Armor#default for#green $6000#default.
			es playerset health server_var(_popup_userid) 300
			es playerset speed server_var(_popup_userid) 1.2
			es popup send powermenu server_var(_popup_userid)
		}
		
        else do
        {
            es_tell server_var(_popup_userid) #multi #green[AW]#default Sorry, but you need you need#green $9000#default.
			es_emitsound player server_var(_popup_userid) items\suitchargeno1.wav 1.0 0.5
			es popup send powermenu server_var(_popup_userid)
        }
	}
	
	if (server_var(_popup_choice) == 3) do
	{
        es_xsetinfo commandoarmorbuyercash 0
        es_getmoney commandoarmorbuyercash server_var(_popup_userid)
		
		if (server_var(commandoarmorbuyercash) >= 9000) do
		{
			es_math server_var(commandoarmorbuyercash) - 9000
			es playerset cashadd server_var(_popup_userid) -9000
			es_emitsound player server_var(_popup_userid) items\battery_pickup.wav 1.0 0.5
			es_tell server_var(_popup_userid) #multi #green[AW]#default You have purchased a#lightgreen Commando Armor#default for #green$9000#default.
			es playerset health server_var(_popup_userid) 400
			es playerset speed server_var(_popup_userid) 1.3
			es popup send powermenu server_var(_popup_userid)
		} 
		
        else do
        {
            es_tell server_var(_popup_userid) #multi #green[AW]#default Sorry, but you need you need #green$9000#default.
			es_emitsound player server_var(_popup_userid) items\suitchargeno1.wav 1.0 0.5
			es popup send powermenu server_var(_popup_userid)
        }
	}
	
	if (server_var(_popup_choice) == 4) do
	{
		es popup send powermenu server_var(_popup_userid)
	}
}

block arsenalpopup
{
	popup create assaultmenu
	popup addline assaultmenu "==[ AECU ARSENAL ]=="
	popup addline assaultmenu ">> ASSAULT CLASS <<"
	popup addline assaultmenu "->1. M4A1, Deagle"
	popup addline assaultmenu "->2. AK47, Deagle"
	popup addline assaultmenu "->3. AUG, Deagle"
	popup addline assaultmenu "->4. SG-552, Deagle"
	popup addline assaultmenu "->5. Famas, Deagle"
	popup addline assaultmenu "->6. Galil, Deagle"
	popup addline assaultmenu "->8. Back to Main Menu"
	popup addline assaultmenu "->9. Next"
	popup addline assaultmenu "->0. Exit"
	popup menuselect assaultmenu alienwave/assaultmenu
	
	popup create reconmenu
	popup addline reconmenu "==[ AECU ARSENAL ]=="
	popup addline reconmenu ">> RECON CLASS <<"
	popup addline reconmenu "->1. MAC-10, FiveSeven"
	popup addline reconmenu "->2. TMP, FiveSeven"
	popup addline reconmenu "->3. MP5-Navy, FiveSeven"
	popup addline reconmenu "->4. UMP, FiveSeven"
	popup addline reconmenu "->5. P90, FiveSeven"
	popup addline reconmenu "->8. Back"
	popup addline reconmenu "->9. Next"
	popup addline reconmenu "->0. Exit"
	popup menuselect reconmenu alienwave/reconmenu

	popup create supportmenu
	popup addline supportmenu "==[ AECU ARSENAL ]=="
	popup addline supportmenu ">> SUPPORT CLASS <<"
	popup addline supportmenu "->1. M249, Dual Elites"
	popup addline supportmenu "->2. M3, Dual Elites"
	popup addline supportmenu "->3. XM1014, Dual Elites"
	popup addline supportmenu "->8. Back"
	popup addline supportmenu "->9. Next"
	popup addline supportmenu "->0. Exit"
	popup menuselect supportmenu alienwave/supportmenu

	popup create snipermenu
	popup addline snipermenu "==[ AECU ARSENAL ]=="
	popup addline snipermenu ">> SNIPER CLASS <<"
	popup addline snipermenu "->1. Scout, Compact"
	popup addline snipermenu "->2. AWP, Compact"
	popup addline snipermenu "->3. G3SG1, Compact"
	popup addline snipermenu "->4. SG-550, Compact"
	popup addline snipermenu "->8. Back"
	popup addline snipermenu "->0. Exit"
	popup menuselect snipermenu alienwave/snipermenu
}

block assaultmenu
{
	if (server_var(_popup_choice) == 1) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_m4a1
		es_give server_var(_popup_userid) weapon_deagle
		es popup send powermenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 2) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_ak47
		es_give server_var(_popup_userid) weapon_deagle
		es popup send powermenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 3) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_aug
		es_give server_var(_popup_userid) weapon_deagle
		es popup send powermenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 4) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_sg552
		es_give server_var(_popup_userid) weapon_deagle
		es popup send powermenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 5) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_famas
		es_give server_var(_popup_userid) weapon_deagle
		es popup send powermenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 6) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_galil
		es_give server_var(_popup_userid) weapon_deagle
		es popup send powermenu server_var(_popup_userid)
	}

	if (server_var(_popup_choice) == 8) do
	{
		es popup send powermenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 9) do
	{
		es popup send reconmenu server_var(_popup_userid)
	}
}

block reconmenu
{
	if (server_var(_popup_choice) == 1) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_mac10
		es_give server_var(_popup_userid) weapon_fiveseven
		es popup send powermenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 2) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_tmp
		es_give server_var(_popup_userid) weapon_fiveseven
		es popup send powermenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 3) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_mp5navy
		es_give server_var(_popup_userid) weapon_fiveseven
		es popup send powermenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 4) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_ump45
		es_give server_var(_popup_userid) weapon_fiveseven
		es popup send powermenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 5) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_p90
		es_give server_var(_popup_userid) weapon_fiveseven
		es popup send powermenu server_var(_popup_userid)
	}

	if (server_var(_popup_choice) == 8) do
	{
		es popup send assaultmenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 9) do
	{
		es popup send supportmenu server_var(_popup_userid)
	}
}

block supportmenu
{
	if (server_var(_popup_choice) == 1) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_m249
		es_give server_var(_popup_userid) weapon_elite
		es popup send powermenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 2) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_m3
		es_give server_var(_popup_userid) weapon_elite
		es popup send powermenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 3) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_xm1014
		es_give server_var(_popup_userid) weapon_elite
		es popup send powermenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 8) do
	{
		es popup send reconmenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 9) do
	{
		es popup send snipermenu server_var(_popup_userid)
	}
}

block snipermenu
{
	if (server_var(_popup_choice) == 1) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_scout
		es_give server_var(_popup_userid) weapon_p228
		es popup send powermenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 2) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_awp
		es_give server_var(_popup_userid) weapon_p228
		es popup send powermenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 3) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_g3sg1
		es_give server_var(_popup_userid) weapon_p228
		es popup send powermenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 4) do
	{
		es est_RemoveWeapon server_var(_popup_userid) 1
		es est_RemoveWeapon server_var(_popup_userid) 2
		
		es_give server_var(_popup_userid) weapon_sg550
		es_give server_var(_popup_userid) weapon_p228
		es popup send powermenu server_var(_popup_userid)
	}
	
	if (server_var(_popup_choice) == 8) do
	{
		es popup send supportmenu server_var(_popup_userid)
	}
}

block equipementpopup
{
	popup create equipementmenu
	popup addline equipementmenu "==[ AECU EQUIPEMENT ]=="
	popup addline equipementmenu "->1. Anti Gravity (Long Jump) - $1500"
	popup addline equipementmenu "->2. Back"
	popup addline equipementmenu "->0. Exit"
	popup menuselect equipementmenu alienwave/equipementmenu
}

block equipementmenu
{
	if (server_var(_popup_choice) == 1) do
	{
		es_xsetinfo antigravitybuyercash 0
		es_getmoney antigravitybuyercash server_var(_popup_userid)
		
		if (server_var(antigravitybuyercash) >= 1500) do
		{
			es_math server_var(antigravitybuyercash) - 1500
			es playerset cashadd server_var(_popup_userid) -1500
			es_emitsound player server_var(_popup_userid) items\battery_pickup.wav 1.0 0.5
			es est_SetGravity event_var(userid) 0.5
			es_tell server_var(_popup_userid) #multi #green[AW]#default You have purchased an #lightgreenAnti Gravity#default for#green $1500#default.
			es popup send powermenu server_var(_popup_userid)
		}
		
        else do
        {
            es_tell server_var(_popup_userid) #multi #green[AW]#default Sorry, but you need you need#green $1500#default.
			es_emitsound player server_var(_popup_userid) items\suitchargeno1.wav 1.0 0.5
			es popup send powermenu server_var(_popup_userid)
        }
	}
	if (server_var(_popup_choice) == 2) do
	{
		es popup send powermenu server_var(_popup_userid)
	}
}

block alienpopup
{
	popup create alienpopup
	popup addline alienpopup "==[ ALIEN RACE ]=="
	popup addline alienpopup "Choose your race"
	popup addline alienpopup "->1. Assault (Nostro Alien)"
	popup addline alienpopup "->2. Recon (Eignar Alien)"
	popup addline alienpopup "->3. Support (Moritanus Alien)"
	popup addline alienpopup "->0. Exit"
	popup menuselect alienpopup alienwave/alienmenu
}
block alienmenu
{
	if (server_var(_popup_choice) == 1) do
	{
		es playerset model server_var(_popup_userid) "player/slow/aliendrone_v3/slow_alien"
		es playerset health server_var(_popup_userid) server_var(aw_assaultalien_health)
		es playerset speed server_var(_popup_userid) server_var(aw_assaultalien_speed)
		es_tell server_var(_popup_userid) #multi #green[AW]#default You choosed to be a Nostro Alien
	}
	if (server_var(_popup_choice) == 2) do
	{
		es playerset model server_var(_popup_userid) "player/elis/vd/verdugo"
		es playerset health server_var(_popup_userid) server_var(aw_reconalien_health)
		es playerset speed server_var(_popup_userid) server_var(aw_reconalien_speed)
		es_tell server_var(_popup_userid) #multi #green[AW]#default You choosed to be an Eignar Alien
	}
	if (server_var(_popup_choice) == 3) do
	{
		es playerset model server_var(_popup_userid) "player/elis/hk/hellknight"
		es playerset health server_var(_popup_userid) server_var(aw_supportalien_health)
		es playerset speed server_var(_popup_userid) server_var(aw_supportalien_speed)
		es_tell server_var(_popup_userid) #multi #green[AW]#default You choosed to be a Moritanus Alien
	}
}

block welcome_popup
{
	popup create welcome_popup
	popup addline welcome_popup "  = Welcome ="
	popup addline welcome_popup " !! This server is running with ALIEN WAVE v1.45 !!"
	popup addline welcome_popup " Complete the normal objectives in a de_ or cs_ map and avoid to be killed"
	popup addline welcome_popup " Your Flash grenade can ice aliens and your HE can burn them"
	popup addline welcome_popup "  The mod is created by BIOKO, see HTTP://ALIENWAVE.COMOJ.COM"
	popup addline welcome_popup " - Type !respawn to see if you can respawn"
	popup addline welcome_popup " - Type !help for more infos"
	popup addline welcome_popup "  0. Exit and Enjoy !"
}

block help_popup
{
	popup create help_menu
	popup addline help_menu " ALIEN]=[WAVE"
	popup addline help_menu "      MOD"
	popup addline help_menu " * You are playing Alien Wave mod *"
	popup addline help_menu " "
	popup addline help_menu " - Alien Wave is a mod where you are invaded by aliens"
	popup addline help_menu " and where you must kill them all before they got you !"
	popup addline help_menu " - When you are in a de_ or in a cs_ map, you must complete the"
	popup addline help_menu " normal objectives instead of just killing aliens"
	popup addline help_menu " - Your frag grenade can burn aliens, and your flash grenade"
	popup addline help_menu " can paralyse them. Don't forget to use it, it can be usefull !"
	popup addline help_menu " - The mod is created by BIOKO, contact me at BIOKO.XO@GMAIL.COM"
	popup addline help_menu " See also our website : HTTP://ALIENWAVE.COMOJ.COM"
	popup addline help_menu " - There is 3 races of aliens, Assault Alien is the black one"
	popup addline help_menu " All these race got custom health and goes at custom speed."
	popup addline help_menu " "
	popup addline help_menu " Few advises"
	popup addline help_menu " - Upgrade your armor with $ via the AECU Stock menu"
	popup addline help_menu " - Earn some monney by hurting aliens with a knife"
	popup addline help_menu " - You earn 300$ each time you kill an alien"
	popup addline help_menu " - Your flashbang can freeze aliens, use it intelligently !"
	popup addline help_menu " "
	popup addline help_menu " Type !health to see your health (usefull when you are an alien)"	
	popup addline help_menu " Type !respawn to see the spawnmode of the current round"
	popup addline help_menu " "
	popup addline help_menu " Enjoy !"	
	popup addline help_menu "  0. Exit"
}
