#include <sourcemod>
#include <sdktools>

public Plugin myinfo =
{
	name        = "ze_boatescape6_remix_fix2 Secret",
	author      = "Neon",
	description = "Seagull + 2 different Endings",
	version     = "2.0",
	url         = "https://steamcommunity.com/id/n3ontm"
}

float g_fOrigin_Button5[3];
Handle g_hSparkTimer;

public void VerifyMap()
{
	char currentMap[64];
	GetCurrentMap(currentMap, sizeof(currentMap));
	if (!StrEqual(currentMap, "ze_boatescape6_remix_fix2"))
	{
		char sFilename[256];
		GetPluginFilename(null, sFilename, sizeof(sFilename));
		ServerCommand("sm plugins unload %s", sFilename);
	}
	else
	{
		AddFileToDownloadsTable("models/zombieden/xmode/youmu/laser.dx80.vtx");
		AddFileToDownloadsTable("models/zombieden/xmode/youmu/laser.dx90.vtx");
		AddFileToDownloadsTable("models/zombieden/xmode/youmu/laser.mdl");
		AddFileToDownloadsTable("models/zombieden/xmode/youmu/laser.phy");
		AddFileToDownloadsTable("models/zombieden/xmode/youmu/laser.sw.vtx");
		AddFileToDownloadsTable("models/zombieden/xmode/youmu/laser.vvd");

		AddFileToDownloadsTable("materials/zombieden/xmode/youmu/laser/laser1.vmt");
		AddFileToDownloadsTable("materials/zombieden/xmode/youmu/laser/laser1.vtf");
		AddFileToDownloadsTable("materials/zombieden/xmode/youmu/laser/laser2.vmt");
		AddFileToDownloadsTable("materials/zombieden/xmode/youmu/laser/laser2.vtf");
		AddFileToDownloadsTable("materials/zombieden/xmode/youmu/laser/white.vmt");
		AddFileToDownloadsTable("materials/zombieden/xmode/youmu/laser/white.vtf");

		AddFileToDownloadsTable("models/3d/bossguard/bossguard.dx80.vtx");
		AddFileToDownloadsTable("models/3d/bossguard/bossguard.dx90.vtx");
		AddFileToDownloadsTable("models/3d/bossguard/bossguard.mdl");
		AddFileToDownloadsTable("models/3d/bossguard/bossguard.phy");
		AddFileToDownloadsTable("models/3d/bossguard/bossguard.sw.vtx");
		AddFileToDownloadsTable("models/3d/bossguard/bossguard.vvd");

		AddFileToDownloadsTable("materials/3d/bossguard/diss_00.vmt");
		AddFileToDownloadsTable("materials/3d/bossguard/diss_00.vtf");
		AddFileToDownloadsTable("materials/3d/bossguard/diss_01.vmt");
		AddFileToDownloadsTable("materials/3d/bossguard/diss_01.vtf");

		AddFileToDownloadsTable("sound/unl1/boatescape/starwars.wav");
		AddFileToDownloadsTable("sound/unl1/boatescape/evil_laugh.wav");
		AddFileToDownloadsTable("sound/unl1/boatescape/Brain Power V2.mp3");
		AddFileToDownloadsTable("sound/unl1/boatescape/Isengard.mp3");

		PrecacheModel("models/seagull.mdl");
		PrecacheModel("models/props_lab/blastdoor001c.mdl");
		PrecacheModel("models/props_trainstation/trainstation_clock001.mdl");
		PrecacheModel("models/zombieden/xmode/youmu/laser.mdl");
		PrecacheModel("models/3d/bossguard/bossguard.mdl");
		PrecacheModel("models/props/de_inferno/brickpillara.mdl");
		PrecacheModel("models/props_combine/combine_teleportplatform.mdl");
		PrecacheModel("models/effects/vol_light64x256.mdl");
		PrecacheModel("models/props/cs_italy/bananna.mdl");
		PrecacheModel("models/props/cs_italy/orange.mdl");
		PrecacheModel("models/props_junk/watermelon01.mdl");
	}

}

public void OnPluginStart()
{
	VerifyMap();
	HookEvent("round_start", OnRoundStart, EventHookMode_Post);
	HookEvent("round_end", OnRoundEnd, EventHookMode_Post);
}

public void OnMapStart()
{
	VerifyMap();
}

public void OnRoundEnd(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
	delete g_hSparkTimer;
}

public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{

	delete g_hSparkTimer;
	SpawnSparkTimer();
	SpawnSeagullRelay();
	SpawnMathCounter1();
	SpawnMathCounter2();

	SpawnTriggerTeleport();
	SpawnTeleportDestination();

	SpawnSeagull();
	SpawnAmbientSeagull();
	SpawnSeagullClock();
	SpawnSeagullMove();

	SpawnPlatform1();
	SpawnPlatform2();
	SpawnPlatform3();
	SpawnPlatform4();
	SpawnPlatform5();
	SpawnPlatform6();
	SpawnPillar1();
	SpawnPillar2();
	SpawnPillar3();
	SpawnPillarLight1();
	SpawnPillarLight2();
	SpawnPillarLight3();
	SpawnPillarParticle1();
	SpawnPillarParticle2();
	SpawnPillarParticle3();
	SpawnOrangeFinal();
	SpawnBananaFinal();
	SpawnMelonFinal();
	SpawnExplosion1();
	SpawnExplosion2();
	SpawnExplosion3();
	SpawnAmbientGenericExplosion1();
	SpawnAmbientGenericExplosion2();
	SpawnAmbientGenericExplosion3();
	SpawnButtonFinal1();
	SpawnButtonFinal2();
	SpawnButtonFinal3();
	SpawnBeam1();
	SpawnBeam2();
	SpawnBeam3();
	SpawnBeam4();
	SpawnBeam5();
	SpawnBeam6();
	SpawnBeam7();
	SpawnTeleportFinal();
	SpawnTriggerTeleportFinal();
	SpawnTeleportDestinationFinal();

	SpawnRotating();
	SpawnRotatingMelon();
	SpawnRotatingOrange();
	SpawnRotatingBanana();
	SpawnRotatingMelonBeam();

	SpawnFilterEnding();
	SpawnBadEndingTrigger();

	SpawnScore1();
	SpawnScore2();

	SpawnBossProp();
	SpawnBossParticle();
	SpawnBossMove();
	SpawnLaserTimer();
	SpawnLaserSound();
	SpawnBossPhysbox();
	SpawnBossHP();
	SpawnAmbientBoss1();
	SpawnAmbientBoss2();

	SpawnButton1();
	SpawnParticle1();
	SpawnFilter1();
	SpawnGameText1();

	SpawnButton2();
	SpawnParticle2();
	SpawnFilter2();
	SpawnGameText2();

	SpawnButton3();
	SpawnParticle3();
	SpawnFilter3();
	SpawnGameText3();

	SpawnButton4();
	SpawnParticle4();
	SpawnFilter4();
	SpawnGameText4();

	int random = GetRandomInt(1, 5);

	if (random == 1)
	{
		g_fOrigin_Button5[0] = 993.05;
		g_fOrigin_Button5[1] = 3072.5;
		g_fOrigin_Button5[2] = 208.55;
	}
	else if (random == 2)
	{
		g_fOrigin_Button5[0] = 458.25;
		g_fOrigin_Button5[1] = 3851.08;
		g_fOrigin_Button5[2] = 227.18;
	}
	else if (random == 3)
	{
		g_fOrigin_Button5[0] = -634.68;
		g_fOrigin_Button5[1] = 3072.5;
		g_fOrigin_Button5[2] = 477.13;
	}
	else if (random == 4)
	{
		g_fOrigin_Button5[0] = -185.16;
		g_fOrigin_Button5[1] = 1920.5;
		g_fOrigin_Button5[2] = 977.74;
	}
	else if (random == 5)
	{
		g_fOrigin_Button5[0] = 770.91;
		g_fOrigin_Button5[1] = 2496.5;
		g_fOrigin_Button5[2] = 647.08;
	}

	SpawnButton5();
	SpawnParticle5();
	SpawnFilter5();
	SpawnGameText5();

	SpawnOrange();
	SpawnBanana();
	SpawnMelon();

	SpawnFilterZM();
	SpawnNameResetZM1();
	SpawnNameResetZM2();
	SpawnItemFilter();
	SpawnItemTrigger1();
	SpawnItemTrigger2();
	SpawnNameReset();
	SpawnItemPlatform1();
	SpawnItemPlatform2();
	SpawnItemBeam();
	int iElite = SpawnItemElite();
	int iRotating = SpawnItemRotating();
	int iBanana = SpawnItemRotatingBanana();
	int iOrange = SpawnItemRotatingOrange();
	int iMelon = SpawnItemRotatingMelon();
	int iMelonBeam = SpawnItemRotatingMelonBeam();

	SetVariantString("!activator");
	AcceptEntityInput(iRotating, "SetParent", iElite);
	SetVariantString("!activator");
	AcceptEntityInput(iBanana, "SetParent", iRotating);
	SetVariantString("!activator");
	AcceptEntityInput(iOrange, "SetParent", iRotating);
	SetVariantString("!activator");
	AcceptEntityInput(iMelon, "SetParent", iRotating);
	SetVariantString("!activator");
	AcceptEntityInput(iMelonBeam, "SetParent", iRotating);
}



int SpawnScore1()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("game_score")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "game_score_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_score_good");
	DispatchKeyValue(Entity, "points", "250");
	DispatchKeyValue(Entity, "spawnflags", "0")

	DispatchSpawn(Entity);
	return Entity;
}

int SpawnScore2()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("game_score")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "game_score_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_score_bad");
	DispatchKeyValue(Entity, "points", "100");
	DispatchKeyValue(Entity, "spawnflags", "0")

	DispatchSpawn(Entity);
	return Entity;
}

int SpawnBadEndingTrigger()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("trigger_once")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "trigger_once_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_bad_ending_trigger");
	DispatchKeyValue(Entity, "angles", "90 270 0")
	DispatchKeyValue(Entity, "spawnflags", "1")
	DispatchKeyValue(Entity, "origin", "512 8700 950");
	DispatchKeyValue(Entity, "filtername", "secret_ending_filter");
	DispatchKeyValue(Entity, "model", "*1");
	DispatchKeyValue(Entity, "OnStartTouch", "point_servercommand,Command,say The God of the Fruits is not pleased with your sacrifice!,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "point_servercommand,Command,say He is sending is one of his loyal henchmen to kill you!,1,1");

	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_particle,SetParent,secret_boss_movelinear,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_physbox,SetParent,secret_boss_movelinear,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_prop,SetParent,secret_boss_movelinear,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_particle,Start,,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_movelinear,Open,,3,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_prop,SetAnimation,entrance1,3,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_entrance_sound,PlaySound,,3,1");

	DispatchKeyValue(Entity, "OnStartTouch", "secret_final_button*,Kill,,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_explosion_1,Explode,,1,1");
	DispatchKeyValue(Entity, "OnStartTouch", "explosion_sound_1,PlaySound,,1,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_banana_final,Kill,,1,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_explosion_2,Explode,,2,1");
	DispatchKeyValue(Entity, "OnStartTouch", "explosion_sound_2,PlaySound,,2,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_orange_final,Kill,,2,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_explosion_3,Explode,,3,1");
	DispatchKeyValue(Entity, "OnStartTouch", "explosion_sound_3,PlaySound,,3,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_melon_final,Kill,,3,1");

	DispatchKeyValue(Entity, "OnStartTouch", "explosion_sound_3,PlaySound,,4,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_explosion*,Explode,,4,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_pillar*,Kill,,4.3,1");

	DispatchKeyValue(Entity, "OnTrigger", "secret_seagull,Kill,,5,-1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnBossMove()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("func_movelinear")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "func_movelinear_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_boss_movelinear");
	DispatchKeyValue(Entity, "movedir", "90 0 0");
	DispatchKeyValue(Entity, "origin", "512 9600 1500");
	DispatchKeyValue(Entity, "speed", "100");
	DispatchKeyValue(Entity, "movedistance", "564");
	DispatchKeyValue(Entity, "spawnflags", "8")
	DispatchKeyValue(Entity, "OnFullyOpen", "secret_boss_prop,SetAnimation,entrance2,0,1");
	DispatchKeyValue(Entity, "OnFullyOpen", "secret_boss_particle,Stop,,0,-1");
	DispatchKeyValue(Entity, "OnFullyOpen", "secret_boss_particle,Kill,,0,-1");
	DispatchKeyValue(Entity, "OnFullyOpen", "secret_boss_laser_timer,Enable,,0,1");
	DispatchKeyValue(Entity, "OnFullyOpen", "secret_boss_hp,SetValue,150,0,1");

	DispatchSpawn(Entity);
	return Entity;
}

int SpawnBossParticle()
{

	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("info_particle_system")) == INVALID_ENT_REFERENCE)
		return -1;

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_boss_particle");
	DispatchKeyValue(Entity, "effect_name", "fire_large_01");
	DispatchKeyValue(Entity, "origin", "512 9600 1350");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("info_particle_system")) == INVALID_ENT_REFERENCE)
		return -1;

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_boss_particle");
	DispatchKeyValue(Entity, "effect_name", "fire_large_01");
	DispatchKeyValue(Entity, "origin", "512 9600 1500");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;
}

int SpawnBossProp()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_boss_prop");
	DispatchKeyValue(Entity, "angles", "0 -90 0");
	DispatchKeyValue(Entity, "origin", "512 9600 1500"); // 512 9200 934
	DispatchKeyValue(Entity, "model", "models/3d/bossguard/bossguard.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "DisableBoneFollowers", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "1");
	DispatchKeyValue(Entity, "DefaultAnim", "idle");
	DispatchKeyValue(Entity, "StartDisabled", "0");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnBossPhysbox()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("func_physbox")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "func_physbox_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_boss_physbox");
	DispatchKeyValue(Entity, "spawnflags", "574464");
	DispatchKeyValue(Entity, "material", "2");
	DispatchKeyValue(Entity, "health", "99999999");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "origin", "512 9640 1500");
	DispatchKeyValue(Entity, "angles", "0 -53 90");
	DispatchKeyValue(Entity, "model", "*13");
	DispatchKeyValue(Entity, "rendermode", "10");
	DispatchKeyValue(Entity, "OnHealthChanged", "secret_boss_hp,Subtract,1,0,-1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;

}

int SpawnBossHP()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("math_counter")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "math_counter_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_boss_hp");
	DispatchKeyValue(Entity, "startvalue", "100000");
	DispatchKeyValue(Entity, "min", "0");
	DispatchKeyValue(Entity, "max", "100000");
	DispatchKeyValue(Entity, "OnHitMin", "secret_boss_laser_timer,Kill,,0,1");
	DispatchKeyValue(Entity, "OnHitMin", "secret_boss_prop,SetAnimation,dead1,0,1");
	DispatchKeyValue(Entity, "OnHitMin", "secret_boss_prop,Kill,,3,1");
	DispatchKeyValue(Entity, "OnHitMin", "secret_boss_physbox,Kill,,0,1");
	DispatchKeyValue(Entity, "OnHitMin", "secret_boss_physbox,Kill,,0,1");
	DispatchKeyValue(Entity, "OnHitMin", "secret_teleport_prop,Enable,,2,1");
	DispatchKeyValue(Entity, "OnHitMin", "secret_teleport_final,AddOutput,OnStartTouch secret_score_bad:ApplyScore::0:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMin", "secret_teleport_final,Enable,,2,1");
	DispatchKeyValue(Entity, "OnHitMin", "secret_boss_laser_movelinear,KillHierarchy,,0,1");
	DispatchKeyValue(Entity, "OnHitMin", "point_servercommand,Command,say You killed the Henchman!,0,-1");
	DispatchKeyValue(Entity, "OnHitMin", "point_servercommand,Command,say Maybe try not to anger the God of the Fruits next time...,1,-1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;
}

int SpawnLaserTimer()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("logic_timer")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "logic_timer_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_boss_laser_timer");
	DispatchKeyValue(Entity, "UseRandomTime", "1");
	DispatchKeyValue(Entity, "spawnflags", "0");
	DispatchKeyValue(Entity, "LowerRandomBound", "1.2");
	DispatchKeyValue(Entity, "UpperRandomBound", "1.5");
	DispatchKeyValue(Entity, "RefireTime", "1.5");
	DispatchKeyValue(Entity, "StartDisabled", "1");
	DispatchKeyValue(Entity, "OnTimer", "secret_boss_laser_sound,PlaySound,,0,-1");
	DispatchKeyValue(Entity, "OnTimer", "secret_boss_prop,SetAnimation,attack1,0,-1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	HookSingleEntityOutput(Entity, "OnTimer", BadEndingCallback, false);

	return Entity;

}

int SpawnAmbientBoss1()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("ambient_generic")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "ambient_generic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_boss_entrance_sound");
	DispatchKeyValue(Entity, "spawnflags", "49");
	DispatchKeyValue(Entity, "radius", "1250");
	DispatchKeyValue(Entity, "message", "unl1/boatescape/starwars.wav");
	DispatchKeyValue(Entity, "volume", "10");
	DispatchKeyValue(Entity, "health", "10");
	DispatchKeyValue(Entity, "pitch", "100");
	DispatchKeyValue(Entity, "pitchstart", "100");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnAmbientBoss2()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("ambient_generic")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "ambient_generic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_boss_loss_sound");
	DispatchKeyValue(Entity, "spawnflags", "49");
	DispatchKeyValue(Entity, "radius", "1250");
	DispatchKeyValue(Entity, "message", "unl1/boatescape/evil_laugh.wav");
	DispatchKeyValue(Entity, "volume", "10");
	DispatchKeyValue(Entity, "health", "10");
	DispatchKeyValue(Entity, "pitch", "100");
	DispatchKeyValue(Entity, "pitchstart", "100");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnLaserSound()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("ambient_generic")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "ambient_generic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_boss_laser_sound");
	DispatchKeyValue(Entity, "spawnflags", "49");
	DispatchKeyValue(Entity, "radius", "1250");
	DispatchKeyValue(Entity, "message", "npc/roller/blade_out.wav");
	DispatchKeyValue(Entity, "volume", "10");
	DispatchKeyValue(Entity, "health", "10");
	DispatchKeyValue(Entity, "pitch", "100");
	DispatchKeyValue(Entity, "pitchstart", "100");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnBossLaserMove()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("func_movelinear")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "func_movelinear_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_boss_laser_movelinear");
	DispatchKeyValue(Entity, "origin", "512 9600 934"); //512 9600 934
	DispatchKeyValue(Entity, "movedir", "0 -90 0");
	DispatchKeyValue(Entity, "speed", "900");
	DispatchKeyValue(Entity, "movedistance", "1000");
	DispatchKeyValue(Entity, "spawnflags", "8")
	DispatchKeyValue(Entity, "OnFullyOpen", "!self,KillHierarchy,,0,1");

	DispatchSpawn(Entity);
	return Entity;
}

int SpawnBossLaserProp(int random)
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_boss_laser_prop");
	DispatchKeyValue(Entity, "angles", "0 -90 0");
	DispatchKeyValue(Entity, "model", "models/zombieden/xmode/youmu/laser.mdl");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "DisableBoneFollowers", "1");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "rendercolor", "0 255 0");
	DispatchKeyValue(Entity, "rendermode", "0");

	if (random == 1)
	{
		DispatchKeyValue(Entity, "origin", "512 9600 900");
	}
	else if (random == 2)
	{
		DispatchKeyValue(Entity, "origin", "512 9600 943");
	}
	else if (random == 3)
	{
		DispatchKeyValue(Entity, "origin", "512 9600 928");
	}

	DispatchSpawn(Entity);

	return Entity;
}

int SpawnTriggerHurt(int random)
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("trigger_hurt")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "trigger_hurt_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_boss_laser_hurt");
	DispatchKeyValue(Entity, "spawnflags", "1");
	DispatchKeyValue(Entity, "StartDisabled", "0");
	DispatchKeyValue(Entity, "nodmgforce", "0");
	DispatchKeyValue(Entity, "damage", "999999");
	DispatchKeyValue(Entity, "damagecap", "20");
	DispatchKeyValue(Entity, "damagemodel", "0");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_laser_timer,Kill,,0,-1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_hp,Kill,,0,-1");
	DispatchKeyValue(Entity, "OnStartTouch", "point_servercommand,Command,say Maybe try not to anger the God of the Fruits next time...,1,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_loss_sound,PlaySound,,1,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_prop,AddOutput,OnUser1 !self:AddOutput:rendercolor 255 000 0:1.00:-1,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_prop,AddOutput,OnUser1 !self:AddOutput:rendercolor 255 165 0:2.00:-1,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_prop,AddOutput,OnUser1 !self:AddOutput:rendercolor 255 255 0:3.00:-1,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_prop,AddOutput,OnUser1 !self:AddOutput:rendercolor 0 255 0:4.00:-1,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_prop,AddOutput,OnUser1 !self:AddOutput:rendercolor 0 0 255:5.00:-1,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_prop,AddOutput,OnUser1 !self:AddOutput:rendercolor 70 0 130:6.00:-1,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_prop,AddOutput,OnUser1 !self:AddOutput:rendercolor 128 0 128:7.00:-1,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_prop,AddOutput,OnUser1 !self:FireUser1::7.00:-1,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_boss_prop,FireUser1,,1,1");

	if (random == 1)
	{
		DispatchKeyValue(Entity, "origin", "512 9600 898");
	}
	else if (random == 2)
	{
		DispatchKeyValue(Entity, "origin", "512 9600 958");
	}
	else if (random == 3)
	{
		DispatchKeyValue(Entity, "origin", "512 9600 928");
	}

	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	SetEntityModel(Entity, "models/zombieden/xmode/youmu/laser.mdl");

	float minbounds[3] = {-100.25, -100.25, -1.25};
	float maxbounds[3] = {100.25, -10.00, 1.25};
	SetEntPropVector(Entity, Prop_Send, "m_vecMins", minbounds);
	SetEntPropVector(Entity, Prop_Send, "m_vecMaxs", maxbounds);

	SetEntProp(Entity, Prop_Send, "m_nSolidType", 2);

	int enteffects = GetEntProp(Entity, Prop_Send, "m_fEffects");
	enteffects |= 32;
	SetEntProp(Entity, Prop_Send, "m_fEffects", enteffects);

	return Entity;
}

public BadEndingCallback(const char[] output, int caller, int activator, float delay)
{
		int random = GetRandomInt(1, 3);
		int move = SpawnBossLaserMove();
		int prop = SpawnBossLaserProp(random);
		int hurt = SpawnTriggerHurt(random);
		SetVariantString("!activator");
		AcceptEntityInput(prop, "SetParent", move);
		SetVariantString("!activator");
		AcceptEntityInput(hurt, "SetParent", move);
		AcceptEntityInput(move, "Open");
}

public void GoodEndingCallback(const char[] output, int caller, int activator, float delay)
{
	g_hSparkTimer = CreateTimer(0.1, Sparks, INVALID_HANDLE, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);

	int autism1 = SpawnAmbientAutism1();
	int autism2 = SpawnAmbientAutism2();

	int random = GetRandomInt(1, 2);

	if (random == 1)
	{
		AcceptEntityInput(autism1, "PlaySound");
	}
	else if (random == 2)
	{
		AcceptEntityInput(autism2, "PlaySound");
	}
}

public Action Sparks(Handle timer)
{
	float sparksOrigin[3];
	sparksOrigin[0] = GetRandomFloat(-1200.0, 2400.0);
	sparksOrigin[1] = GetRandomFloat(11000.0, 13000.0);
	sparksOrigin[2] = GetRandomFloat(270.0, 800.0);

	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("info_particle_system")) == INVALID_ENT_REFERENCE)
		return Plugin_Stop;

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "sparks");
	DispatchKeyValue(Entity, "effect_name", "achieved");
	DispatchKeyValueVector(Entity, "origin", sparksOrigin);
	DispatchKeyValue(Entity, "OnUser1", "!self,Kill,,3,-1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	AcceptEntityInput(Entity, "start");
	AcceptEntityInput(Entity, "FireUser1");

	if (Entity > 1800)
		delete g_hSparkTimer;

	return Plugin_Continue;
}

int SpawnSeagullRelay()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("logic_relay")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "logic_relay_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_logic_relay");
	//DispatchKeyValue(Entity, "spawnflags", "1");
	DispatchKeyValue(Entity, "OnTrigger", "secret_button*,Kill,,0,-1");
	DispatchKeyValue(Entity, "OnTrigger", "secret_seagull,Enable,,0,-1");
	DispatchKeyValue(Entity, "OnTrigger", "secret_seagull_clock,Enable,,0,-1");
	DispatchKeyValue(Entity, "OnTrigger", "secret_seagull_clock,SetParent,secret_seagull_movelinear,0.1,-1");
	DispatchKeyValue(Entity, "OnTrigger", "secret_seagull_door*,Enable,,0,-1");
	DispatchKeyValue(Entity, "OnTrigger", "secret_seagull_door*,SetParent,secret_seagull_movelinear,0.1,-1");
	DispatchKeyValue(Entity, "OnTrigger", "secret_seagull_box,Enable,,0,-1");
	DispatchKeyValue(Entity, "OnTrigger", "secret_seagull_box,SetParent,secret_seagull_movelinear,0.1,-1");
	DispatchKeyValue(Entity, "OnTrigger", "secret_seagull,SetParent,secret_seagull_movelinear,0.1,-1");
	DispatchKeyValue(Entity, "OnTrigger", "secret_winner,AddOutput,origin 2200 12865 927,0,-1");
	DispatchKeyValue(Entity, "OnTrigger", "secret_winner,AddOutput,basevelocity 0 0 -200,0.1,-1");
	DispatchKeyValue(Entity, "OnTrigger", "secret_seagull_movelinear,Open,,3,-1");
	DispatchKeyValue(Entity, "OnTrigger", "seagull_sound,PlaySound,,3,-1");
	DispatchKeyValue(Entity, "OnTrigger", "secret_seagull,SetAnimation,Land,45,-1");
	DispatchKeyValue(Entity, "OnTrigger", "secret_seagull,SetAnimation,Idle01,46,-1");
	DispatchKeyValue(Entity, "OnTrigger", "secret_seagull_movelinear,SetSpeed,0,46,-1");
	DispatchKeyValue(Entity, "OnTrigger", "secret_seagull_clock,Kill,,47,-1");
	DispatchKeyValue(Entity, "OnUser1", "secret_math_counter_1,Add,1,0,1");
	DispatchKeyValue(Entity, "OnUser2", "secret_math_counter_1,Add,1,0,1");
	DispatchKeyValue(Entity, "OnUser3", "secret_math_counter_1,Add,1,0,1");
	DispatchKeyValue(Entity, "OnUser1", "secret_pillar_light_1,Enable,,0,1");
	DispatchKeyValue(Entity, "OnUser1", "secret_banana_final,Enable,,0,1");
	DispatchKeyValue(Entity, "OnUser2", "secret_pillar_light_2,Enable,,0,1");
	DispatchKeyValue(Entity, "OnUser2", "secret_orange_final,Enable,,0,1");
	DispatchKeyValue(Entity, "OnUser3", "secret_pillar_light_3,Enable,,0,1");
	DispatchKeyValue(Entity, "OnUser3", "secret_melon_final,Enable,,0,1");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnMathCounter1()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("math_counter")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "math_counter_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_math_counter_1");
	DispatchKeyValue(Entity, "startvalue", "0");
	DispatchKeyValue(Entity, "min", "0");
	DispatchKeyValue(Entity, "max", "3");
	DispatchKeyValue(Entity, "OutValue", "point_servercommand,Command,say The God of the Fruits acknowledges your sacrifice...,0,-1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_final_button*,Unlock,,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_bad_ending_trigger,Kill,,0,1");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;
}

int SpawnMathCounter2()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("math_counter")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "math_counter_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_math_counter_2");
	DispatchKeyValue(Entity, "startvalue", "0");
	DispatchKeyValue(Entity, "min", "0");
	DispatchKeyValue(Entity, "max", "3");
	DispatchKeyValue(Entity, "StartDisabled", "0");

	DispatchKeyValue(Entity, "OnHitMax", "point_servercommand,Command,say The God of the Fruits is satisfied with your Sacrifice!,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "point_servercommand,Command,say He rewards you with some autism!,1,1");


	DispatchKeyValue(Entity, "OnHitMax", "secret_melon_rotating,Enable,,2,1")
	DispatchKeyValue(Entity, "OnHitMax", "secret_orange_rotating,Enable,,2,1")
	DispatchKeyValue(Entity, "OnHitMax", "secret_banana_rotating,Enable,,2,1")
	DispatchKeyValue(Entity, "OnHitMax", "secret_melon_rotating_beam,Enable,,2,1")
	DispatchKeyValue(Entity, "OnHitMax", "secret_melon_rotating,SetParent,secret_rotating,2,1")
	DispatchKeyValue(Entity, "OnHitMax", "secret_orange_rotating,SetParent,secret_rotating,2,1")
	DispatchKeyValue(Entity, "OnHitMax", "secret_banana_rotating,SetParent,secret_rotating,2,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_melon_rotating_beam,SetParent,secret_rotating,2,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_beam_4,TurnOn,,2,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_pillar*,Kill,,2,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_beam_1,Kill,,2,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_beam_2,Kill,,2,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_beam_3,Kill,,2,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_orange_final,Kill,,2,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_banana_final,Kill,,2,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_melon_final,Kill,,2,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_rotating,Open,,2,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_teleport_prop,Enable,,2,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_teleport_final,AddOutput,OnStartTouch secret_score_good:ApplyScore::0:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_teleport_final,Enable,,2,1");

	DispatchKeyValue(Entity, "OnHitMax", "secret_seagull,SetAnimation,TakeOff,2,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_seagull_movelinear,SetSpeed,150.0,2.1,1");

	DispatchKeyValue(Entity, "OnHitMax", "secret_beam_*,TurnOn,,5,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_beam*,AddOutput,OnUser1 !self:AddOutput:rendercolor 255 000 0:1.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_beam*,AddOutput,OnUser1 !self:AddOutput:rendercolor 255 165 0:2.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_beam*,AddOutput,OnUser1 !self:AddOutput:rendercolor 255 255 0:3.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_beam*,AddOutput,OnUser1 !self:AddOutput:rendercolor 0 255 0:4.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_beam*,AddOutput,OnUser1 !self:AddOutput:rendercolor 0 0 255:5.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_beam*,AddOutput,OnUser1 !self:AddOutput:rendercolor 70 0 130:6.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_beam*,AddOutput,OnUser1 !self:AddOutput:rendercolor 128 0 128:7.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_beam*,AddOutput,OnUser1 !self:FireUser1::7.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "secret_beam*,FireUser1,,5,1");

	DispatchKeyValue(Entity, "OnHitMax", "chinook,AddOutput,OnUser1 !self:AddOutput:rendercolor 255 000 0:1.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "chinook,AddOutput,OnUser1 !self:AddOutput:rendercolor 255 165 0:2.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "chinook,AddOutput,OnUser1 !self:AddOutput:rendercolor 255 255 0:3.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "chinook,AddOutput,OnUser1 !self:AddOutput:rendercolor 0 255 0:4.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "chinook,AddOutput,OnUser1 !self:AddOutput:rendercolor 0 0 255:5.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "chinook,AddOutput,OnUser1 !self:AddOutput:rendercolor 70 0 130:6.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "chinook,AddOutput,OnUser1 !self:AddOutput:rendercolor 128 0 128:7.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "chinook,AddOutput,OnUser1 !self:FireUser1::7.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "chinook,FireUser1,,5,1");

	DispatchKeyValue(Entity, "OnHitMax", "boat_3,AddOutput,OnUser1 !self:AddOutput:rendercolor 255 000 0:1.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "boat_3,AddOutput,OnUser1 !self:AddOutput:rendercolor 255 165 0:2.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "boat_3,AddOutput,OnUser1 !self:AddOutput:rendercolor 255 255 0:3.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "boat_3,AddOutput,OnUser1 !self:AddOutput:rendercolor 0 255 0:4.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "boat_3,AddOutput,OnUser1 !self:AddOutput:rendercolor 0 0 255:5.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "boat_3,AddOutput,OnUser1 !self:AddOutput:rendercolor 70 0 130:6.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "boat_3,AddOutput,OnUser1 !self:AddOutput:rendercolor 128 0 128:7.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "boat_3,AddOutput,OnUser1 !self:FireUser1::7.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "boat_3,FireUser1,,5,1");

	DispatchKeyValue(Entity, "OnHitMax", "boat_4,AddOutput,OnUser1 !self:AddOutput:rendercolor 255 000 0:1.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "boat_4,AddOutput,OnUser1 !self:AddOutput:rendercolor 255 165 0:2.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "boat_4,AddOutput,OnUser1 !self:AddOutput:rendercolor 255 255 0:3.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "boat_4,AddOutput,OnUser1 !self:AddOutput:rendercolor 0 255 0:4.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "boat_4,AddOutput,OnUser1 !self:AddOutput:rendercolor 0 0 255:5.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "boat_4,AddOutput,OnUser1 !self:AddOutput:rendercolor 70 0 130:6.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "boat_4,AddOutput,OnUser1 !self:AddOutput:rendercolor 128 0 128:7.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "boat_4,AddOutput,OnUser1 !self:FireUser1::7.00:-1,0,1");
	DispatchKeyValue(Entity, "OnHitMax", "boat_4,FireUser1,,5,1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	HookSingleEntityOutput(Entity, "OnHitMax", GoodEndingCallback, true);

	return Entity;
}

int SpawnAmbientAutism1()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("ambient_generic")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "ambient_generic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_autism_sound_1");
	DispatchKeyValue(Entity, "spawnflags", "49");
	DispatchKeyValue(Entity, "radius", "1250");
	DispatchKeyValue(Entity, "message", "unl1/boatescape/Brain Power V2.mp3");
	DispatchKeyValue(Entity, "volume", "10");
	DispatchKeyValue(Entity, "health", "10");
	DispatchKeyValue(Entity, "pitch", "100");
	DispatchKeyValue(Entity, "pitchstart", "100");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnAmbientAutism2()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("ambient_generic")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "ambient_generic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_autism_sound_2");
	DispatchKeyValue(Entity, "spawnflags", "49");
	DispatchKeyValue(Entity, "radius", "1250");
	DispatchKeyValue(Entity, "message", "unl1/boatescape/Isengard.mp3");
	DispatchKeyValue(Entity, "volume", "10");
	DispatchKeyValue(Entity, "health", "10");
	DispatchKeyValue(Entity, "pitch", "100");
	DispatchKeyValue(Entity, "pitchstart", "100");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnSparkTimer()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("logic_timer")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "logic_timer_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_timer");
	DispatchKeyValue(Entity, "RefireTime", "3");
	DispatchKeyValue(Entity, "OnTimer", "secret_button_sparks_*,SparkOnce,,0,-1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnButton1()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("func_button")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "func_button_%i", Entity);

	float origin[3] = {-1367.45, -13184.5, 595.76};

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_1");
	DispatchKeyValue(Entity, "spawnflags", "1537");//1025
	DispatchKeyValue(Entity, "model", "*65");
	DispatchKeyValueVector(Entity, "origin", origin);
	DispatchKeyValue(Entity, "wait", "0.01");
	DispatchKeyValue(Entity, "OnPressed", "secret_button_filter_1,TestActivator,,0,-1");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnFilter1()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("filter_activator_team")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "filter_activator_team_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_filter_1");
	DispatchKeyValue(Entity, "Negated", "0");
	DispatchKeyValue(Entity, "filterteam", "3");
	DispatchKeyValue(Entity, "OnPass", "secret_button_game_text_1,Display,,0,-1");
	DispatchKeyValue(Entity, "OnPass", "!activator,AddOutput,targetname pressed_1,0,-1");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnParticle1()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("env_spark")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "env_spark_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_sparks_1");
	float origin[3] = {-1367.45, -13184.5, 595.76};
	DispatchKeyValueVector(Entity, "origin", origin);
	DispatchKeyValue(Entity, "spawnflags", "128");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnGameText1()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("game_text")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "game_text_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_game_text_1");
	DispatchKeyValue(Entity, "channel", "3");
	DispatchKeyValue(Entity, "color", "0 255 255");
	DispatchKeyValue(Entity, "color2", "0 255 255");
	DispatchKeyValue(Entity, "holdtime", "4");
	DispatchKeyValue(Entity, "fadein", "0.1");
	DispatchKeyValue(Entity, "fadeout", "0.1");
	DispatchKeyValue(Entity, "x", "-1");
	DispatchKeyValue(Entity, "y", "0.6");
	DispatchKeyValue(Entity, "message", "Secret: 1 out of 5");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnButton2()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("func_button")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "func_button_%i", Entity);

	float origin[3] = {2164.52, -9216.5, 461.22};

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_2");
	DispatchKeyValue(Entity, "spawnflags", "1537");//1025
	DispatchKeyValue(Entity, "model", "*65");
	DispatchKeyValueVector(Entity, "origin", origin);
	DispatchKeyValue(Entity, "wait", "0.01");
	DispatchKeyValue(Entity, "OnPressed", "secret_button_filter_2,TestActivator,,0,-1");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnFilter2()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("filter_activator_name")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "filter_activator_name_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_filter_2");
	DispatchKeyValue(Entity, "Negated", "0");
	DispatchKeyValue(Entity, "filtername", "pressed_1");
	DispatchKeyValue(Entity, "OnPass", "secret_button_game_text_2,Display,,0,-1");
	DispatchKeyValue(Entity, "OnPass", "!activator,AddOutput,targetname pressed_2,0,-1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnParticle2()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("env_spark")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "env_spark_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_sparks_2");
	float origin[3] = {2164.52, -9216.5, 461.22};
	DispatchKeyValueVector(Entity, "origin", origin);
	DispatchKeyValue(Entity, "spawnflags", "128");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnGameText2()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("game_text")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "game_text_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_game_text_2");
	DispatchKeyValue(Entity, "channel", "3");
	DispatchKeyValue(Entity, "color", "0 255 255");
	DispatchKeyValue(Entity, "color2", "0 255 255");
	DispatchKeyValue(Entity, "holdtime", "4");
	DispatchKeyValue(Entity, "fadein", "0.1");
	DispatchKeyValue(Entity, "fadeout", "0.1");
	DispatchKeyValue(Entity, "x", "-1");
	DispatchKeyValue(Entity, "y", "0.6");
	DispatchKeyValue(Entity, "message", "Secret: 2 out of 5");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnButton3()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("func_button")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "func_button_%i", Entity);

	float origin[3] = {550.45, 1023.5, 96.29};

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_3");
	DispatchKeyValue(Entity, "spawnflags", "1537");//1025
	DispatchKeyValue(Entity, "model", "*65");
	DispatchKeyValueVector(Entity, "origin", origin);
	DispatchKeyValue(Entity, "wait", "0.01");
	DispatchKeyValue(Entity, "OnPressed", "secret_button_filter_3,TestActivator,,0,-1");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnFilter3()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("filter_activator_name")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "filter_activator_name_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_filter_3");
	DispatchKeyValue(Entity, "Negated", "0");
	DispatchKeyValue(Entity, "filtername", "pressed_2");
	DispatchKeyValue(Entity, "OnPass", "secret_button_game_text_3,Display,,0,-1");
	DispatchKeyValue(Entity, "OnPass", "!activator,AddOutput,targetname pressed_3,0,-1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnParticle3()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("env_spark")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "env_spark_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_sparks_3");
	float origin[3] = {550.45, 1023.5, 96.29};
	DispatchKeyValueVector(Entity, "origin", origin);
	DispatchKeyValue(Entity, "spawnflags", "128");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnGameText3()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("game_text")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "game_text_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_game_text_3");
	DispatchKeyValue(Entity, "channel", "3");
	DispatchKeyValue(Entity, "color", "0 255 255");
	DispatchKeyValue(Entity, "color2", "0 255 255");
	DispatchKeyValue(Entity, "holdtime", "4");
	DispatchKeyValue(Entity, "fadein", "0.1");
	DispatchKeyValue(Entity, "fadeout", "0.1");
	DispatchKeyValue(Entity, "x", "-1");
	DispatchKeyValue(Entity, "y", "0.6");
	DispatchKeyValue(Entity, "message", "Secret: 3 out of 5");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnButton4()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("func_button")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "func_button_%i", Entity);

	float origin[3] = {505.46, 1152.5, 473.15};

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_4");
	DispatchKeyValue(Entity, "spawnflags", "1537");//1025
	DispatchKeyValue(Entity, "model", "*65");
	DispatchKeyValueVector(Entity, "origin", origin);
	DispatchKeyValue(Entity, "wait", "0.01");
	DispatchKeyValue(Entity, "OnPressed", "secret_button_filter_4,TestActivator,,0,-1");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnFilter4()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("filter_activator_name")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "filter_activator_name_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_filter_4");
	DispatchKeyValue(Entity, "Negated", "0");
	DispatchKeyValue(Entity, "filtername", "pressed_3");
	DispatchKeyValue(Entity, "OnPass", "secret_button_game_text_4,Display,,0,-1");
	DispatchKeyValue(Entity, "OnPass", "!activator,AddOutput,targetname pressed_4,0,-1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnParticle4()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("env_spark")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "env_spark_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_sparks_4");
	float origin[3] = {505.46, 1152.5, 473.15};
	DispatchKeyValueVector(Entity, "origin", origin);
	DispatchKeyValue(Entity, "spawnflags", "128");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnGameText4()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("game_text")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "game_text_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_game_text_4");
	DispatchKeyValue(Entity, "channel", "3");
	DispatchKeyValue(Entity, "color", "0 255 255");
	DispatchKeyValue(Entity, "color2", "0 255 255");
	DispatchKeyValue(Entity, "holdtime", "4");
	DispatchKeyValue(Entity, "fadein", "0.1");
	DispatchKeyValue(Entity, "fadeout", "0.1");
	DispatchKeyValue(Entity, "x", "-1");
	DispatchKeyValue(Entity, "y", "0.6");
	DispatchKeyValue(Entity, "message", "Secret: 4 out of 5 \n \nHint: Last One is random");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnButton5()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("func_button")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "func_button_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_5");
	DispatchKeyValue(Entity, "spawnflags", "1537");//1025
	DispatchKeyValue(Entity, "model", "*65");
	DispatchKeyValueVector(Entity, "origin", g_fOrigin_Button5);
	DispatchKeyValue(Entity, "wait", "0.01");
	DispatchKeyValue(Entity, "OnPressed", "secret_button_filter_5,TestActivator,,0,-1");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnFilter5()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("filter_activator_name")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "filter_activator_name_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_filter_5");
	DispatchKeyValue(Entity, "Negated", "0");
	DispatchKeyValue(Entity, "filtername", "pressed_4");
	DispatchKeyValue(Entity, "OnPass", "secret_button_game_text_5,Display,,0,-1");
	DispatchKeyValue(Entity, "OnPass", "!activator,AddOutput,targetname secret_winner,0,-1");
	DispatchKeyValue(Entity, "OnPass", "secret_logic_relay,Trigger,,0,-1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnParticle5()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("env_spark")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "env_spark_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_sparks_5");
	DispatchKeyValueVector(Entity, "origin", g_fOrigin_Button5);
	DispatchKeyValue(Entity, "spawnflags", "128");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnGameText5()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("game_text")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "game_text_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_button_game_text_5");
	DispatchKeyValue(Entity, "channel", "3");
	DispatchKeyValue(Entity, "color", "0 255 255");
	DispatchKeyValue(Entity, "color2", "0 255 255");
	DispatchKeyValue(Entity, "holdtime", "4");
	DispatchKeyValue(Entity, "fadein", "0.1");
	DispatchKeyValue(Entity, "fadeout", "0.1");
	DispatchKeyValue(Entity, "x", "-1");
	DispatchKeyValue(Entity, "y", "0.6");
	DispatchKeyValue(Entity, "message", "Secret: 5 out of 5 \n \n.........");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnTriggerTeleport()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("trigger_teleport")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "trigger_teleport_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_teleport");
	DispatchKeyValue(Entity, "model", "*29");
	DispatchKeyValue(Entity, "origin", "2200 12865 927"); //2205 2672 -13
	DispatchKeyValue(Entity, "spawnflags", "1");
	DispatchKeyValue(Entity, "target", "secret_teleport_destination");
	DispatchKeyValue(Entity, "OnStartTouch", "!self,Kill,,5,-1");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnTeleportDestination()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("info_teleport_destination")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "info_teleport_destination_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_teleport_destination");
	DispatchKeyValue(Entity, "angles", "0 90 0")
	DispatchKeyValue(Entity, "origin", "512 2350 930");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnSeagull()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_seagull");
	DispatchKeyValue(Entity, "angles", "0 90 0");
	DispatchKeyValue(Entity, "origin", "512 2350 890");
	DispatchKeyValue(Entity, "model", "models/seagull.mdl");
	DispatchKeyValue(Entity, "modelscale", "4.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "DefaultAnim", "SOAR");
	DispatchKeyValue(Entity, "StartDisabled", "1");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnAmbientSeagull()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("ambient_generic")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "ambient_generic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "seagull_sound");
	DispatchKeyValue(Entity, "spawnflags", "49");
	DispatchKeyValue(Entity, "message", "ambient/creatures/seagull_idle1.wav");
	DispatchKeyValue(Entity, "volume", "10");
	DispatchKeyValue(Entity, "health", "10");
	DispatchKeyValue(Entity, "preset", "0");
	DispatchKeyValue(Entity, "pitch", "100");
	DispatchKeyValue(Entity, "pitchstart", "100");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnSeagullClock()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic_override")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_override_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_seagull_clock");
	DispatchKeyValue(Entity, "angles", "90 0 0");
	DispatchKeyValue(Entity, "origin", "512 2350 910");
	DispatchKeyValue(Entity, "model", "models/props_trainstation/trainstation_clock001.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "disablebonefollowers", "1");
	DispatchKeyValue(Entity, "solid", "6");
	DispatchKeyValue(Entity, "rendermode", "10");
	DispatchKeyValue(Entity, "StartDisabled", "1");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnSeagullMove()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("func_movelinear")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "func_movelinear_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_seagull_movelinear");
	DispatchKeyValue(Entity, "movedir", "0 90 0");
	DispatchKeyValue(Entity, "origin", "512 2350 890");
	DispatchKeyValue(Entity, "speed", "150");
	DispatchKeyValue(Entity, "movedistance", "20000");
	DispatchKeyValue(Entity, "spawnflags", "8");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnFilterEnding()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("filter_activator_name")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "filter_activator_name_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_ending_filter");
	DispatchKeyValue(Entity, "Negated", "0");
	DispatchKeyValue(Entity, "filtername", "secret_winner");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;
}

int SpawnPlatform1()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_platform_1");
	DispatchKeyValue(Entity, "angles", "90 0 0");
	DispatchKeyValue(Entity, "origin", "512 9000 886");
	DispatchKeyValue(Entity, "model", "models/props_lab/blastdoor001c.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "6");
	DispatchKeyValue(Entity, "rendermode", "10");
	DispatchKeyValue(Entity, "StartDisabled", "0");
	DispatchSpawn(Entity);
	//SetEdictFlags(Entity, FL_EDICT_DONTSEND | FL_EDICT_FULL);
	SetEdictFlags(Entity, GetEdictFlags(Entity) | FL_EDICT_DONTSEND);
	return Entity;

}

int SpawnPlatform2()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_platform_2");
	DispatchKeyValue(Entity, "angles", "90 0 0");
	DispatchKeyValue(Entity, "origin", "512 9168 886");
	DispatchKeyValue(Entity, "model", "models/props_lab/blastdoor001c.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "6");
	DispatchKeyValue(Entity, "rendermode", "10");
	DispatchKeyValue(Entity, "StartDisabled", "0");
	DispatchSpawn(Entity);
	//SetEdictFlags(Entity, FL_EDICT_DONTSEND | FL_EDICT_FULL);
	SetEdictFlags(Entity, GetEdictFlags(Entity) | FL_EDICT_DONTSEND);
	return Entity;

}

int SpawnPlatform3()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_platform_3");
	DispatchKeyValue(Entity, "angles", "90 0 0");
	DispatchKeyValue(Entity, "origin", "406 9000 886");
	DispatchKeyValue(Entity, "model", "models/props_lab/blastdoor001c.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "6");
	DispatchKeyValue(Entity, "rendermode", "10");
	DispatchKeyValue(Entity, "StartDisabled", "0");
	DispatchSpawn(Entity);
	//SetEdictFlags(Entity, FL_EDICT_DONTSEND | FL_EDICT_FULL);
	SetEdictFlags(Entity, GetEdictFlags(Entity) | FL_EDICT_DONTSEND);
	return Entity;

}

int SpawnPlatform4()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_platform_4");
	DispatchKeyValue(Entity, "angles", "90 0 0");
	DispatchKeyValue(Entity, "origin", "406 9168 886");
	DispatchKeyValue(Entity, "model", "models/props_lab/blastdoor001c.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "6");
	DispatchKeyValue(Entity, "rendermode", "10");
	DispatchKeyValue(Entity, "StartDisabled", "0");
	DispatchSpawn(Entity);
	//SetEdictFlags(Entity, FL_EDICT_DONTSEND | FL_EDICT_FULL);
	SetEdictFlags(Entity, GetEdictFlags(Entity) | FL_EDICT_DONTSEND);
	return Entity;

}

int SpawnPlatform5()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_platform_5");
	DispatchKeyValue(Entity, "angles", "90 0 0");
	DispatchKeyValue(Entity, "origin", "406 8832 886");
	DispatchKeyValue(Entity, "model", "models/props_lab/blastdoor001c.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "6");
	DispatchKeyValue(Entity, "rendermode", "10");
	DispatchKeyValue(Entity, "StartDisabled", "0");
	DispatchSpawn(Entity);
	//SetEdictFlags(Entity, FL_EDICT_DONTSEND | FL_EDICT_FULL);
	SetEdictFlags(Entity, GetEdictFlags(Entity) | FL_EDICT_DONTSEND);
	return Entity;

}

int SpawnPlatform6()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_platform_1");
	DispatchKeyValue(Entity, "angles", "90 0 0");
	DispatchKeyValue(Entity, "origin", "512 8832 886");
	DispatchKeyValue(Entity, "model", "models/props_lab/blastdoor001c.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "6");
	DispatchKeyValue(Entity, "rendermode", "10");
	DispatchKeyValue(Entity, "StartDisabled", "0");
	DispatchSpawn(Entity);
	//SetEdictFlags(Entity, FL_EDICT_DONTSEND | FL_EDICT_FULL);
	SetEdictFlags(Entity, GetEdictFlags(Entity) | FL_EDICT_DONTSEND);
	return Entity;

}

int SpawnPillar1()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_pillar_1");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "603 8940 916");
	DispatchKeyValue(Entity, "model", "models/props/de_inferno/brickpillara.mdl");
	DispatchKeyValue(Entity, "modelscale", "0.5");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "0");
	DispatchKeyValue(Entity, "StartDisabled", "0");
	DispatchSpawn(Entity);
	//SetEdictFlags(Entity, FL_EDICT_ALWAYS | FL_EDICT_FULL);
	SetEdictFlags(Entity, GetEdictFlags(Entity) | FL_EDICT_ALWAYS);
	return Entity;

}


int SpawnPillarLight1()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_pillar_light_1");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "603 8940 1150");
	DispatchKeyValue(Entity, "model", "models/effects/vol_light64x256.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "1");
	DispatchKeyValue(Entity, "StartDisabled", "1");
	DispatchSpawn(Entity);
	//SetEdictFlags(Entity, FL_EDICT_ALWAYS | FL_EDICT_FULL);
	SetEdictFlags(Entity, GetEdictFlags(Entity) | FL_EDICT_ALWAYS);
	return Entity;

}

int SpawnPillarParticle1()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("info_particle_system")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "info_particle_system_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_pillar_particle_1");
	DispatchKeyValue(Entity, "origin", "603 8940 930");
	DispatchKeyValue(Entity, "effect_name", "achieved");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnPillar2()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_pillar_2");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "420 8940 916");
	DispatchKeyValue(Entity, "model", "models/props/de_inferno/brickpillara.mdl");
	DispatchKeyValue(Entity, "modelscale", "0.5");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "0");
	DispatchKeyValue(Entity, "StartDisabled", "0");
	DispatchSpawn(Entity);
	//SetEdictFlags(Entity, FL_EDICT_ALWAYS | FL_EDICT_FULL);
	SetEdictFlags(Entity, GetEdictFlags(Entity) | FL_EDICT_ALWAYS);
	return Entity;

}

int SpawnPillarLight2()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_pillar_light_2");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "420 8940 1150");
	DispatchKeyValue(Entity, "model", "models/effects/vol_light64x256.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "1");
	DispatchKeyValue(Entity, "StartDisabled", "1");
	DispatchSpawn(Entity);
	//SetEdictFlags(Entity, FL_EDICT_ALWAYS | FL_EDICT_FULL);
	SetEdictFlags(Entity, GetEdictFlags(Entity) | FL_EDICT_ALWAYS);
	return Entity;

}

int SpawnPillarParticle2()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("info_particle_system")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "info_particle_system_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_pillar_particle_2");
	DispatchKeyValue(Entity, "origin", "420 8940 930");
	DispatchKeyValue(Entity, "effect_name", "achieved");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnPillar3()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_pillar_3");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "512 9032 916");
	DispatchKeyValue(Entity, "model", "models/props/de_inferno/brickpillara.mdl");
	DispatchKeyValue(Entity, "modelscale", "0.5");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "0");
	DispatchKeyValue(Entity, "StartDisabled", "0");
	DispatchSpawn(Entity);
	//SetEdictFlags(Entity, FL_EDICT_ALWAYS | FL_EDICT_FULL);
	SetEdictFlags(Entity, GetEdictFlags(Entity) | FL_EDICT_ALWAYS);
	return Entity;

}

int SpawnPillarLight3()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_pillar_light_3");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "512 9032 1150");
	DispatchKeyValue(Entity, "model", "models/effects/vol_light64x256.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "1");
	DispatchKeyValue(Entity, "StartDisabled", "1");
	DispatchSpawn(Entity);
	//SetEdictFlags(Entity, FL_EDICT_ALWAYS | FL_EDICT_FULL);
	SetEdictFlags(Entity, GetEdictFlags(Entity) | FL_EDICT_ALWAYS);
	return Entity;

}

int SpawnPillarParticle3()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("info_particle_system")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "info_particle_system_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_pillar_particle_3");
	DispatchKeyValue(Entity, "origin", "512 9032 930");
	DispatchKeyValue(Entity, "effect_name", "achieved");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnExplosion1()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("env_explosion")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "env_explosion_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_explosion_1");
	DispatchKeyValue(Entity, "origin", "603 8940 960");
	DispatchKeyValue(Entity, "fireballsprite", "sprites/zerogxplode.spr");
	DispatchKeyValue(Entity, "rendermode", "5");
	DispatchKeyValue(Entity, "iMagnitude", "300");
	DispatchKeyValue(Entity, "iRadiusOverride", "70");
	DispatchKeyValue(Entity, "spawnflags", "3");
	DispatchSpawn(Entity);

	return Entity;

}

int SpawnExplosion2()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("env_explosion")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "env_explosion_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_explosion_2");
	DispatchKeyValue(Entity, "origin", "420 8940 960");
	DispatchKeyValue(Entity, "fireballsprite", "sprites/zerogxplode.spr");
	DispatchKeyValue(Entity, "rendermode", "5");
	DispatchKeyValue(Entity, "iMagnitude", "300");
	DispatchKeyValue(Entity, "iRadiusOverride", "70");
	DispatchKeyValue(Entity, "spawnflags", "3");
	DispatchSpawn(Entity);

	return Entity;

}

int SpawnExplosion3()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("env_explosion")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "env_explosion_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_explosion_3");
	DispatchKeyValue(Entity, "origin", "512 9032 960");
	DispatchKeyValue(Entity, "fireballsprite", "sprites/zerogxplode.spr");
	DispatchKeyValue(Entity, "rendermode", "5");
	DispatchKeyValue(Entity, "iMagnitude", "300");
	DispatchKeyValue(Entity, "iRadiusOverride", "70");
	DispatchKeyValue(Entity, "spawnflags", "3");
	DispatchSpawn(Entity);

	return Entity;

}

int SpawnAmbientGenericExplosion1()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("ambient_generic")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "ambient_generic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "explosion_sound_1");
	DispatchKeyValue(Entity, "spawnflags", "49");
	DispatchKeyValue(Entity, "SourceEntityName", "secret_banana_final");
	DispatchKeyValue(Entity, "radius", "3050");
	DispatchKeyValue(Entity, "message", "ambient/explosions/explode_9.wav");
	DispatchKeyValue(Entity, "volume", "10");
	DispatchKeyValue(Entity, "health", "10");
	DispatchKeyValue(Entity, "preset", "0");
	DispatchKeyValue(Entity, "pitch", "100");
	DispatchKeyValue(Entity, "pitchstart", "100");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnAmbientGenericExplosion2()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("ambient_generic")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "ambient_generic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "explosion_sound_2");
	DispatchKeyValue(Entity, "spawnflags", "49");
	DispatchKeyValue(Entity, "SourceEntityName", "secret_orange_final");
	DispatchKeyValue(Entity, "radius", "3050");
	DispatchKeyValue(Entity, "message", "ambient/explosions/explode_9.wav");
	DispatchKeyValue(Entity, "volume", "10");
	DispatchKeyValue(Entity, "health", "10");
	DispatchKeyValue(Entity, "preset", "0");
	DispatchKeyValue(Entity, "pitch", "100");
	DispatchKeyValue(Entity, "pitchstart", "100");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnAmbientGenericExplosion3()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("ambient_generic")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "ambient_generic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "explosion_sound_3");
	DispatchKeyValue(Entity, "spawnflags", "49");
	DispatchKeyValue(Entity, "SourceEntityName", "secret_platform_4");
	DispatchKeyValue(Entity, "radius", "3050");
	DispatchKeyValue(Entity, "message", "ambient/explosions/explode_9.wav");
	DispatchKeyValue(Entity, "volume", "10");
	DispatchKeyValue(Entity, "health", "10");
	DispatchKeyValue(Entity, "preset", "0");
	DispatchKeyValue(Entity, "pitch", "100");
	DispatchKeyValue(Entity, "pitchstart", "100");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnOrangeFinal()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic_override")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_override_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_orange_final");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "420 8940 960");
	DispatchKeyValue(Entity, "model", "models/props/cs_italy/orange.mdl");
	DispatchKeyValue(Entity, "modelscale", "2.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "1");
	DispatchKeyValue(Entity, "StartDisabled", "1");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnBananaFinal()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic_override")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_override_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_banana_final");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "603 8940 960");
	DispatchKeyValue(Entity, "model", "models/props/cs_italy/bananna.mdl");
	DispatchKeyValue(Entity, "modelscale", "2.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "1");
	DispatchKeyValue(Entity, "StartDisabled", "1");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnMelonFinal()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic_override")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_override_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_melon_final");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "512 9032 960");
	DispatchKeyValue(Entity, "model", "models/props_junk/watermelon01.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.4");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "1");
	DispatchKeyValue(Entity, "StartDisabled", "1");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnTeleportFinal()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_teleport_prop");
	DispatchKeyValue(Entity, "angles", "0 90 0");
	DispatchKeyValue(Entity, "origin", "512 9032 886");
	DispatchKeyValue(Entity, "model", "models/props_combine/combine_teleportplatform.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "6");
	DispatchKeyValue(Entity, "rendermode", "0");
	DispatchKeyValue(Entity, "StartDisabled", "1");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnBeam1()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("env_beam")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "env_beam_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_beam_1");
	DispatchKeyValue(Entity, "BoltWidth", "2");
	DispatchKeyValue(Entity, "decalname", "Bigshot");
	DispatchKeyValue(Entity, "framerate", "0");
	DispatchKeyValue(Entity, "framestart", "0");
	DispatchKeyValue(Entity, "life", "1");
	DispatchKeyValue(Entity, "LightningStart", "secret_banana_final");
	DispatchKeyValue(Entity, "LightningEnd", "secret_orange_final");
	DispatchKeyValue(Entity, "texture", "sprites/laserbeam.spr");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnBeam2()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("env_beam")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "env_beam_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_beam_2");
	DispatchKeyValue(Entity, "BoltWidth", "2");
	DispatchKeyValue(Entity, "decalname", "Bigshot");
	DispatchKeyValue(Entity, "framerate", "0");
	DispatchKeyValue(Entity, "framestart", "0");
	DispatchKeyValue(Entity, "life", "1");
	DispatchKeyValue(Entity, "LightningStart", "secret_orange_final");
	DispatchKeyValue(Entity, "LightningEnd", "secret_melon_final");
	DispatchKeyValue(Entity, "texture", "sprites/laserbeam.spr");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnBeam3()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("env_beam")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "env_beam_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_beam_3");
	DispatchKeyValue(Entity, "BoltWidth", "2");
	DispatchKeyValue(Entity, "decalname", "Bigshot");
	DispatchKeyValue(Entity, "framerate", "0");
	DispatchKeyValue(Entity, "framestart", "0");
	DispatchKeyValue(Entity, "life", "1");
	DispatchKeyValue(Entity, "LightningStart", "secret_melon_final");
	DispatchKeyValue(Entity, "LightningEnd", "secret_banana_final");
	DispatchKeyValue(Entity, "texture", "sprites/laserbeam.spr");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnBeam4()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("env_beam")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "env_beam_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_beam_4");
	DispatchKeyValue(Entity, "BoltWidth", "25");
	DispatchKeyValue(Entity, "decalname", "Bigshot");
	DispatchKeyValue(Entity, "framerate", "0");
	DispatchKeyValue(Entity, "framestart", "0");
	DispatchKeyValue(Entity, "life", "1");
	DispatchKeyValue(Entity, "spawnflags", "8");
	DispatchKeyValue(Entity, "LightningStart", "secret_melon_rotating");
	DispatchKeyValue(Entity, "LightningEnd", "secret_melon_rotating_beam");
	DispatchKeyValue(Entity, "texture", "sprites/laserbeam.spr");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnBeam5()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("env_beam")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "env_beam_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_beam_5");
	DispatchKeyValue(Entity, "BoltWidth", "10");
	DispatchKeyValue(Entity, "decalname", "Bigshot");
	DispatchKeyValue(Entity, "framerate", "0");
	DispatchKeyValue(Entity, "framestart", "0");
	DispatchKeyValue(Entity, "life", "1");
	DispatchKeyValue(Entity, "spawnflags", "0");
	DispatchKeyValue(Entity, "LightningStart", "secret_banana_rotating");
	DispatchKeyValue(Entity, "LightningEnd", "chinookrotor1");
	DispatchKeyValue(Entity, "texture", "sprites/laserbeam.spr");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnBeam6()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("env_beam")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "env_beam_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_beam_6");
	DispatchKeyValue(Entity, "BoltWidth", "10");
	DispatchKeyValue(Entity, "decalname", "Bigshot");
	DispatchKeyValue(Entity, "framerate", "0");
	DispatchKeyValue(Entity, "framestart", "0");
	DispatchKeyValue(Entity, "life", "1");
	DispatchKeyValue(Entity, "spawnflags", "0");
	DispatchKeyValue(Entity, "LightningStart", "secret_orange_rotating");
	DispatchKeyValue(Entity, "LightningEnd", "boat_3");
	DispatchKeyValue(Entity, "texture", "sprites/laserbeam.spr");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnBeam7()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("env_beam")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "env_beam_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_beam_7");
	DispatchKeyValue(Entity, "BoltWidth", "10");
	DispatchKeyValue(Entity, "decalname", "Bigshot");
	DispatchKeyValue(Entity, "framerate", "0");
	DispatchKeyValue(Entity, "framestart", "0");
	DispatchKeyValue(Entity, "life", "1");
	DispatchKeyValue(Entity, "spawnflags", "0");
	DispatchKeyValue(Entity, "LightningStart", "secret_melon_rotating");
	DispatchKeyValue(Entity, "LightningEnd", "boat_4");
	DispatchKeyValue(Entity, "texture", "sprites/laserbeam.spr");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnButtonFinal1()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("func_button")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "func_button_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_final_button_1");
	DispatchKeyValue(Entity, "spawnflags", "3073");//1025
	DispatchKeyValue(Entity, "model", "*65");
	DispatchKeyValue(Entity, "origin", "603 8940 960");
	DispatchKeyValue(Entity, "OnPressed", "secret_beam_1,TurnOn,,0,1");
	DispatchKeyValue(Entity, "OnPressed", "secret_pillar_light_1,Kill,,0,1");
	DispatchKeyValue(Entity, "OnPressed", "secret_math_counter_2,Add,1,0,1");
	DispatchKeyValue(Entity, "OnPressed", "secret_pillar_particle_1,Start,,0,1");
	DispatchKeyValue(Entity, "OnPressed", "!self,Kill,,0.1,1");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnButtonFinal2()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("func_button")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "func_button_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_final_button_2");
	DispatchKeyValue(Entity, "spawnflags", "3073");//1025
	DispatchKeyValue(Entity, "model", "*65");
	DispatchKeyValue(Entity, "origin", "420 8940 960");
	DispatchKeyValue(Entity, "OnPressed", "secret_beam_2,TurnOn,,0,1");
	DispatchKeyValue(Entity, "OnPressed", "secret_pillar_light_2,Kill,,0,1");
	DispatchKeyValue(Entity, "OnPressed", "secret_math_counter_2,Add,1,0,1");
	DispatchKeyValue(Entity, "OnPressed", "secret_pillar_particle_2,Start,,0,1");
	DispatchKeyValue(Entity, "OnPressed", "!self,Kill,,0.1,1");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnButtonFinal3()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("func_button")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "func_button_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_final_button_3");
	DispatchKeyValue(Entity, "spawnflags", "3073");//1025
	DispatchKeyValue(Entity, "model", "*65");
	DispatchKeyValue(Entity, "origin", "512 9032 960");
	DispatchKeyValue(Entity, "OnPressed", "secret_beam_3,TurnOn,,0,1");
	DispatchKeyValue(Entity, "OnPressed", "secret_pillar_light_3,Kill,,0,1");
	DispatchKeyValue(Entity, "OnPressed", "secret_math_counter_2,Add,1,0,1");
	DispatchKeyValue(Entity, "OnPressed", "secret_pillar_particle_3,Start,,0,1");
	DispatchKeyValue(Entity, "OnPressed", "!self,Kill,,0.1,1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnOrange()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_physics")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_physics_multiplayer_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "orange");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "-3606.24 -14206 481.63");
	DispatchKeyValue(Entity, "model", "models/props/cs_italy/orange.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "spawnflags", "289");
	DispatchKeyValue(Entity, "damagetoenablemotion", "10");
	DispatchKeyValue(Entity, "OnTakeDamage", "secret_logic_relay,FireUser2,,0,-1");
	DispatchKeyValue(Entity, "OnPlayerUse", "secret_logic_relay,FireUser2,,0,-1");
	DispatchKeyValue(Entity, "OnTakeDamage", "!self,Kill,,0.1,-1");
	DispatchKeyValue(Entity, "OnPlayerUse", "!self,Kill,,0.1,-1");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnBanana()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_physics")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_physics_multiplayer_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "banana");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "899 -9355.63 513.77");
	DispatchKeyValue(Entity, "model", "models/props/cs_italy/bananna.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "spawnflags", "289");
	DispatchKeyValue(Entity, "damagetoenablemotion", "10");
	DispatchKeyValue(Entity, "OnTakeDamage", "secret_logic_relay,FireUser1,,0,-1");
	DispatchKeyValue(Entity, "OnPlayerUse", "secret_logic_relay,FireUser1,,0,-1");
	DispatchKeyValue(Entity, "OnTakeDamage", "!self,Kill,,0.1,-1");
	DispatchKeyValue(Entity, "OnPlayerUse", "!self,Kill,,0.1,-1");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnMelon()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_physics")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_physics_multiplayer_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "melon");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "1023.6 -5583.5 631.48");
	DispatchKeyValue(Entity, "model", "models/props_junk/watermelon01.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "spawnflags", "289");
	DispatchKeyValue(Entity, "damagetoenablemotion", "10");
	DispatchKeyValue(Entity, "OnTakeDamage", "secret_logic_relay,FireUser3,,0,-1");
	DispatchKeyValue(Entity, "OnPlayerUse", "secret_logic_relay,FireUser3,,0,-1");
	DispatchKeyValue(Entity, "OnTakeDamage", "!self,Kill,,0.1,-1");
	DispatchKeyValue(Entity, "OnPlayerUse", "!self,Kill,,0.1,-1");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnRotating()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("func_rotating")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "func_rotating_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_rotating");
	DispatchKeyValue(Entity, "origin", "512 9032 100");
	DispatchKeyValue(Entity, "maxspeed", "10");
	DispatchKeyValue(Entity, "spawnflags", "65");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	SetEntityModel(Entity, "models/effects/vol_light64x256.mdl");
	float minbounds[3] = {-100.25, -100.25, -10.0};
	float maxbounds[3] = {100.25, 100.25, 10.0};
	SetEntPropVector(Entity, Prop_Send, "m_vecMins", minbounds);
	SetEntPropVector(Entity, Prop_Send, "m_vecMaxs", maxbounds);
	SetEntProp(Entity, Prop_Send, "m_nSolidType", 2);
	int enteffects = GetEntProp(Entity, Prop_Send, "m_fEffects");
	enteffects |= 32;
	SetEntProp(Entity, Prop_Send, "m_fEffects", enteffects);
	return Entity;
}

int SpawnRotatingOrange()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic_override")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_override_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_orange_rotating");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "-354 9532 1000");
	DispatchKeyValue(Entity, "model", "models/props/cs_italy/orange.mdl");
	DispatchKeyValue(Entity, "modelscale", "35.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "1");
	DispatchKeyValue(Entity, "StartDisabled", "1");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnRotatingBanana()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic_override")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_override_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_banana_rotating");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "1378 9532 1000");
	DispatchKeyValue(Entity, "model", "models/props/cs_italy/bananna.mdl");
	DispatchKeyValue(Entity, "modelscale", "35.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "1");
	DispatchKeyValue(Entity, "StartDisabled", "1");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnRotatingMelon()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic_override")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_override_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_melon_rotating");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "512 8032 1000");
	DispatchKeyValue(Entity, "model", "models/props_junk/watermelon01.mdl");
	DispatchKeyValue(Entity, "modelscale", "25");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "1");
	DispatchKeyValue(Entity, "StartDisabled", "1");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnRotatingMelonBeam()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic_override")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_override_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_melon_rotating_beam");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "512 10032 1000");
	DispatchKeyValue(Entity, "model", "models/props_junk/watermelon01.mdl");
	DispatchKeyValue(Entity, "modelscale", "0.2");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "10");
	DispatchKeyValue(Entity, "StartDisabled", "1");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnTriggerTeleportFinal()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("trigger_teleport")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "trigger_teleport_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_teleport_final");
	DispatchKeyValue(Entity, "origin", "512 9032 950");
	DispatchKeyValue(Entity, "model", "*26");
	DispatchKeyValue(Entity, "spawnflags", "1");
	DispatchKeyValue(Entity, "StartDisabled", "1");
	DispatchKeyValue(Entity, "target", "secret_teleport_destination_final");
	DispatchKeyValue(Entity, "OnStartTouch", "!activator,AddOutput,targetname carrier,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_teleport_prop,Kill,,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "!self,Kill,,0,-1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnTeleportDestinationFinal()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("info_teleport_destination")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "info_teleport_destination_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_teleport_destination_final");
	DispatchKeyValue(Entity, "angles", "0 90 0")
	DispatchKeyValue(Entity, "origin", "634.9 11304.2 436.72");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnItemTrigger1()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("trigger_once")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "trigger_once_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_item_trigger1");
	DispatchKeyValue(Entity, "spawnflags", "1")
	DispatchKeyValue(Entity, "origin", "-6980.97 -13196 928");
	DispatchKeyValue(Entity, "filtername", "secret_item_filter");
	DispatchKeyValue(Entity, "model", "*49");
	DispatchKeyValue(Entity, "OnStartTouch", "!activator,AddOutput,origin -7820 -14000 860,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_item_deagle,AddOutput,OnPlayerPickUp !activator:AddOutput:origin -6856.84 -13314.8 576:0:1,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_item_trigger*,Kill,,0,1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnItemTrigger2()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("trigger_once")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "trigger_once_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_item_trigger2");
	DispatchKeyValue(Entity, "spawnflags", "1")
	DispatchKeyValue(Entity, "origin", "-4875.64 -14402.8 928");
	DispatchKeyValue(Entity, "filtername", "secret_item_filter");
	DispatchKeyValue(Entity, "model", "*49");
	DispatchKeyValue(Entity, "OnStartTouch", "!activator,AddOutput,origin -7820 -14000 860,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_item_deagle,AddOutput,OnPlayerPickUp !activator:AddOutput:origin -4750.68 -14327.8 576:0:1,0,1");
	DispatchKeyValue(Entity, "OnStartTouch", "secret_item_trigger*,Kill,,0,1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}


int SpawnNameReset()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("trigger_multiple")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "trigger_multiple_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_name_reset");
	DispatchKeyValue(Entity, "spawnflags", "1")
	DispatchKeyValue(Entity, "origin", "-2168 -13824 608");
	DispatchKeyValue(Entity, "model", "*49");
	DispatchKeyValue(Entity, "OnStartTouch", "!activator,AddOutput,targetname plebnemesisfag,0,-1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnNameResetZM1()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("trigger_multiple")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "trigger_multiple_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_name_reset_zm");
	DispatchKeyValue(Entity, "spawnflags", "1")
	DispatchKeyValue(Entity, "origin", "-5285.69 -14386.9 928");
	DispatchKeyValue(Entity, "model", "*49");
	DispatchKeyValue(Entity, "filtername", "secret_filter_zm");
	DispatchKeyValue(Entity, "OnStartTouch", "!activator,AddOutput,targetname plebnemesisfag,0,-1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnNameResetZM2()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("trigger_multiple")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "trigger_multiple_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_name_reset_zm");
	DispatchKeyValue(Entity, "spawnflags", "1")
	DispatchKeyValue(Entity, "origin", "-7335.97 -13298.3 928");
	DispatchKeyValue(Entity, "model", "*49");
	DispatchKeyValue(Entity, "filtername", "secret_filter_zm");
	DispatchKeyValue(Entity, "OnStartTouch", "!activator,AddOutput,targetname plebnemesisfag,0,-1");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	return Entity;
}

int SpawnFilterZM()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("filter_activator_team")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "filter_activator_team_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_filter_zm");
	DispatchKeyValue(Entity, "Negated", "1");
	DispatchKeyValue(Entity, "filterteam", "3");
	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;

}

int SpawnItemFilter()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("filter_activator_name")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "filter_activator_name_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_item_filter");
	DispatchKeyValue(Entity, "Negated", "0");
	DispatchKeyValue(Entity, "filtername", "carrier");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);
	return Entity;
}

int SpawnItemPlatform1()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "item_platform_1");
	DispatchKeyValue(Entity, "angles", "90 0 90");
	DispatchKeyValue(Entity, "origin", "-7726 -13944 830");
	DispatchKeyValue(Entity, "model", "models/props_lab/blastdoor001c.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "6");
	DispatchKeyValue(Entity, "rendermode", "10");
	DispatchKeyValue(Entity, "StartDisabled", "0");
	DispatchSpawn(Entity);
	//SetEdictFlags(Entity, FL_EDICT_DONTSEND | FL_EDICT_FULL);
	SetEdictFlags(Entity, GetEdictFlags(Entity) | FL_EDICT_DONTSEND);
	return Entity;

}

int SpawnItemPlatform2()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "item_platform_2");
	DispatchKeyValue(Entity, "angles", "90 0 90");
	DispatchKeyValue(Entity, "origin", "-7557 -13944 830");
	DispatchKeyValue(Entity, "model", "models/props_lab/blastdoor001c.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.0");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "6");
	DispatchKeyValue(Entity, "rendermode", "10");
	DispatchKeyValue(Entity, "StartDisabled", "0");
	DispatchSpawn(Entity);
	//SetEdictFlags(Entity, FL_EDICT_DONTSEND | FL_EDICT_FULL);
	SetEdictFlags(Entity, GetEdictFlags(Entity) | FL_EDICT_DONTSEND);
	return Entity;

}

int SpawnItemElite()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("weapon_deagle")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "weapon_deagle_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_item_deagle");
	DispatchKeyValue(Entity, "hammerid", "11051995");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "ammo", "1337");
	DispatchKeyValue(Entity, "origin", "-7600 -13990 872.46");
	DispatchKeyValue(Entity, "spawnflags", "1");
	DispatchKeyValue(Entity, "OnPlayerPickUp", "!activator,AddOutput,targetname plebnemesisfag,0,1");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnItemRotating()
{
	int Entity;

	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("func_rotating")) == INVALID_ENT_REFERENCE)
		return -1;

	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "func_rotating_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_item_rotating");
	DispatchKeyValue(Entity, "origin", "-7600 -13990 872.46");
	DispatchKeyValue(Entity, "maxspeed", "40");
	DispatchKeyValue(Entity, "spawnflags", "65");
	DispatchKeyValue(Entity, "parentname", "secret_item_deagle");

	DispatchSpawn(Entity);
	ActivateEntity(Entity);

	SetEntityModel(Entity, "models/effects/vol_light64x256.mdl");
	float minbounds[3] = {-100.25, -100.25, -10.0};
	float maxbounds[3] = {100.25, 100.25, 10.0};
	SetEntPropVector(Entity, Prop_Send, "m_vecMins", minbounds);
	SetEntPropVector(Entity, Prop_Send, "m_vecMaxs", maxbounds);
	SetEntProp(Entity, Prop_Send, "m_nSolidType", 2);
	int enteffects = GetEntProp(Entity, Prop_Send, "m_fEffects");
	enteffects |= 32;
	SetEntProp(Entity, Prop_Send, "m_fEffects", enteffects);
	return Entity;
}

int SpawnItemRotatingOrange()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic_override")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_override_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_item_orange_rotating");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin","-7582.5 -13959.7 875");
	DispatchKeyValue(Entity, "model", "models/props/cs_italy/orange.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.5");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "1");
	DispatchKeyValue(Entity, "StartDisabled", "0");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnItemRotatingBanana()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic_override")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_override_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_item_banana_rotating");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "-7582.5 -14020.3 875");
	DispatchKeyValue(Entity, "model", "models/props/cs_italy/bananna.mdl");
	DispatchKeyValue(Entity, "modelscale", "1.5");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "1");
	DispatchKeyValue(Entity, "StartDisabled", "0");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnItemRotatingMelon()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic_override")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_override_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_item_melon_rotating");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "-7635 -13990 875");
	DispatchKeyValue(Entity, "model", "models/props_junk/watermelon01.mdl");
	DispatchKeyValue(Entity, "modelscale", "0.8");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "1");
	DispatchKeyValue(Entity, "StartDisabled", "0");

	DispatchSpawn(Entity);
	return Entity;

}

int SpawnItemRotatingMelonBeam()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("prop_dynamic_override")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "prop_dynamic_override_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_item_melon_rotating_beam");
	DispatchKeyValue(Entity, "angles", "0 0 0");
	DispatchKeyValue(Entity, "origin", "-7565 -13990 875");
	DispatchKeyValue(Entity, "model", "models/props_junk/watermelon01.mdl");
	DispatchKeyValue(Entity, "modelscale", "0.1");
	DispatchKeyValue(Entity, "disablereceiveshadows", "1");
	DispatchKeyValue(Entity, "disableshadows", "1");
	DispatchKeyValue(Entity, "solid", "0");
	DispatchKeyValue(Entity, "rendermode", "10");
	DispatchKeyValue(Entity, "StartDisabled", "0");
	DispatchSpawn(Entity);
	//SetEdictFlags(Entity, FL_EDICT_DONTSEND | FL_EDICT_FULL);
	SetEdictFlags(Entity, GetEdictFlags(Entity) | FL_EDICT_DONTSEND);
	return Entity;

}

int SpawnItemBeam()
{
	int Entity;
	// Spawn dynamic prop entity
	if ((Entity = CreateEntityByName("env_beam")) == INVALID_ENT_REFERENCE)
		return -1;
	// Generate unique id for the entity
	char StrEntityName[64]; Format(StrEntityName, sizeof(StrEntityName), "env_beam_%i", Entity);

	// Setup entity
	DispatchKeyValue(Entity, "targetname", "secret_item_beam");
	DispatchKeyValue(Entity, "BoltWidth", "1");
	DispatchKeyValue(Entity, "decalname", "Bigshot");
	DispatchKeyValue(Entity, "framerate", "0");
	DispatchKeyValue(Entity, "framestart", "0");
	DispatchKeyValue(Entity, "life", "1");
	DispatchKeyValue(Entity, "spawnflags", "9");
	DispatchKeyValue(Entity, "LightningStart", "secret_item_melon_rotating");
	DispatchKeyValue(Entity, "LightningEnd", "secret_item_melon_rotating_beam");
	DispatchKeyValue(Entity, "texture", "sprites/laserbeam.spr");

	DispatchSpawn(Entity);
	return Entity;
}
