block load
{
	es_xset Left4Dead 1.1
	es_xmakepublic Left4Dead

	es_load popup

	popup create human
	popup addline human "Choose your Class"
	popup addline human "->1. Zoey"
	popup addline human "->2. Francis"
	popup addline human "->3. Louis"
	popup menuselect human left4dead/hselect

	popup create infected
	popup addline infected "Choose your Class"
	popup addline infected "->1. Common"
	popup addline infected "->2. Hunter"
	popup addline infected "->3. Witch"
	popup menuselect infected left4dead/iselect

	popup create guns
	popup addline guns "Choose your zombie killer weapon!"
	popup addline guns "->1. Shotgun"
	popup addline guns "->2. AutoShotgun"
	popup addline guns "->3. TMP"
	popup addline guns "->4. MP5"
	popup addline guns "->5. Sg552"
	popup addline guns "->6. Ak47"
	popup addline guns "->7. M4a1"
	popup addline guns "->8. AWP"
	popup menuselect guns left4dead/weapons

	popup create pistol
	popup addline pistol "Select your zombie killer Pistol"
	popup addline pistol "-> 1. Glock"
	popup addline pistol "-> 2. USP"
	popup addline pistol "-> 3. Compact/P228"
	popup addline pistol "-> 4. Desert Egale"
	popup addline pistol "-> 5. Fiveseven"
	popup addline pistol "-> 6. Elite/Dual"
	popup menuselect pistol left4dead/ppistols

	popup create power
	popup addline power "Would you like to be invisible?"
	popup addline power "Just the Common zombie can this!"
	popup addline power "-> 1. Yes(once per round)"
	popup addline power "-> 2. No"
	popup menuselect power left4dead/ppower

	es_xmsg #green [L4D] L4D Mod is loaded!
	es_xmsg #green [L4D] by Totya[HUN]
	exec l4d_downloadsfile.cfg

	es_xset l4d_destroy_buyzones 1
	
}
block unload
{
	es_xmsg #green [L4D] L4D Mod is unloaded!
	es_xset mp_restartgame 1
}
event es_map_start
{
	es_xprecachemodel indexzoey "models/player/techknow/left4dead/zoey.mdl"
	es_xprecachemodel indexfrancis "models/player/techknow/left4dead/francis.mdl"
	es_xprecachemodel indexlouis "models/player/techknow/left4dead/louis.mdl"
	es_xprecachemodel indexcommon "models/player/slow/l4d/hot_ass_zombie/slow_v2.mdl"
	es_xprecachemodel indexhunter "models/player/techknow/left4dead/hunter.mdl"
	es_xprecachemodel indexwitch "models/player/techknow/left4dead/witch.mdl"

        est_lightstyle 0 a
        sv_skyname sky_borealis01

	exec l4d_downloads.cfg
	
	es_xsetinfo l4d_human_team 2 //T
	es_xsetinfo l4d_infected_team 3 //CT
}
event round_start
{
	popup send human #t
	popup send guns #t
	popup send pistol #t
	popup send infected #ct
	es_xdelayed 5 popup send power #ct
	es_xdelayed 1 es est_PlayPlayer #tt leftfordead/killa.mp3 1.0
	est_removeweapon #a 1
	est_removeweapon #a 2
	est_removeweapon #a 3
	est_removeweapon #a 4

	es msg #green by Totya[HUN]
}
event player_spawn
{
		if (server_var(l4d_destroy_buyzones) equalto 1) do
		{
			es_fire event_var(userid) func_buyzone kill
		}
}
event round_end
{
	if (event_var(winner) == 2) do
	{
	es est_PlayPlayer #a leftfordead/survivor.mp3 1.0
	es_centermsg Human fail.The last hope is died...
	es_xdelayed 1 es_centermsg The Humans win!.
	}

	if (event_var(winner) == 3) do
	{
	es est_PlayPlayer #a leftfordead/infected.mp3 1.0
	es_centermsg The humans win!
	es_xdelayed 1 es_centermsg Human fail.The last hope is died...
	}
}
block hselect
{
	if (server_var(_popup_choice) equalto 1) do
	{
		es playerset model server_var(_popup_userid) "models/player/techknow/left4dead/zoey.mdl"
		es est_sethealth server_var(_popup_userid) 100
		es est_SetArmor server_var(_popup_userid) 50
		es playerset cash event_var(userid) 0
		es est_setgravity server_var(_popup_userid) 1
	}

	if (server_var(_popup_choice) equalto 2) do
	{
		es playerset model server_var(_popup_userid) "models/player/techknow/left4dead/francis.mdl"
		es est_sethealth server_var(_popup_userid) 100
		es est_SetArmor server_var(_popup_userid) 50
		es playerset cash event_var(userid) 0
		es est_setgravity server_var(_popup_userid) 1
	}
	
	if (server_var(_popup_choice) equalto 3) do
	{
		es playerset model server_var(_popup_userid) "models/player/techknow/left4dead/louis.mdl"
		es est_sethealth server_var(_popup_userid) 100
		es est_SetArmor server_var(_popup_userid) 50
		es playerset cash event_var(userid) 0
		es est_setgravity server_var(_popup_userid) 1
	}
}
block iselect
{
	if (server_var(_popup_choice) equalto 2) do
	{
		es playerset model server_var(_popup_userid) "models/player/techknow/left4dead/hunter.mdl"
		es est_stripplayer event_var(userid)
		es est_removeweapon event_var(userid) 1
		es est_removeweapon event_var(userid) 2
		es_give server_var(_popup_userid) weapon_knife
		es est_sethealth server_var(_popup_userid) 300
		es est_SetArmor server_var(_popup_userid) 100
		es est_setgravity event_var(userid) 0.4
		es est_Speed event_var(userid) 1.5
		es playerset cash event_var(userid) 0
	}

	if (server_var(_popup_choice) equalto 3) do
	{
		es playerset model server_var(_popup_userid) "models/player/techknow/left4dead/witch.mdl"
		es est_stripplayer event_var(userid)
		es est_removeweapon event_var(userid) 1
		es est_removeweapon event_var(userid) 2
		es_give server_var(_popup_userid) weapon_knife
		es est_sethealth server_var(_popup_userid) 150
		es est_SetArmor server_var(_popup_userid) 0
		es est_setgravity event_var(userid) 0.8
		es est_Speed event_var(userid) 2.0
		es playerset cash event_var(userid) 0
	}

	if (server_var(_popup_choice) equalto 1) do
	{
		es playerset model server_var(_popup_userid) "models/player/slow/l4d/hot_ass_zombie/slow_v2.mdl"
		es est_stripplayer event_var(userid)
		es est_removeweapon event_var(userid) 1
		es est_removeweapon event_var(userid) 2
		es est_SetArmor server_var(_popup_userid) 0
		es playerset cash event_var(userid) 10000
		es_give server_var(_popup_userid) weapon_knife
	}
}
block weapons
{
	if (server_var(_popup_choice) equalto 1) do
	{
		es_give server_var(_popup_userid) weapon_m3
	}

	if (server_var(_popup_choice) equalto 2) do
	{
		es_give server_var(_popup_userid) weapon_xm1014
	}

	if (server_var(_popup_choice) equalto 3) do
	{
		es_give server_var(_popup_userid) weapon_tmp
	}

	if (server_var(_popup_choice) equalto 4) do
	{
		es_give server_var(_popup_userid) weapon_mp5navy
	}

	if (server_var(_popup_choice) equalto 5) do
	{
		es_give server_var(_popup_userid) weapon_sg552
	}

	if (server_var(_popup_choice) equalto 6) do
	{
		es_give server_var(_popup_userid) weapon_ak47
	}

	if (server_var(_popup_choice) equalto 7) do
	{
		es_give server_var(_popup_userid) weapon_m4a1
	}

	if (server_var(_popup_choice) equalto 8) do
	{
		es_give server_var(_popup_userid) weapon_awp
	}
}
block ppistols
{
	if (server_var(_popup_choice) equalto 1) do
	{
		es_give server_var(_popup_userid) weapon_glock
	}

	if (server_var(_popup_choice) equalto 2) do
	{
		es_give server_var(_popup_userid) weapon_usp
	}

	if (server_var(_popup_choice) equalto 3) do
	{
		es_give server_var(_popup_userid) weapon_p228
	}

	if (server_var(_popup_choice) equalto 4) do
	{
		es_give server_var(_popup_userid) weapon_deagle
	}

	if (server_var(_popup_choice) equalto 5) do
	{
		es_give server_var(_popup_userid) weapon_fiveseven
	}

	if (server_var(_popup_choice) equalto 6) do
	{
		es_give server_var(_popup_userid) weapon_elite
	}
}
block ppower
{
	if (server_var(_popup_choice) equalto 1) do
	{
	 es_setinfo playermoney 0
     	 es_getmoney playermoney event_var(userid)

   	  if(server_var(playermoney) => 10000) do
	  {
	    es est_SetPlayerColor event_var(userid) 255 255 255 0 1
          	    es_math playermoney - 10000
         	    es est_PlayPlayer event_var(userid) leftfordead/infsound.mp3 1.0
          	    es playerset cash event_var(userid) server_Var(playermoney)
	    es_xdelayed 8 es est_SetPlayerColor event_var(userid) 255 255 255 255 1
	  }
	}

	if (server_var(_popup_choice) equalto 2) do
	{
		es_tell event_var(userid)  #multi #green If you want to be invisible,just type #lightgreen!power #greento chat!
	}
}
event player_say
{
	if(event_var(text) == "!power") do
	{
	es popup send power event_var(userid)
	}
}
event item_pickup
{
  if (event_var(es_userteam) == 3) do
  {
    if (event_var(item) notequalto knife) do
    {
      es_give event_var(userid) player_weaponstrip
      es_fire event_var(userid) player_weaponstrip strip
      es_delayed .1 es_xgive event_var(userid) weapon_knife
    }
  }
}
event bomb_planted
{
	es_xdelayed 1 es est_PlayPlayer #a leftfordead/hordee.mp3 1.0
}