#library "csdmo"
#include "zcommon.acs"


Script "deathmatch_token_1" enter
{
		if ((GameType () == GAME_NET_DEATHMATCH || GameType() == GAME_NET_COOPERATIVE))
		{
					giveinventory("DeathMatchToken",1); Delay (35); Terminate;

		}
		else
		{
			Delay (35); Terminate; 
}

DELAY(10);   
Terminate; 
}

Script "deathmatch_token_2" respawn
{
		if ((GameType () == GAME_NET_DEATHMATCH || GameType() == GAME_NET_COOPERATIVE))
		{
					giveinventory("DeathMatchToken",1); Delay (35); Terminate;

		}
		else
{
			Delay (35); Terminate; 
}
DELAY(10);   
Terminate; 
}


//Gives the player a smoke grenade, if in multiplayer. Or other stuff, if in sp/coop
script "give_grenades_1" ENTER
	{ 

	int Deathmatch= GameType() == GAME_NET_DEATHMATCH;
	int Sp= GameType() == GAME_SINGLE_PLAYER;
	int Coop= GameType() == GAME_NET_COOPERATIVE;
	int Level= CheckInventory("Current_Level");

{

	GiveINVENTORY ("Current_Level", 1);			//Gives player a level inventory which is detected on other scripts.

delay(5);


	if(DeathMatch == 1)	
{
		//GiveINVENTORY ("Smoke Grenade", 1);
}



	if(Sp == 1)	
{		GiveINVENTORY ("Flashbang", 1);   
	if(Level >= 11)	
{
	SetFont("CONFONT");
	HudMessage(s:"C4 Access granted."; HUDMSG_TYPEON | HUDMSG_LOG, 0, CR_White, 0.5, 0.375, 3.0, 0.01, 2.0);
		GiveINVENTORY ("C4", 1);   }}



	if(Coop == 1)	
{		GiveINVENTORY ("Taser", 1);  
	if(Level >= 11)	
{
	SetFont("CONFONT");
	HudMessage(s:"C4 Access granted."; HUDMSG_TYPEON | HUDMSG_LOG, 0, CR_White, 0.5, 0.375, 3.0, 0.01, 2.0);
		GiveINVENTORY ("C4", 1);   }}

}

DELAY(10);   
Terminate; 
   
}


Script "give_grenades_2" Respawn { Delay(5); ACS_NamedExecuteAlways("give_grenades_1",0); }



//Fixing a rare rip and tear bug, that happens when you melee a weapon and change map at the same time. Or you die and resurrect with cheats.
script "rat_fix_1" ENTER
	{ 
		TAKEINVENTORY ("RAT_MELEE", 1); 
		TAKEINVENTORY ("HE_GRENADE", 1); 

DELAY(10);   
Terminate; 
   
}


Script "rat_fix_2" Respawn { Delay(5); ACS_NamedExecuteAlways("rat_fix_1",0); }




script "Bomb_Planted" (void) {
int heresbomba = ThingCountName("Bossbrain", 0) == 1;

if (heresbomba >= 1) {

	SetHudSize(1280,720,1);


	SetFont("DBFPLAIN");
	HudMessage(s:"The bomb has been planted!";	HUDMSG_TYPEON | HUDMSG_LOG, 218, CR_gray, 0.5*1280, 0.21*720, 2.0, 0.015, 1.0);//CR_TAN
	LocalAmbientSound("bombplanted",200);

	delay(35*25);


	LocalAmbientSound("streak/super",200);
	delay(35*5);
//Teleport_EndGame();
	Exit_Normal(0);
}



else
{
	delay(16*1);
restart;

}

}