/xclientfreeze (Bare with me this time)
Posted: 20 Dec 2014, 20:16
OK so I got help and have took my coding further so hopefully it wont be like my horrific code of last time where I guessed at most factors of the code.
OLD CODE!:
Horrific I know the braces usage is horrific.
Now in 7 months of slow learning I feel it's right!
Thanks to AFK_Games helping learn I'm getting better with coding in C# (especially braces XD)
Now heres the new code. Same drill though any error let me know where they are and how to fix them as I am really enjoying my coding at the minute.
NEW AND IMPROVED CODE!:
OLD CODE!:
- Code: Select all
using System;
using System.IO;
using System.Threading;
namespace MCDzienny
{
public class clientfreeze : Command
{
public override string name { get { return "clientfreeze"; } }
public override string shortcut { get { return "cf"; } }
public override string type { get { return "other"; } }
public override bool museumUsable { get { return false; } }
public override LevelPermission defaultRank { get { return LevelPermission.trusted; } }
public override void Use(Player p, string message)
{
player who = Player.Find(message);
if (who == null)
}
Player.Sendmessage(p, message + "Player is not online");
Command.all.find("freeze").Use(p, who.name);
Player.GlobalMessage(p.color + p.publicname " has been frozen please turn off your hacks");
public override void Help(Player p)
{
Player.SendMessage(p, "/clientfreeze or /cf - Freezes the chosen player and tell them to get off their hacks.");
}
}
}
Horrific I know the braces usage is horrific.
Now in 7 months of slow learning I feel it's right!
Thanks to AFK_Games helping learn I'm getting better with coding in C# (especially braces XD)
Now heres the new code. Same drill though any error let me know where they are and how to fix them as I am really enjoying my coding at the minute.
NEW AND IMPROVED CODE!:
- Code: Select all
using System;
namespace MCDzienny
{
public class CmdXclientfreeze : Command
{
public override string name { get { return "xclientfreeze"; } }
public override string shortcut { get { return "xcf"; } }
public override string type { get { return "other"; } }
public override bool museumUsable { get { return false; } }
public override LevelPermission defaultRank { get { return LevelPermission.Operator; } }
public bool freeze = false;
public override void Use(Player p, string message)
{
Player who = Player.Find(message);
if (who == null)
{
Player.SendMessage(p, "Player is not online");
return;
}
else
{
if (who.group.Permission >= p.group.Permission)
{
Player.SendMessage(p, "Cannot client freeze a player of an equal or higher rank");
return;
}
else
{
if (freeze == false)
{
Command.all.Find("freeze").Use(p, who.name);
Player.GlobalMessage("Please turn off your client hacks immediatly!");
}
else
{
if (freeze == true)
{
Command.all.Find("freeze").Use(p, who.name);
}
}
}
}
}
public override void Help(Player p)
{
Player.SendMessage(p, "/xclientfreeze - Freezes the player for client hacking ONLY!");
}
}
}