- Code: Select all
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
namespace MCDzienny
{
public class CmdIgnore : Command
{
public override string name { get { return "ignore"; } }
public override string shortcut { get { return ""; } }
public override string type { get { return "other"; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Guest; } }
public CmdIgnore() { }
public static byte lastused = 0;
public static string ignore = "";
public static string ignore2 = "";
public override void Use(Player p, string message)
{
if (p == null) { Player.SendMessage(p, "This command can only be used in-game!"); return; }
if (message.Split(' ')[0] == "all")
{
p.ignoreglobal = !p.ignoreglobal;
p.muteGlobal = p.ignoreglobal;
if (p.ignoreglobal) Player.globalignores.Add(p.name);
else Player.globalignores.Remove(p.name);
Player.SendMessage(p, p.ignoreglobal ? "&cAll chat is now ignored!" : "&aAll chat is no longer ignored!");
return;
}
if (message.Split(' ')[0] == "global")
{
p.muteGlobal = !p.muteGlobal;
Player.SendMessage(p, p.muteGlobal ? "&cGlobal Chat is now ignored!" : "&aGlobal Chat is no longer ignored!");
return;
}
if (message.Split(' ')[0] == "list")
{
Player.SendMessage(p, "&cCurrently ignoring the following players:");
foreach (string ignoring in p.listignored)
{
Player.SendMessage(p, "- " + ignoring);
}
return;
}
Player who = Player.Find(message.Split(' ')[0]);
if (who == null)
{
Player.SendMessage(p, "Could not find player specified!");
return;
}
if (who.name == p.name)
{
Player.SendMessage(p, "You cannot ignore yourself!!");
return;
}
if (who.group.Permission >= Server.opchatperm)
{
if (p.group.Permission <= who.group.Permission)
{
Player.SendMessage(p, "You cannot ignore an operator of higher rank!");
return;
}
}
if (!Directory.Exists("ranks/ignore"))
{
Directory.CreateDirectory("ranks/ignore");
}
if (!File.Exists("ranks/ignore/" + p.name + ".txt"))
{
File.Create("ranks/ignore/" + p.name + ".txt").Dispose();
}
string chosenpath = "ranks/ignore/" + p.name + ".txt";
if (!File.Exists(chosenpath) || !p.listignored.Contains(who.name))
{
p.listignored.Add(who.name);
Player.SendMessage(p, "Player now ignored: &c" + who.name + "!");
return;
}
if (p.listignored.Contains(who.name))
{
p.listignored.Remove(who.name);
Player.SendMessage(p, "Player is no longer ignored: &a" + who.name + "!");
return;
}
Player.SendMessage(p, "Something is stuffed.... Tell a MCForge Developer!");
}
public override void Help(Player p)
{
Player.SendMessage(p, "/ignore [Player] - Ignores the specified player.");
Player.SendMessage(p, "/ignore global - Ignores the global chat.");
Player.SendMessage(p, "Note: You cannot ignore operators of higher rank!");
}
}
}
There are some problems, some things aren't defined because its a Forge Command... not mcdz :3 Is there a way to define the problems stated below in the command?
- Code: Select all
-------------------------
Error #CS1061
Message: 'MCDzienny.Player' does not contain a definition for 'ignoreglobal' and no extension method 'ignoreglobal' accepting a first argument of type 'MCDzienny.Player' could be found (are you missing a using directive or an assembly reference?)
Line: 25
-------------------------
Error #CS1061
Message: 'MCDzienny.Player' does not contain a definition for 'ignoreglobal' and no extension method 'ignoreglobal' accepting a first argument of type 'MCDzienny.Player' could be found (are you missing a using directive or an assembly reference?)
Line: 25
-------------------------
Error #CS1061
Message: 'MCDzienny.Player' does not contain a definition for 'muteGlobal' and no extension method 'muteGlobal' accepting a first argument of type 'MCDzienny.Player' could be found (are you missing a using directive or an assembly reference?)
Line: 26
-------------------------
Error #CS1061
Message: 'MCDzienny.Player' does not contain a definition for 'ignoreglobal' and no extension method 'ignoreglobal' accepting a first argument of type 'MCDzienny.Player' could be found (are you missing a using directive or an assembly reference?)
Line: 26
-------------------------
Error #CS1061
Message: 'MCDzienny.Player' does not contain a definition for 'ignoreglobal' and no extension method 'ignoreglobal' accepting a first argument of type 'MCDzienny.Player' could be found (are you missing a using directive or an assembly reference?)
Line: 27
-------------------------
Error #CS0117
Message: 'MCDzienny.Player' does not contain a definition for 'globalignores'
Line: 27
-------------------------
Error #CS0117
Message: 'MCDzienny.Player' does not contain a definition for 'globalignores'
Line: 28
-------------------------
Error #CS1061
Message: 'MCDzienny.Player' does not contain a definition for 'ignoreglobal' and no extension method 'ignoreglobal' accepting a first argument of type 'MCDzienny.Player' could be found (are you missing a using directive or an assembly reference?)
Line: 29
-------------------------
Error #CS1061
Message: 'MCDzienny.Player' does not contain a definition for 'muteGlobal' and no extension method 'muteGlobal' accepting a first argument of type 'MCDzienny.Player' could be found (are you missing a using directive or an assembly reference?)
Line: 34
-------------------------
Error #CS1061
Message: 'MCDzienny.Player' does not contain a definition for 'muteGlobal' and no extension method 'muteGlobal' accepting a first argument of type 'MCDzienny.Player' could be found (are you missing a using directive or an assembly reference?)
Line: 34
-------------------------
Error #CS1061
Message: 'MCDzienny.Player' does not contain a definition for 'muteGlobal' and no extension method 'muteGlobal' accepting a first argument of type 'MCDzienny.Player' could be found (are you missing a using directive or an assembly reference?)
Line: 35
-------------------------
Error #CS1061
Message: 'MCDzienny.Player' does not contain a definition for 'listignored' and no extension method 'listignored' accepting a first argument of type 'MCDzienny.Player' could be found (are you missing a using directive or an assembly reference?)
Line: 41
-------------------------
Error #CS1061
Message: 'MCDzienny.Player' does not contain a definition for 'listignored' and no extension method 'listignored' accepting a first argument of type 'MCDzienny.Player' could be found (are you missing a using directive or an assembly reference?)
Line: 79
-------------------------
Error #CS1061
Message: 'MCDzienny.Player' does not contain a definition for 'listignored' and no extension method 'listignored' accepting a first argument of type 'MCDzienny.Player' could be found (are you missing a using directive or an assembly reference?)
Line: 81
-------------------------
Error #CS1061
Message: 'MCDzienny.Player' does not contain a definition for 'listignored' and no extension method 'listignored' accepting a first argument of type 'MCDzienny.Player' could be found (are you missing a using directive or an assembly reference?)
Line: 85
-------------------------
Error #CS1061
Message: 'MCDzienny.Player' does not contain a definition for 'listignored' and no extension method 'listignored' accepting a first argument of type 'MCDzienny.Player' could be found (are you missing a using directive or an assembly reference?)
Line: 87