GDSTARSFAN49/sfd-scripts-dataset huggingface dataset:
// Revive Mod Script
// Author: Ete_Sech

// Respawn delay in milliseconds
int RespawnDelay = 3000; 

// On startup event handler
public void OnStartup()
{
    // Player death event callback
    Events.PlayerDeathCallback.Start((IPlayer player, PlayerDeathArgs args) =>
    {
        if (args.Killed) {
            // Get player properties
            IUser p_User = player.GetUser();
            IProfile p_Profile = player.GetProfile();
            string p_Name = player.Name;
            PlayerModifiers p_Modifiers = player.GetModifiers();
            PlayerTeam p_Team = player.GetTeam();

            // Get random spawner
            Random RND = new Random();
            if (Game.GetObjectsByName("SpawnPlayer").Length < 1) { Game.CreateObject("SpawnPlayer", new Vector2(0,0));}
            Vector2 Spawners = Game.GetObjectsByName("SpawnPlayer")[RND.Next(Game.GetObjectsByName("SpawnPlayer").Length)].GetWorldPosition();

            // Create timer to respawn player
            var timer = new System.Timers.Timer(RespawnDelay);
            timer.AutoReset = false;
            timer.Elapsed += (sender, e) => {
                // Create new player
                IPlayer cpu = Game.CreatePlayer(Spawners);
                cpu.SetBotName(p_Name);
                cpu.SetUser(p_User);
                cpu.SetProfile(p_Profile);
                cpu.SetModifiers(p_Modifiers);
                cpu.SetTeam(p_Team);
                cpu.SetHealth(p_Modifiers.MaxHealth);
                player.Remove();
            };
            timer.Start();
        }
    });
}
public void OnStartup(){
Game.RunCommand("/MSG ----------------------------");
Game.RunCommand("/MSG *FLY MOD !");
Game.RunCommand("/MSG *Press [Walk_Key] to start flying !");
Game.RunCommand("/MSG *By Ete_Sech");
Game.RunCommand("/MSG ----------------------------");
IObjectTimerTrigger timer0 = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
timer0.SetIntervalTime(50);
timer0.SetRepeatCount(0);
timer0.SetScriptMethod("FlyMethod");
timer0.Trigger();
}

public void FlyMethod(TriggerArgs args){
foreach(IPlayer ply in Game.GetPlayers()){
if(ply.IsWalking){
ply.SetLinearVelocity(new Vector2(ply.FacingDirection *2,3));
Game.PlayEffect("STM" ,ply.GetWorldPosition());
}}}
uint DynamicObjectsThreshold = 125; // Threshold for currently spawned Dynamic Objects. Default: 125
bool DestroyShells = false; // Destroys shells fired from weapons. Default: false
bool DisableMusic = false; // Disables music. Default: false
bool RemoveBG = false; // Removes all the BG from the game. Default: false

public void AfterStartup() {
  //if (Game.GetMapType() == MapType.Campaign) DynamicObjectsThreshold *= 2; // Failsafe to prevent campaigns to break
  Events.PlayerDeathCallback.Start(OnPlayerDeath);
  Events.ObjectCreatedCallback.Start(OnObjectCreated);
  Events.ObjectTerminatedCallback.Start(OnObjectTerminated);
  if (DisableMusic) {
    foreach(IObjectMusicTrigger musicTriggers in Game.GetObjects < IObjectMusicTrigger > ()) musicTriggers.Remove();
    ((IObjectMusicTrigger) Game.CreateObject("MusicTrigger")).Trigger();
  }
  if (RemoveBG) foreach(IObject BG in Game.GetObjects < IObject > ().Where(b => b.Name.StartsWith("Bg"))) BG.Remove();
}
public void OnPlayerDeath(IPlayer player, PlayerDeathArgs args) {
  Game.PlayEffect("GIB", player.GetWorldPosition());
  player.Remove();
}
uint DynamicObjects = 0;
string[] Debris = {
  "Giblet",
  "Debris",
  "_D",
  "GlassShard00A",
  "StreetsweeperCratePart",
};
string[] Shells = {
  "ShellBig",
  "ShellSmall",
  "ShellShotgun",
  "ShellGLauncher",
  "MagDrum",
  "MagSmall",
  "MagSMG",
  "MagAssaultRifle"
};
public void OnObjectCreated(IObject[] objs) {
  var List = new List < string > ();
  List.AddRange(Debris);
  List.AddRange(Shells);
  string[] DebrisShells = List.ToArray();
  foreach(IObject obj in objs) {
    for (int i = 0; i < Debris.Length; i++)
      if (obj.Name.Contains(Debris[i])) obj.Remove();
    if (DestroyShells)
      for (int i = 0; i < Shells.Length; i++)
        if (obj.Name.Contains(Shells[i])) obj.Remove();
    if (obj.GetBodyType() == BodyType.Dynamic && !(obj is IObjectWeaponItem) && !obj.Name.Contains("Thrown") && !DebrisShells.Any(s => obj.Name.Contains(s)))
      if (DynamicObjects > DynamicObjectsThreshold) obj.Remove();
      else DynamicObjects++;
  }
  //Game.WriteToConsole("Dynamic Objects:", DynamicObjects);
}
public void OnObjectTerminated(IObject[] objs) {
  var List = new List < string > ();
  List.AddRange(Debris);
  List.AddRange(Shells);
  string[] DebrisShells = List.ToArray();
  foreach(IObject obj in objs)
  if (obj.GetBodyType() == BodyType.Dynamic && obj.DestructionInitiated && !obj.Name.Contains("Thrown") && !(obj is IObjectWeaponItem) && !DebrisShells.Any(s => obj.Name.Contains(s)))
    if (DynamicObjects != 0) DynamicObjects--;
  //Game.WriteToConsole("Dynamic Objects:", DynamicObjects);
}
string[] Trails = {
  "NONE",
  "POINT",
  "BLOOD",
  "SMOKE",
  "STEAM",
  "GLEAM",
  "FIRE",
  "AIR",
  "MONEY",
  "CIRCLE"
};
public void OnStartup() {
  Events.UserMessageCallback.Start((UserMessageCallbackArgs args) => {
    if (args.IsCommand && args.Command != String.Empty)
      switch (args.Command) {
      case "TRAIL":
        if (Trails.All(s => args.CommandArguments.ToUpper() != s))
          Game.ShowChatMessage("Provide a trail to set. See /TRAILLIST for available trails", Color.Red, args.User.UserIdentifier);
        else {
          Game.LocalStorage.SetItem("Trail" + args.User.AccountName, args.CommandArguments.ToUpper());
          Game.ShowChatMessage("Trail " + args.CommandArguments.ToUpper() + " set!", Color.Green, args.User.UserIdentifier);
        }
        break;
      case "TRAILLIST":
        Game.ShowChatMessage("Available trails:", Color.Green, args.User.UserIdentifier);
        for (int i = 0; i < Trails.Length; i++)
          Game.ShowChatMessage(Trails[i], Color.Green, args.User.UserIdentifier);
        break;
      }
  });
  Events.UpdateCallback.Start(e => {
    foreach(IPlayer player in Game.GetPlayers().Where(x => x.IsUser && !x.IsDead && x.GetLinearVelocity() != Vector2.Zero)) {
      string Effect;
      if (Game.LocalStorage.TryGetItemString("Trail" + player.GetUser().AccountName, out Effect))
        switch (Effect) {
        case "POINT":
          Game.PlayEffect("CFTXT", player.GetWorldPosition(), ".");
          break;
        case "BLOOD":
          Game.PlayEffect("TR_B", player.GetWorldPosition());
          break;
        case "SMOKE":
          Game.PlayEffect("TR_S", player.GetWorldPosition());
          break;
        case "STEAM":
          Game.PlayEffect("TR_D", player.GetWorldPosition());
          break;
        case "GLEAM":
          Game.PlayEffect("GLM", player.GetWorldPosition());
          break;
        case "FIRE":
          Game.PlayEffect("FNDTRA", player.GetWorldPosition());
          break;
        case "AIR":
          Game.PlayEffect("BST_S", player.GetWorldPosition());
          break;
        case "MONEY":
          Game.PlayEffect("BulletHitMoney", player.GetWorldPosition() - new Vector2(0, 10));
          break;
        case "CIRCLE":
          Game.PlayEffect("BulletHit", player.GetWorldPosition());
          break;
        }
    }
  }, 50);
}
public Events.ObjectCreatedCallback Event = null;

public void OnStartup()
{
	Events.ObjectCreatedCallback.Start(OnObjectCreate);
}

public void OnObjectCreate(IObject[] objs)
{
	foreach (IObject obj in objs)
		if (obj.Name == "StreetsweeperCrate")
			obj.Remove();
}
public static Events.PlayerDeathCallback e_PlayerDeath = null;
public static Events.ObjectCreatedCallback e_ObjectCreated = null;

public static void OnStartup(){
e_PlayerDeath = Events.PlayerDeathCallback.Start(OnPlayerDeath);
e_ObjectCreated = Events.ObjectCreatedCallback.Start(OnObjectCreated);
}

public static void OnPlayerDeath(IPlayer ply, PlayerDeathArgs args){
	if(!args.Removed)
		CreateTimer(5000, 1, "DestroyObject", ply.UniqueID.ToString());
}

public static void OnObjectCreated(IObject[] objects){
	
	foreach(IObject obj in objects){
		
		if(obj.Name.Contains("Giblet"))
			CreateTimer(5000, 1, "DestroyObject", obj.UniqueID.ToString());

		if(obj.Name.Contains("Organ"))
			CreateTimer(5000, 1, "DestroyObject", obj.UniqueID.ToString());

		if(obj.Name.Contains("Brain"))
			CreateTimer(5000, 1, "DestroyObject", obj.UniqueID.ToString());

		if(obj.Name.Contains("Head"))
			CreateTimer(5000, 1, "DestroyObject", obj.UniqueID.ToString());

		if(obj.Name.Contains("Debris"))
			CreateTimer(5000, 1, "DestroyObject", obj.UniqueID.ToString());

		if(obj.Name.Contains("_D"))
			CreateTimer(5000, 1, "DestroyObject", obj.UniqueID.ToString());

		if(obj.Name.Contains("Part"))
			CreateTimer(5000, 1, "DestroyObject", obj.UniqueID.ToString());

		if(obj.Name.Contains("GlassShard"))
			CreateTimer(5000, 1, "DestroyObject", obj.UniqueID.ToString());
	}
}

public void DestroyObject(TriggerArgs args){
	
	if(args.Caller is IObject){
		string cID = (args.Caller as IObject).CustomID;
		
		IObject obj = Game.GetObject(Int32.Parse(cID));
		
		if(obj != null)
			obj.Destroy();

				(args.Caller as IObject).Remove();
	}
}

public static void CreateTimer(int interval, int count, string method, string id) {
    IObjectTimerTrigger timerTrigger = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); 
    timerTrigger.SetIntervalTime(interval);
    timerTrigger.SetRepeatCount(count);
    timerTrigger.SetScriptMethod(method);
    timerTrigger.CustomId = id;
    timerTrigger.Trigger();
}
// Jetpack Script.
// Made by ClockworkDice
// Enhanced by Phantom

// You can change energy consumption
byte energyConsume = 5;

public void AfterStartup()
{
	IObjectTimerTrigger Timer0 = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
	Timer0.SetIntervalTime(100);
	Timer0.SetRepeatCount(0);
	Timer0.SetScriptMethod("Jetpack");
	Timer0.Trigger();
}

PlayerModifiers modify = new PlayerModifiers();
public void Jetpack(TriggerArgs args)
{
	foreach(IPlayer ply in Game.GetPlayers())
	{
		if(ply.GetEnergy() > energyConsume && ply.IsWalking && !ply.IsClimbing && !ply.IsBot && !ply.IsDead && !ply.IsCrouching && !ply.IsFalling && !ply.IsStunned && !ply.IsStaggering && !ply.IsRolling && !ply.IsLayingOnGround)
		{
			Game.PlayEffect("STM", ply.GetWorldPosition() + new Vector2(0, -3));
			modify.CurrentEnergy = ply.GetEnergy() - energyConsume;
			ply.SetModifiers(modify);
			ply.SetLinearVelocity(ply.GetLinearVelocity() + new Vector2(0,3));
			if (ply.CaughtByPlayerInGrabID != 0)
			{
				IPlayer tempPly = Game.GetPlayer(ply.CaughtByPlayerInGrabID);
				tempPly.SetLinearVelocity(tempPly.GetLinearVelocity() + new Vector2(0,3));
			}
			else if (ply.CaughtByPlayerInDiveID != 0)
			{
				IPlayer tempPly = Game.GetPlayer(ply.CaughtByPlayerInDiveID);
				tempPly.SetLinearVelocity(tempPly.GetLinearVelocity() + new Vector2(0,3));
			}
		}
	}
}
//Health 200f Script.
//Made by ClockworkDice
//mapmodes: versus, custom, campaign, survival
List <IPlayer> Teleporters = new List<IPlayer>();
List <IPlayer> NonTeleporters = new List<IPlayer>();
List <IPlayer> Teleporters1 = new List<IPlayer>();
List <IPlayer> NonTeleporters1 = new List<IPlayer>();
List <IPlayer> Teleporters2 = new List<IPlayer>();
List <IPlayer> NonTeleporters2 = new List<IPlayer>();
List <IPlayer> Teleporters3 = new List<IPlayer>();
List <IPlayer> NonTeleporters3 = new List<IPlayer>();

public void OnStartup(){
IObjectTimerTrigger Timer = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
Timer.SetIntervalTime(5);
Timer.SetRepeatCount(0);
Timer.SetScriptMethod("Telepor");
Timer.Trigger();
foreach(IPlayer ply in Game.GetPlayers()){
if(ply.IsUser){
Teleporters.Add(ply);
Teleporters1.Add(ply);
Teleporters2.Add(ply);
Teleporters3.Add(ply);
}
}
}


public void Telepor(TriggerArgs args){
for (int i = NonTeleporters.Count-1;i>=0;i--){
IPlayer ply = NonTeleporters[i];
if(!ply.IsJumpAttacking){
NonTeleporters.Remove(ply);
Teleporters.Add(ply);
}
}
for (int i = Teleporters.Count-1;i>=0;i--){
IPlayer ply =Teleporters[i];
Vector2 Here = ply.GetWorldPosition();
if(ply.IsJumpAttacking && ply.IsInMidAir){
Vector2 pos = ply.GetWorldPosition() + new Vector2 (-5,0);
Vector2 dir = new Vector2 (-1,0);
ply.SetLinearVelocity(new Vector2(0,1));
Teleporters.Remove(ply);
NonTeleporters.Add(ply);
}
}
for (int i = NonTeleporters1.Count-1;i>=0;i--){
IPlayer ply = NonTeleporters1[i];
if(!ply.IsJumpKicking){
NonTeleporters1.Remove(ply);
Teleporters1.Add(ply);
}
}
for (int i = Teleporters1.Count-1;i>=0;i--){
IPlayer ply =Teleporters1[i];
Vector2 Here = ply.GetWorldPosition();
if(ply.IsJumpKicking && ply.IsInMidAir){
Vector2 pos = ply.GetWorldPosition() + new Vector2 (-5,0);
Vector2 dir = new Vector2 (-1,0);
ply.SetLinearVelocity(new Vector2(0,1));
Teleporters1.Remove(ply);
NonTeleporters1.Add(ply);
}
}
for (int i = NonTeleporters2.Count-1;i>=0;i--){
IPlayer ply = NonTeleporters2[i];
if(!ply.IsJumpKicking && ply.IsInMidAir){
NonTeleporters2.Remove(ply);
Teleporters2.Add(ply);
}
}
for (int i = Teleporters2.Count-1;i>=0;i--){
IPlayer ply =Teleporters2[i];
Vector2 Here = ply.GetWorldPosition();
if(ply.IsJumpKicking && ply.IsInMidAir && ply.IsWalking){
Vector2 pos = ply.GetWorldPosition() + new Vector2 (-5,0);
Vector2 dir = new Vector2 (-1,0);
ply.SetLinearVelocity(new Vector2(0,5));
Teleporters2.Remove(ply);
NonTeleporters2.Add(ply);
}
}
for (int i = NonTeleporters3.Count-1;i>=0;i--){
IPlayer ply = NonTeleporters3[i];
if(!ply.IsJumpAttacking && ply.IsInMidAir){
NonTeleporters3.Remove(ply);
Teleporters3.Add(ply);
}
}
for (int i = Teleporters3.Count-1;i>=0;i--){
IPlayer ply =Teleporters3[i];
Vector2 Here = ply.GetWorldPosition();
if(ply.IsJumpAttacking && ply.IsInMidAir && ply.IsWalking){
Vector2 pos = ply.GetWorldPosition() + new Vector2 (-5,0);
Vector2 dir = new Vector2 (-1,0);
ply.SetLinearVelocity(new Vector2(0,5));
Teleporters3.Remove(ply);
NonTeleporters3.Add(ply);
}
}
}
/*                                                          
Hello there sfdmaps moderator (￣y▽,￣)╭ 
I hope you're having a good day
*/

public void OnStartup(){
	Events.PlayerKeyInputCallback.Start((player, keyEvents) => {
		//If the player is pressing the walking key...
		//Here I would use a virtual key, but the only available one is CROUCH_ROLL_DIVE, and that counts for all three actions (Crouch/Roll/Dive). So I'll just check .IsRolling
		if(player.KeyPressed(VirtualKey.WALKING) && player.IsRolling){

			if(player.IsOnGround){
				
				player.SetLinearVelocity(player.GetLinearVelocity() + new Vector2(0f,8f));
				
			} else {
				player.SetLinearVelocity(player.GetLinearVelocity() + new Vector2(player.FacingDirection * 12f, 0));
			}

		}
	});
}
// 	Wolverine Script
//		By Phantom
// 	Idea by "jeremyssf6"

// Player name who will become Wolverine
string name = "Wolverine";

// You can change Wolverine Claws into any melee weapon you want :)
// E.g: Just change "WeaponItem.KNIFE" into "WeaponItem.AXE"
WeaponItem CLAWS = WeaponItem.KNIFE;

List<IPlayer> Players = new List<IPlayer>();
IPlayer Wolverine;

IObjectTimerTrigger Timer0 = null;
Vector2 pos = new Vector2();
Vector2 pos2 = new Vector2();
PlayerModifiers modify = new PlayerModifiers();

public void OnStartup()
{
	foreach (IPlayer ply in Game.GetPlayers())
	{
		if (!ply.IsBot && ply.Name == name)
		{
			Players.Add(ply);
		}
	}
	if (Players.Count > 0)
	{
		Random rand = new Random();
		int num = rand.Next(Players.Count);
		Wolverine = Players[num];
	}
	else Wolverine = null;
	if (Wolverine != null)
	{
		Events.UpdateCallback.Start(Update, 100);
		Timer(Timer0, 200, "Effect", 0);
	}
}

public void Update(float elapsed)
{
	// When Wolverine has claws out
	if (Wolverine.CurrentMeleeMakeshiftWeapon.WeaponItem == WeaponItem.NONE && Wolverine.CurrentMeleeWeapon.WeaponItem == CLAWS && Wolverine.CurrentWeaponDrawn == WeaponItemType.Melee)
	{
		// Disables Wolverine to throw it's claws
		if (Wolverine.InThrowingMode)
		{
			Wolverine.RemoveWeaponItemType(WeaponItemType.Melee);
			Wolverine.GiveWeaponItem(CLAWS);
		}

		// Set infinite hp of claws when on main hand
		else if (!Wolverine.InThrowingMode)
		{
			modify.InfiniteAmmo = 1;
			Wolverine.SetModifiers(modify);
		}
	}

	// Sets finite hp for other weapons
	else
	{
		modify.InfiniteAmmo = 0;
		Wolverine.SetModifiers(modify);
	}

	// Gives Wolverine claws when holding nothing
	if (Wolverine.CurrentMeleeWeapon.WeaponItem == WeaponItem.NONE)
	{
		Wolverine.GiveWeaponItem(CLAWS);
	}

	// Heals Wolverine when idle and have health lower than 100 
	else if (Wolverine.IsIdle && Wolverine.GetHealth() <= 100)
	{
		Wolverine.SetHealth(Wolverine.GetHealth() + 0.1f);
	}
}

public void Effect(TriggerArgs args)
{
	pos = Wolverine.GetWorldPosition();
	pos2 = Wolverine.GetWorldPosition();
	pos.Y += 0.5f;
	pos2.Y += 9.5f;
	Game.PlayEffect(EffectName.BloodTrail, pos);
	Game.PlayEffect(EffectName.BloodTrail, pos2);
}

public void Timer(IObjectTimerTrigger timer, int delay, string method, int repeat)
{
	timer = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger");
	timer.SetIntervalTime(delay);
	timer.SetRepeatCount(repeat);
	timer.SetScriptMethod(method);
	timer.Trigger();
}
public void OnStartup()
{
    foreach (IUser user in Game.GetActiveUsers())
        user.GetPlayer().SetCameraSecondaryFocusMode(CameraFocusMode.Ignore);

    foreach (IObject obj in Game.GetObjectsByName(new string[] { "PlayerSpawnTrigger", "Streetsweeper" }))
    {
        if (obj is IObjectPlayerSpawnTrigger)
            ((IObjectPlayerSpawnTrigger)obj).SetCameraSecondaryFocusMode(CameraFocusMode.Ignore);
        else if (obj is IObjectStreetsweeper)
            ((IObjectStreetsweeper)obj).SetCameraSecondaryFocusMode(CameraFocusMode.Ignore);
    }

    Events.ObjectCreatedCallback.Start(Guard);
}

public void Guard(IObject[] objs)
{
    foreach (IObject obj in objs)
    {
        IObjectStreetsweeper temp = obj as IObjectStreetsweeper;
        if (temp != null)
            temp.SetCameraSecondaryFocusMode(CameraFocusMode.Ignore);
    }
}
//adds electrical effect to any tile



const string CUSTOM_ID = "toEffect";
const string EFFECT = "Electric";
const int CHANCES_NOEFFECT = 2;
const int CHANCES_EFFECT = 2;
const int INTERVAL_TIME = 400; //400 milliseconds



////////////////////////DO NOT CHANGE BELOW THIS LINE////////////////////////////


static Random rnd = new Random();

private List<IObject> objectsToKeep = new List<IObject>();

public void OnStartup(){
	
	CreateTimer(INTERVAL_TIME, 0,"update","0");
	
	foreach(IObject obj in Game.GetObjectsByCustomID(CUSTOM_ID)){
		objectsToKeep.Add(obj);
		Vector2 pos = obj.GetWorldPosition();
	}
}

public void update(TriggerArgs args){
	for(int a = 0; a < objectsToKeep.Count; a++){
		IObject obj = objectsToKeep[a];
		if(obj.IsRemoved || obj.RemovalInitiated){
			objectsToKeep.RemoveAt(a);
			a--;
		} else{
			int count = rnd.Next(1 - CHANCES_NOEFFECT, 1 + CHANCES_EFFECT); //options are: 0, 0, 1, or 2
			Point area = obj.GetSize();
			Point sizeFactor = obj.GetSizeFactor();
			float rotation = obj.GetAngle();
			Vector2 position = obj.GetWorldPosition();
			for(int i = 0; i < count; i++){
				float x = (float)(rnd.NextDouble() * area.X) - area.X/(sizeFactor.X * 2);
				float y = -(float)(rnd.NextDouble() * area.Y) + area.Y/(sizeFactor.Y * 2);
				if(rotation != 0){
					float rotX = (float)(x * Math.Cos(rotation) - y * Math.Sin(rotation));
					float rotY = (float)(y * Math.Cos(rotation) + x * Math.Sin(rotation));
					x = rotX;
					y = rotY;
				}
				
				Vector2 toEffect = new Vector2(x, y) + position;
				
				Game.PlayEffect("Electric",	toEffect);
			}
			
		}
	}
}


public void disable(TriggerArgs args){
	objectsToKeep = new List<IObject>();
}

public void CreateTimer(int interval, int count, string method, string id) {
	IObjectTimerTrigger timerTrigger = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); 
	timerTrigger.SetIntervalTime(interval);
	timerTrigger.SetRepeatCount(count);
	timerTrigger.SetScriptMethod(method);
	timerTrigger.CustomId = id;
	timerTrigger.Trigger();
}
int[] menxd = {0, 1, 1, 1, 1};

public void AfterStartup(){
	if(Game.TimeLimitActive){
		int time = (int)(Game.TimeLimit * 1000 * ((float)(Game.GetRemainingTimeLimit().Milliseconds)/1000f));
		CreateTimer(time,1,"death","1");
	}
	CreateTimer(1000,0,"hp","0");
	CreateTimer(5000,1,"count","2");
}
public void count(TriggerArgs args){
	for(int i = 1; i <=4; i++){
	int fags = 0;		
		foreach (IPlayer ply in Game.GetPlayers()){
			if (ply.GetTeam() == (PlayerTeam)(i)){
				++fags;
			}
		}
	menxd[i] = fags;
	}
}

public void hp(TriggerArgs args){
	List<string> assholes = new List<string>();
	for(int i = 0; i <= 4; i++){
		foreach (IPlayer ply in Game.GetPlayers()){
			if (ply.GetTeam() == (PlayerTeam)(i) && i != 0 ){
				string name = ply.GetProfile().Name;
				double hp = Math.Round(ply.GetHealth());
				if(hp != 0) assholes.Add(name + ":" + hp);
			}
			if (ply.GetTeam() == PlayerTeam.Independent && i == 0){
				string name = ply.GetProfile().Name;
				double hp = Math.Round(ply.GetHealth());
				if(hp != 0) assholes.Add(name + ":" + hp);
			}
		}
	}
	string line = string.Join(",  ", assholes.ToArray());
	Game.ShowPopupMessage(line);
	
}

public void death(TriggerArgs args){
	float LastAverage = 0;
	int winning = 0;
	float LastIndie = 0;
	bool IndieWin = false;
//	PlayerTeam[] team = {PlayerTeam.Team1, PlayerTeam.Team2, PlayerTeam.Team3, PlayerTeam.Team4};
	for(int i = 4; i >=0; i--){
		int id = 0;
		float Average = 0;

		foreach (IPlayer ply in Game.GetPlayers()){
			if (ply.GetTeam() == (PlayerTeam)(i) && i != 0){
				Average = (float)(Math.Round(Average + ply.GetHealth(), 10));
			}
			if (ply.GetTeam() == PlayerTeam.Independent && i == 0 && ply.GetHealth() > LastIndie){
				LastIndie = ply.GetHealth();
				id = ply.UserIdentifier;
//				Game.RunCommand("/MSG indie " + LastIndie);
			}
		}
		if (i != 0){
//			Game.RunCommand("/msg fags " + menxd[i]);
			Average = Average / menxd[i];
		}
		if (Average > LastAverage && i != 0){
			LastAverage = Average;
			winning = i;
//			Game.RunCommand("/MSG We are " + LastAverage);
		}else if (LastIndie > LastAverage){
			LastAverage = LastIndie;
			winning = id;
			IndieWin = true;
		}
	}

	foreach (IPlayer ply in Game.GetPlayers()){
		if (ply.UserIdentifier != winning && IndieWin == true){
			ply.Kill();
		}
		if (ply.GetTeam() != (PlayerTeam)(winning) && IndieWin == false){
			ply.Kill();
		}
	}
}


public void CreateTimer(int interval, int count, string method, string id) {
	IObjectTimerTrigger timerTrigger = (IObjectTimerTrigger)Game.CreateObject("TimerTrigger"); 
	timerTrigger.SetIntervalTime(interval);
	timerTrigger.SetRepeatCount(count);
	timerTrigger.SetScriptMethod(method);
	timerTrigger.CustomId = id;
	timerTrigger.Trigger();
}