ArenMook

Sightseer chat command code

Dec 19th, 2017
889
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 18.45 KB | None | 0 0
  1. public void OnSubmit ()
  2.     {
  3.         string text = UIInput.current.value;
  4.         text = NGUIText.StripSymbols(text);
  5.  
  6.         if (!string.IsNullOrEmpty(text))
  7.         {
  8.             mHistory.Remove(text);
  9.             mHistory.Insert(0, text);
  10.             if (mHistory.size > 10) mHistory.RemoveAt(10);
  11.             mLast = -1;
  12.  
  13.             if (text[0] == '/')
  14.             {
  15.                 text = text.Substring(1);
  16.  
  17.                 string[] split = text.Split(new char[] { ' ' }, 2, System.StringSplitOptions.RemoveEmptyEntries);
  18.  
  19.                 if (split.Length == 2 && TwoPartCommand(split))
  20.                 {
  21.                     // Done, it's handled
  22.                 }
  23.                 else if (text == "who")
  24.                 {
  25.                     UIWindow.Show(GameWindows.instance.playerList);
  26.                 }
  27.                 else if (text == "note" || text == "setNote")
  28.                 {
  29.                     TNManager.SetPlayerData("note", null);
  30.                     AddCurrent(Localization.Get("Player note cleared"), Color.yellow);
  31.                 }
  32.                 else if (text == "ver" || text == "version")
  33.                 {
  34.                     AddCurrent(Game.FormatVersion(Game.version), Color.yellow);
  35.                 }
  36.                 else if (text == "played")
  37.                 {
  38.                     var span = new System.TimeSpan(0, 0, (int)TNManager.playedTime);
  39.                     AddCurrent(span.ToString(), Color.yellow);
  40.                 }
  41.                 else if (text == "stuck")
  42.                 {
  43.                     var vehicle = ControllableEntity.controlled as Vehicle;
  44.                     if (vehicle != null) vehicle.GetUnstuck();
  45.                 }
  46.                 else if (text == "admin")
  47.                 {
  48.                     TNManager.SetAdmin(Game.adminKey);
  49.                 }
  50.                 else if (text == "resetChat")
  51.                 {
  52.                     Resize(500, 212);
  53.                 }
  54.                 else if (text == "quit" || text == "exit")
  55.                 {
  56.                     Application.Quit();
  57.                 }
  58.                 else if (text == "fps")
  59.                 {
  60.                     UIFPSCounter.Toggle();
  61.                 }
  62.                 else if (text == "ping")
  63.                 {
  64.                     AddCurrent(TNManager.ping + " ms", Color.yellow);
  65.                 }
  66.                 else if (text == "leaveFaction")
  67.                 {
  68.                     GameFaction.Leave();
  69.                 }
  70.                 else if (text == "scenic")
  71.                 {
  72.                     Game.scenicMode = !Game.scenicMode;
  73.                 }
  74.                 else if (TNManager.isAdmin && text == "reloadServerData")
  75.                 {
  76.                     TNManager.BeginSend(Packet.RequestReloadServerConfig);
  77.                     TNManager.EndSend();
  78.                 }
  79.                 else if (text == "relocalize" || text == "reloc")
  80.                 {
  81.                     Localization.Reload();
  82.                 }
  83.                 else if (text == "startCoup")
  84.                 {
  85.                     var fac = GameFaction.mine;
  86.                     if (fac != null && !fac.isOwner) fac.StartCoup();
  87.                 }
  88.                 else if (text == "res" && GameOptions.creativeMode)
  89.                 {
  90.                     if (ControllableEntity.mine != null)
  91.                     {
  92.                         var resources = new List<ExtractableResource>();
  93.                         var pos = FloatingOrigin.positionOffset + ControllableEntity.mine.trans.position;
  94.  
  95.                         if (ResourceNode.Collect(pos.x, pos.z, resources) > 0)
  96.                         {
  97.                             text = Localization.Get(resources[0].name);
  98.  
  99.                             for (int i = 1; i < resources.size; ++i)
  100.                                 text += ", " + Localization.Get(resources[i].name);
  101.  
  102.                             UIGameChat.AddCurrent("Resources nearby: " + text);
  103.                         }
  104.                         else UIGameChat.AddCurrent("No resources nearby");
  105.                     }
  106.                 }
  107.                 else if (text == "biomes" && GameOptions.creativeMode && ProceduralTerrain.sampleFunc != null)
  108.                 {
  109.                     var worldPos = FloatingOrigin.truePosition;
  110.                     float height, shoreFactor, temperature, precipitation;
  111.                     BiomeContributions contributions;
  112.                     ProceduralTerrain.sampleFunc(worldPos.x, worldPos.z, out height, out shoreFactor, out temperature, out precipitation, out contributions);
  113.                     AddCurrent("Position: " + worldPos, Color.yellow);
  114.  
  115.                     if (contributions.biome0.contribution > 0f) AddCurrent("1. " + contributions.biome0.biome.name + " = " + contributions.biome0.contribution, Color.yellow);
  116.                     if (contributions.biome1.contribution > 0f) AddCurrent("2. " + contributions.biome1.biome.name + " = " + contributions.biome1.contribution, Color.yellow);
  117.                     if (contributions.biome2.contribution > 0f) AddCurrent("3. " + contributions.biome2.biome.name + " = " + contributions.biome2.contribution, Color.yellow);
  118.                     if (contributions.biome3.contribution > 0f) AddCurrent("4. " + contributions.biome3.biome.name + " = " + contributions.biome3.contribution, Color.yellow);
  119.                     if (contributions.biome4.contribution > 0f) AddCurrent("5. " + contributions.biome4.biome.name + " = " + contributions.biome4.contribution, Color.yellow);
  120.                     if (contributions.biome5.contribution > 0f) AddCurrent("6. " + contributions.biome5.biome.name + " = " + contributions.biome5.contribution, Color.yellow);
  121.                     if (contributions.biome6.contribution > 0f) AddCurrent("7. " + contributions.biome6.biome.name + " = " + contributions.biome6.contribution, Color.yellow);
  122.                     if (contributions.biome7.contribution > 0f) AddCurrent("8. " + contributions.biome7.biome.name + " = " + contributions.biome7.contribution, Color.yellow);
  123.                 else
  124.                 {
  125.                     bool handled = false;
  126.                     if (onCommand != null) onCommand(text, ref handled);
  127.                     if (!handled) Error("Invalid command");
  128.                 }
  129.             }
  130.             else
  131.             {
  132.                 mLastPrefix = "";
  133.                 GameChat.Send(text, MessageType.Local);
  134.             }
  135.             UIInput.current.value = "";
  136.         }
  137.         UIInput.current.isSelected = false;
  138.     }
  139.  
  140.     /// <summary>
  141.     /// Chat command made up of two components.
  142.     /// </summary>
  143.  
  144.     protected bool TwoPartCommand (string[] split)
  145.     {
  146.         string left = split[0].Trim();
  147.         string right = split[1].Trim();
  148.  
  149.         if (left == "w" || left == "a" || left == "all" || left == "world" || left == "global")
  150.         {
  151.             mLastPrefix = "/world ";
  152.             GameChat.Send(split[1], MessageType.World);
  153.         }
  154.         else if (left == "f" || left == "faction" || left == "t" || left == "team")
  155.         {
  156.             mLastPrefix = "/faction ";
  157.             GameChat.Send(split[1], MessageType.Faction);
  158.         }
  159.         else if (left == "g" || left == "group")
  160.         {
  161.             mLastPrefix = "/group ";
  162.             GameChat.Send(split[1], MessageType.Group);
  163.         }
  164.         else if (left == "mark" || left == "marker")
  165.         {
  166.             var fac = GameFaction.mine;
  167.  
  168.             if (fac != null)
  169.             {
  170.                 var pos = FloatingOrigin.truePosition;
  171.  
  172.                 if (!fac.AddMarker(new Vector2D(pos.x, pos.z), right))
  173.                 {
  174.                     var text = Localization.Get("markerErr");
  175.                     UIStatusBar.ShowError(text);
  176.                     AddCurrent(text, Color.yellow);
  177.                 }
  178.             }
  179.             else AddCurrent(Localization.Get("factionReq"), Color.yellow);
  180.         }
  181.         else if (left == "motd" && TNManager.isAdmin)
  182.         {
  183.             TNManager.SetServerData("motd", right);
  184.         }
  185.         else if (left == "spin" && GameCamera.instance != null)
  186.         {
  187.             float amount = 0f;
  188.             float.TryParse(right, out amount);
  189.             GameCamera.instance.passiveSpin = amount;
  190.         }
  191.         else if (left == "note" || left == "setNote")
  192.         {
  193.             if (right == "null")
  194.             {
  195.                 TNManager.SetPlayerData("note", null);
  196.                 AddCurrent(Localization.Get("Player note cleared"), Color.yellow);
  197.             }
  198.             else
  199.             {
  200.                 if (right.Length > 40) right = right.Substring(0, 40);
  201.                 TNManager.SetPlayerData("note", right);
  202.                 AddCurrent(Localization.Format("Player note set", right), Color.yellow);
  203.             }
  204.         }
  205.         else if (left == "rename" && TNManager.isAdmin)
  206.         {
  207.             var parts = right.Split(':');
  208.  
  209.             if (parts.Length == 2)
  210.             {
  211.                 var player = TNManager.FindPlayer(parts[0].Trim());
  212.                 if (player != null) GameChat.ChangePlayerName(player, parts[1].Trim());
  213.                 else AddCurrent(Localization.Get("Player not found"), Color.yellow);
  214.             }
  215.             else AddCurrent("/rename Current Name: NewName", Color.yellow);
  216.         }
  217.         else if (left == "goto" && GameOptions.creativeMode)
  218.         {
  219.             split = right.Split(' ');
  220.  
  221.             if (split.Length == 2)
  222.             {
  223.                 var v = new Vector3D(0.0, 20.0, 0.0);
  224.                 if (double.TryParse(split[0], out v.x) && double.TryParse(split[1], out v.z))
  225.                 {
  226.                     v.x = Game.MetersToUnits(v.x);
  227.                     v.z = Game.MetersToUnits(v.z);
  228.                     ControllableEntity.TeleportTo(v);
  229.                 }
  230.             }
  231.             else if (split.Length == 1)
  232.             {
  233.                 var player = TNManager.FindPlayer(right);
  234.                 if (player != null) ControllableEntity.TeleportTo(player.Get<Vector3D>("pos"));
  235.             }
  236.         }
  237.         else if (left == "time" && GameOptions.creativeMode)
  238.         {
  239.             float f;
  240.             var sky = TOD_Sky.instance;
  241.  
  242.             if (float.TryParse(right, out f))
  243.             {
  244.                 sky.GetComponent<TOD_Time>().ProgressTime = false;
  245.                 sky.Cycle.Hour = f;
  246.             }
  247.             else sky.GetComponent<TOD_Time>().ProgressTime = true;
  248.         }
  249.         else if (left == "rain" && GameOptions.creativeMode)
  250.         {
  251.             var weather = FindObjectOfType<Weather>();
  252.             weather.allowRain = (right == "on");
  253.         }
  254.         else if (TNManager.isAdmin && left == "addFlag")
  255.         {
  256.             var bytes = ResourceLoader.Upload("Flags/" + right + ".png");
  257.  
  258.             if (bytes != null)
  259.             {
  260.                 UIGameChat.AddCurrent("Uploaded " + right + " (" + bytes.Length.ToString("N0") + " bytes)", Color.yellow);
  261.             }
  262.             else UIGameChat.AddCurrent("Unable to find " + right, Color.yellow);
  263.         }
  264.         else if (TNManager.isAdmin && left == "upload")
  265.         {
  266.             var bytes = ResourceLoader.Upload(right);
  267.  
  268.             if (bytes != null)
  269.             {
  270.                 UIGameChat.AddCurrent("Uploaded " + right + " (" + bytes.Length.ToString("N0") + " bytes)", Color.yellow);
  271.             }
  272.             else UIGameChat.AddCurrent("Unable to find " + right, Color.yellow);
  273.         }
  274.         else if (TNManager.isAdmin && left == "setServer")
  275.         {
  276.             TNManager.SetServerData(right);
  277.         }
  278.         else if (TNManager.isAdmin && (left == "addFilter" || left == "filter"))
  279.         {
  280.             TNManager.SetServerData("Filter/" + right);
  281.         }
  282.         else if (TNManager.isAdmin && left == "removeFilter")
  283.         {
  284.             TNManager.SetServerData("Filter/" + right + " = null");
  285.         }
  286.         else if (TNManager.isAdmin && left == "removeServer")
  287.         {
  288.             TNManager.SetServerData(right, null);
  289.             UIGameChat.AddCurrent("Removed " + right, Color.yellow);
  290.         }
  291.         else if (TNManager.isAdmin && left == "allowMod")
  292.         {
  293.             if (ModManager.AllowMod(right))
  294.             {
  295.                 UIGameChat.AddCurrent("The mod [ " + right + " ] is now allowed on the server.", Color.yellow);
  296.             }
  297.             else UIGameChat.AddCurrent("The mod [ " + right + " ] must be active in order to allow it.", Color.yellow);
  298.         }
  299.         else if (TNManager.isAdmin && left == "disallowMod")
  300.         {
  301.             if (ModManager.DisallowMod(right))
  302.             {
  303.                 UIGameChat.AddCurrent("The mod [ " + right + " ] is no longer allowed on the server.", Color.yellow);
  304.             }
  305.             else UIGameChat.AddCurrent("The mod [ " + right + " ] is not in the allowed list.", Color.yellow);
  306.         }
  307.         else if (left == "addAdmin" && TNManager.isAdmin)
  308.         {
  309.             TNManager.AddAdmin(right);
  310.         }
  311.         else if (left == "removeAdmin" && TNManager.isAdmin)
  312.         {
  313.             TNManager.RemoveAdmin(right);
  314.         }
  315.         else if (GameOptions.creativeMode && left == "add")
  316.         {
  317.             var twoParts = right.Split(' ');
  318.  
  319.             if (twoParts.Length == 2)
  320.             {
  321.                 double amount;
  322.  
  323.                 if (double.TryParse(twoParts[1], out amount) && amount > 0.0 && Compound.Get(twoParts[0]) != null)
  324.                 {
  325.                     var v = ControllableEntity.mine;
  326.  
  327.                     if (v != null && v.inventory != null)
  328.                     {
  329.                         v.inventory.AddItem(new InventoryItem(twoParts[0], amount));
  330.                     }
  331.                 }
  332.             }
  333.         }
  334.         else if (left == "exe" && GameServerConfig.runTimeCode && GameOptions.creativeMode)
  335.         {
  336.             right = right.Replace("Debug.Log(", "UIGameChat.AddCurrent(");
  337.             right = right.Replace("print(", "UIGameChat.AddCurrent(");
  338.             AddCurrent("[i]Result:[/i] " + RuntimeCode.Execute(right));
  339.         }
  340.         else if (left == "exeFile" && GameServerConfig.runTimeCode && GameOptions.creativeMode)
  341.         {
  342.             AddCurrent("[i]Result:[/i] " + RuntimeCode.ExecuteFile(right));
  343.         }
  344.         else if (left == "ignore")
  345.         {
  346.             if (mIgnore.Contains(right)) Unignore(right);
  347.             else Ignore(right);
  348.         }
  349.         else if (left == "r" || left == "reply")
  350.         {
  351.             if (!string.IsNullOrEmpty(GameChat.lastPlayerPM))
  352.             {
  353.                 GameChat.Send(right, GameChat.lastPlayerPM);
  354.                 GameTools.ReplaceLinks(ref right);
  355.                 var text = Localization.Format("Chat To", GameChat.lastPlayerPM, right);
  356.  
  357.                 for (int i = 0; i < UIChatFilterTab.list.Count; ++i)
  358.                 {
  359.                     UIChatFilterTab tab = UIChatFilterTab.list[i];
  360.                     if (tab.privateChat || tab.isActive) tab.Add(text, pmColor);
  361.                 }
  362.             }
  363.             //else NGUITools.PlaySound(GameAudio.instance.error);
  364.         }
  365.         else if (left == "pm" || left == "w" || left == "whisper")
  366.         {
  367.             split = right.Split(new char[] { ':' }, 2, System.StringSplitOptions.RemoveEmptyEntries);
  368.  
  369.             if (split.Length == 2)
  370.             {
  371.                 GameChat.Send(split[1], split[0]);
  372.                 GameTools.ReplaceLinks(ref split[1]);
  373.  
  374.                 var text = Localization.Format("Chat To", split[0], split[1]);
  375.  
  376.                 for (int i = 0; i < UIChatFilterTab.list.Count; ++i)
  377.                 {
  378.                     UIChatFilterTab tab = UIChatFilterTab.list[i];
  379.                     if (tab.privateChat || tab.isActive) tab.Add(text, pmColor);
  380.                 }
  381.             }
  382.             else Error("Invalid command");
  383.         }
  384.         else if (left == "world" || left == "w" || left == "f" || left == "faction") { }
  385.         else if (left == "get")
  386.         {
  387.             right = right.Replace("\\", "/");
  388.             DataNode node = TNManager.GetServerData(right);
  389.  
  390.             if (node == null)
  391.             {
  392.                 UIGameChat.AddCurrent("No such option", Color.yellow);
  393.             }
  394.             else
  395.             {
  396.                 string[] lines = node.ToString().Split(new char[] { '\n' }, System.StringSplitOptions.RemoveEmptyEntries);
  397.  
  398.                 foreach (string s in lines)
  399.                 {
  400.                     if (s.StartsWith("\t\t")) continue;
  401.                     UIGameChat.AddCurrent(s.Replace("\t", "    "), Color.yellow);
  402.                 }
  403.             }
  404.         }
  405.         else if (left == "setName")
  406.         {
  407.             var vehicle = ControllableEntity.mine;
  408.             if (vehicle != null && vehicle.isControlledByMe) vehicle.Set("name", right);
  409.         }
  410.         else if (left == "createFaction")
  411.         {
  412.             if (GameFaction.mine != null)
  413.             {
  414.                 AddCurrent(Localization.Get("FacInvite6"), Color.yellow);
  415.             }
  416.             else
  417.             {
  418.                 var fac = GameFaction.Find(right);
  419.                 if (fac != null) AddCurrent(Localization.Get("FacInvite5"), Color.yellow);
  420.                 else GameFaction.Create(right);
  421.             }
  422.         }
  423.         else if (left == "inviteFaction")
  424.         {
  425.             var myFac = GameFaction.mine;
  426.  
  427.             if (myFac == null || !myFac.isOfficer)
  428.             {
  429.                 AddCurrent(Localization.Get("FacInvite3"), Color.yellow);
  430.             }
  431.             else
  432.             {
  433.                 var target = TNManager.FindPlayer(right);
  434.  
  435.                 if (target == null)
  436.                 {
  437.                     AddCurrent(Localization.Get("FacInvite8"), Color.yellow);
  438.                 }
  439.                 else
  440.                 {
  441.                     var existing = GameFaction.Find(target);
  442.  
  443.                     if (existing == null)
  444.                     {
  445.                         myFac.Invite(target.name);
  446.                         AddCurrent(Localization.Format("FacInvite2", target.name, myFac.name), Color.yellow);
  447.                     }
  448.                     else AddCurrent(Localization.Format("FacInvite16", target.name, existing.name, myFac.name), Color.yellow);
  449.                 }
  450.             }
  451.         }
  452.         else if (left == "kickFaction" || (!TNManager.isAdmin && left == "kick"))
  453.         {
  454.             var myFac = GameFaction.mine;
  455.             if (myFac == null || !myFac.Kick(right)) AddCurrent(Localization.Get("GenericErr"), Color.yellow);
  456.         }
  457.         else if (left == "renameFaction")
  458.         {
  459.             if (right.Contains("="))
  460.             {
  461.                 if (TNManager.isAdmin)
  462.                 {
  463.                     var parts = right.Split('=');
  464.  
  465.                     if (parts.Length == 2)
  466.                     {
  467.                         var fac = GameFaction.Find(parts[0], true);
  468.                         if (fac != null) fac.Rename(parts[1]);
  469.                     }
  470.                 }
  471.             }
  472.             else
  473.             {
  474.                 var myFac = GameFaction.mine;
  475.                 var s = right.Trim();
  476.  
  477.                 if (myFac == null || !myFac.isOwner)
  478.                 {
  479.                     AddCurrent(Localization.Get("FacInvite3"), Color.yellow);
  480.                 }
  481.                 else if (string.IsNullOrEmpty(s) || GameFaction.Find(s) != null)
  482.                 {
  483.                     AddCurrent(Localization.Get("FacInvite5"), Color.yellow);
  484.                 }
  485.                 else myFac.Rename(s);
  486.             }
  487.         }
  488.         else if (left == "promote")
  489.         {
  490.             var myFac = GameFaction.mine;
  491.             if (myFac == null || !myFac.Promote(right)) AddCurrent(Localization.Get("GenericErr"), Color.yellow);
  492.         }
  493.         else if (left == "demote")
  494.         {
  495.             var myFac = GameFaction.mine;
  496.             if (myFac == null || !myFac.Demote(right)) AddCurrent(Localization.Get("GenericErr"), Color.yellow);
  497.         }
  498.         else if (left == "war")
  499.         {
  500.             if (MyPlayer.faction != null)
  501.             {
  502.                 var other = GameFaction.Find(right);
  503.  
  504.                 if (other == null)
  505.                 {
  506.                     other = GameFaction.Find(right, true);
  507.                     if (other != null) AddCurrent(Localization.Format("War5", other.name), Color.yellow);
  508.                     else AddCurrent(Localization.Get("War4"), Color.yellow);
  509.                 }
  510.                 else if (MyPlayer.faction.HasDeclaredWarOn(other.uid))
  511.                 {
  512.                     other.MakePeace();
  513.                 }
  514.                 else other.DeclareWar();
  515.             }
  516.             else UIGameChat.AddCurrent(Localization.Get("War3"), Color.yellow);
  517.         }
  518.         else if (left == "war2")
  519.         {
  520.             if (MyPlayer.faction != null)
  521.             {
  522.                 var other = GameFaction.Find(right, true);
  523.  
  524.                 if (other == null)
  525.                 {
  526.                     AddCurrent(Localization.Get("War4"), Color.yellow);
  527.                 }
  528.                 else if (MyPlayer.faction.HasDeclaredWarOn(other.uid))
  529.                 {
  530.                     other.MakePeace();
  531.                 }
  532.                 else other.DeclareWar();
  533.             }
  534.             else UIGameChat.AddCurrent(Localization.Get("War3"), Color.yellow);
  535.         }
  536.         else if (left == "ally" || left == "alliance")
  537.         {
  538.             var myFac = GameFaction.mine;
  539.  
  540.             if (myFac != null && myFac.isOwner)
  541.             {
  542.                 var other = GameFaction.Find(right);
  543.  
  544.                 if (other == null)
  545.                 {
  546.                     other = GameFaction.Find(right, true);
  547.                     if (other != null) UIGameChat.AddCurrent(Localization.Format("Ally5", other.name), Color.yellow);
  548.                     else UIGameChat.AddCurrent(Localization.Get("War4"), Color.yellow);
  549.                 }
  550.                 else myFac.SetAlly(other, !MyPlayer.faction.IsAlliedWith(other.uid));
  551.             }
  552.             else UIGameChat.AddCurrent(Localization.Get("War3"), Color.yellow);
  553.         }
  554.         else if (left == "ally2")
  555.         {
  556.             var myFac = GameFaction.mine;
  557.  
  558.             if (myFac != null && myFac.isOwner)
  559.             {
  560.                 var other = GameFaction.Find(right, true);
  561.                 if (other == null) UIGameChat.AddCurrent(Localization.Get("War4"), Color.yellow);
  562.                 else MyPlayer.faction.SetAlly(other, !MyPlayer.faction.IsAlliedWith(other.uid));
  563.             }
  564.             else UIGameChat.AddCurrent(Localization.Get("War3"), Color.yellow);
  565.         }
  566.         else if (TNManager.isAdmin && left == "kick")
  567.         {
  568.             var player = TNManager.FindPlayer(right);
  569.             var writer = TNManager.BeginSend(Packet.RequestKick);
  570.             writer.Write(-1);
  571.  
  572.             if (player != null)
  573.             {
  574.                 writer.Write(player.id);
  575.                 TNManager.EndSend();
  576.                 AddCurrent("Kicking [" + player.name + "]", Color.yellow);
  577.             }
  578.             else
  579.             {
  580.                 writer.Write(0);
  581.                 writer.Write(right);
  582.                 TNManager.EndSend();
  583.                 AddCurrent("Kicking " + right, Color.yellow);
  584.             }
  585.         }
  586.         else if (TNManager.isAdmin && left == "ban")
  587.         {
  588.             var player = TNManager.FindPlayer(right);
  589.             var writer = TNManager.BeginSend(Packet.RequestBan);
  590.  
  591.             if (player != null)
  592.             {
  593.                 writer.Write(0);
  594.                 writer.Write(player.name);
  595.                 TNManager.EndSend();
  596.  
  597.                 writer = TNManager.BeginSend(Packet.RequestBan);
  598.                 writer.Write(player.id);
  599.                 TNManager.EndSend();
  600.                 AddCurrent("Banning [" + player.name + "]", Color.yellow);
  601.             }
  602.             else
  603.             {
  604.                 writer.Write(0);
  605.                 writer.Write(right);
  606.                 TNManager.EndSend();
  607.                 AddCurrent("Banning " + right, Color.yellow);
  608.             }
  609.         }
  610.         else if (TNManager.isAdmin && left == "unban")
  611.         {
  612.             TNManager.BeginSend(Packet.RequestUnban).Write(right);
  613.             TNManager.EndSend();
  614.             AddCurrent("Unbanning " + right, Color.yellow);
  615.         }
  616.         else return false;
  617.         return true;
  618.     }
Advertisement
Add Comment
Please, Sign In to add comment