Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------------------TRANSLATED TO ENGLISH FOR INSTRUCTABLES------------------------------------
- using System;
- using CSGSI;
- using CSGSI.Nodes;
- using System.IO.Ports;
- using System.Threading;
- namespace CSGO_Deneme
- {
- class Program
- {
- static SerialPort serialPort;
- static GameStateListener gsl;
- static void Main(string[] args)
- {
- serialPort = new SerialPort();
- serialPort.PortName = "COM14";
- serialPort.BaudRate = 57600;
- serialPort.Parity = Parity.None;
- serialPort.StopBits = StopBits.One;
- serialPort.DataBits = 8;
- serialPort.Handshake = Handshake.None;
- serialPort.Open();
- gsl = new GameStateListener(3000);
- gsl.NewGameState += new NewGameStateHandler(OnNewGameState);
- if (!gsl.Start())
- {
- Environment.Exit(0);
- }
- Console.WriteLine("Waiting..\n");
- }
- static bool isBombPlant = false;
- static bool isBombDefused = false;
- static bool IsRoundOver = false;
- static string PlayerName;
- public static bool Once = false;
- static int Level = 0;
- static void OnNewGameState(GameState gs)
- {
- if (Once == false)
- {
- Console.WriteLine("Player Name= " + gs.Player.Name);
- PlayerName = gs.Player.Name;
- Console.WriteLine("Oynanan Harita= " + gs.Map.Name);
- Console.WriteLine("Oynanan Mod= " + gs.Map.Mode + "\n");
- Once = true;
- serialPort.Write("1");
- }
- if (gs.Previously.Round.Phase == RoundPhase.Over) // When the new round started
- {
- isBombPlant = false;
- IsRoundOver = false;
- serialPort.Write("-");
- Console.WriteLine("-----New Round Started-----");
- Console.WriteLine("*Money= " + gs.Player.State.Money);
- Console.WriteLine("*CT=" + gs.Map.TeamCT.Score + " T=" + gs.Map.TeamT.Score);
- Console.WriteLine("Total Killed= " + gs.Player.MatchStats.Kills); ;
- Console.WriteLine("Total Death= " + gs.Player.MatchStats.Deaths);
- }
- if (gs.Previously.Player.MatchStats.Deaths != -1 && gs.Player.State.Health == 0 && gs.Player.Name == PlayerName) // If you die
- {
- Console.WriteLine("You Died!");
- Level = 0;
- serialPort.Write("-");
- }
- if (gs.Round.Phase == RoundPhase.Over && IsRoundOver == false) // If the round over
- {
- if (gs.Player.State.RoundKills != 0 && gs.Player.Name == PlayerName)
- {
- Console.Write("\nYou Killed: " + gs.Player.State.RoundKills + " Person That Round");
- if (gs.Player.State.RoundKillHS != 0)
- {
- Console.WriteLine(" And: " + gs.Player.State.RoundKillHS + " HS you Shooted");
- }
- }
- if (gs.Round.WinTeam == RoundWinTeam.CT)
- {
- if (gs.Round.Bomb == BombState.Defused)
- {
- Console.WriteLine("*CT Win the Round bu Defusing The Bomb");
- }
- if (gs.Round.Bomb != BombState.Defused)
- {
- Console.WriteLine("*CT Win the Round");
- }
- }
- if (gs.Round.WinTeam == RoundWinTeam.T)
- {
- if (gs.Round.Bomb == BombState.Exploded)
- {
- Console.WriteLine("*T Win the Round By Exploding Bomb");
- }
- if (gs.Round.Bomb == BombState.Planted || gs.Round.Bomb == BombState.Undefined)
- {
- Console.WriteLine("*T Win The Round");
- }
- }
- IsRoundOver = true;
- }
- if (!isBombPlant && gs.Round.Bomb == BombState.Planted)
- {
- Console.WriteLine("Bomb Planted");
- isBombPlant = true;
- }
- if (isBombPlant && gs.Round.Bomb == BombState.Defused && isBombDefused == false)
- {
- isBombDefused = true;
- Console.WriteLine("Bomb Defused");
- }
- if (gs.Previously.Player.State.Health != -1 && gs.Player.Name == PlayerName) // If your health reduces
- {
- if (gs.Player.State.Health != 0 && gs.Player.State.Health != 100)
- {
- Console.WriteLine(gs.Player.State.Health + " HP Left");
- if (Level == 0)
- {
- Console.WriteLine("Giving Shock");
- Level++;
- serialPort.Write("+");
- }
- }
- }
- if (gs.Previously.Player.State.Health == -1 && gs.Player.Name == PlayerName) // IF the health is stable
- {
- if (Level >0)
- {
- Level = 0;
- Console.WriteLine("Shock Canceling");
- serialPort.Write("-");
- }
- }
- if (gs.Player.State.Flashed != 0)
- {
- Console.WriteLine("Flash!");
- }
- if (gs.Previously.Player.MatchStats.Kills != -1 && gs.Round.Phase == RoundPhase.Live && gs.Player.Name == PlayerName) // IF you kill someone
- {
- Console.WriteLine(gs.Player.MatchStats.Kills - gs.Previously.Player.MatchStats.Kills + " Person You Killed");
- }
- if (Console.ReadKey(true).Key == ConsoleKey.Escape)
- {
- serialPort.Write("0");
- }
- }
- }
- }
- ---------------------------------------------------------------------------------------------------------------
- ------------------------------------ORIGINAL CODE------------------------------------
- using System;
- using CSGSI;
- using CSGSI.Nodes;
- using System.IO.Ports;
- using System.Threading;
- namespace CSGO_Deneme
- {
- class Program
- {
- static SerialPort seriPort;
- static GameStateListener gsl;
- static void Main(string[] args)
- {
- seriPort = new SerialPort();
- seriPort.PortName = "COM14";
- seriPort.BaudRate = 57600;
- seriPort.Parity = Parity.None;
- seriPort.StopBits = StopBits.One;
- seriPort.DataBits = 8;
- seriPort.Handshake = Handshake.None;
- seriPort.Open();
- gsl = new GameStateListener(3000);
- gsl.NewGameState += new NewGameStateHandler(OnNewGameState);
- if (!gsl.Start())
- {
- Environment.Exit(0);
- }
- Console.WriteLine("Bekleniliyor...\n");
- }
- static bool BombaKuruluMu = false;
- static bool BombaImhaEdildiMi = false;
- static bool ElBittiMi = false;
- static string OyuncuAdi;
- public static bool TekSeferlik = false;
- static int Duzey = 0;
- static void OnNewGameState(GameState gs)
- {
- if (TekSeferlik == false)
- {
- Console.WriteLine("Oyuncu Adı= " + gs.Player.Name);
- OyuncuAdi = gs.Player.Name;
- Console.WriteLine("Oynanan Harita= " + gs.Map.Name);
- Console.WriteLine("Oynanan Mod= " + gs.Map.Mode + "\n");
- TekSeferlik = true;
- seriPort.Write("1");
- }
- if (gs.Previously.Round.Phase == RoundPhase.Over) // Yeni Round Başladığında
- {
- BombaKuruluMu = false;
- ElBittiMi = false;
- seriPort.Write("-");
- Console.WriteLine("-----Yeni El Başladı-----");
- Console.WriteLine("*Eldeki Silah= " + gs.Player.Weapons.ActiveWeapon.Type +", "+ gs.Player.Weapons.ActiveWeapon.Name); // Sİilahı Göster
- Console.WriteLine("*Para= " + gs.Player.State.Money); // Parayı Göster
- Console.WriteLine("*CT=" + gs.Map.TeamCT.Score + " T=" + gs.Map.TeamT.Score); // Skoru Göster
- Console.WriteLine("Toplam Öldürdüğün Kişi= " + gs.Player.MatchStats.Kills); ; // Toplam Öldürülen Kişi Sayısını Göster
- Console.WriteLine("Toplam Ölüm Sayın= " + gs.Player.MatchStats.Deaths); // Toplam Ölümü Göster
- }
- if (gs.Previously.Player.MatchStats.Deaths != -1 && gs.Player.State.Health == 0 && gs.Player.Name == OyuncuAdi) // Birini Öldürürsen
- {
- Console.WriteLine("Öldün");
- Duzey = 0;
- seriPort.Write("-");
- }
- if (gs.Round.Phase == RoundPhase.Over && ElBittiMi == false) // Round Biterse
- {
- if (gs.Player.State.RoundKills != 0 && gs.Player.Name == OyuncuAdi)
- {
- Console.Write("\nBu Round " + gs.Player.State.RoundKills + " Kişiye Öldürdün");
- if (gs.Player.State.RoundKillHS != 0)
- {
- Console.WriteLine(" Ve " + gs.Player.State.RoundKillHS + " Kişiye HS Attın");
- }
- }
- if (gs.Round.WinTeam == RoundWinTeam.CT) // CT Kazanır İse
- {
- if (gs.Round.Bomb == BombState.Defused)
- {
- Console.WriteLine("*Eli CT Bombayı İmha Ederek Aldı");
- }
- if (gs.Round.Bomb != BombState.Defused)
- {
- Console.WriteLine("*Eli CT Aldı");
- }
- }
- if (gs.Round.WinTeam == RoundWinTeam.T) // T Kazanır İse
- {
- if (gs.Round.Bomb == BombState.Exploded)
- {
- Console.WriteLine("*Eli T Bombayı Patlatarak Aldı");
- }
- if (gs.Round.Bomb == BombState.Planted || gs.Round.Bomb == BombState.Undefined)
- {
- Console.WriteLine("*Eli T Aldı");
- }
- }
- ElBittiMi = true;
- }
- if (!BombaKuruluMu && gs.Round.Bomb == BombState.Planted)
- {
- Console.WriteLine("Bomba Kuruldu");
- BombaKuruluMu = true;
- }
- if (BombaKuruluMu && gs.Round.Bomb == BombState.Defused && BombaImhaEdildiMi == false)
- {
- BombaImhaEdildiMi = true;
- Console.WriteLine("Bomba İmha Edildi");
- }
- if (gs.Previously.Player.State.Health != -1 && gs.Player.Name == OyuncuAdi) // Canın Azalır ise
- {
- if (gs.Player.State.Health != 0 && gs.Player.State.Health != 100)
- {
- Console.WriteLine(gs.Player.State.Health + " HP Kaldı");
- if (Duzey == 0)
- {
- Console.WriteLine("Şok Veriliyor");
- Duzey++;
- seriPort.Write("+");
- }
- }
- }
- if (gs.Previously.Player.State.Health == -1 && gs.Player.Name == OyuncuAdi) // Can Sabit İse
- {
- if (Duzey >0)
- {
- Duzey = 0;
- Console.WriteLine("Şok İptal Ediliyor");
- seriPort.Write("-");
- }
- }
- if (gs.Player.State.Flashed != 0)
- {
- Console.WriteLine("Flaşın Etkisinde");
- }
- if (gs.Previously.Player.MatchStats.Kills != -1 && gs.Round.Phase == RoundPhase.Live && gs.Player.Name == OyuncuAdi) // Birini Öldürürsen
- {
- Console.WriteLine(gs.Player.MatchStats.Kills - gs.Previously.Player.MatchStats.Kills + " Kişi Öldürdün");
- }
- if (Console.ReadKey(true).Key == ConsoleKey.Escape)
- {
- seriPort.Write("0");
- }
- }
- }
- }
- -------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement