/warn - another warn system

/warn - another warn system

Postby Catching_Fire » 23 Jul 2011, 05:48

I recently came up with this new type of a warn system. (Not to be confused with PK's warn system which is great!) this "warn" type command is Difficult to set-up, But luckily I'll help you. I would just like to note here, this does NOT link up to the /rules command, so every time you modify the /rules you need to modify the command too!

Command Does:
Well when you find a rule breaker you'll want to warn him A.S.A.P well, this warn command does that. Say you're rule 1 is "Do not flood Lava Homes" and Jerry10 over here floods them. You want to get him out of the house, And warn him. Now thats a bit hard to do at the same time. But with this warn command it sends player back to spawn and warns the player for rule 1. So you warnned him, this is what the warn will say: "Jerry10 was warned for:Do not flood Lava Homes" and sends him back to the spawn. Convenient huh?

Code:
Code: Select all
using System;

namespace MCDzienny
{
    public class CmdWarn : Command
    {
        public override string name { get { return "warn"; } }
        public override string shortcut { get { return ""; } }
        public override string type { get { return "mod"; } }
        public override bool museumUsable { get { return true; } }
        public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }

        public override void Use(Player p, string message)
        {
            string reason = message.Substring(message.IndexOf(' ') + 1).Trim();

            if (message == "")
            {
                Help(p);
                return;
            }

            Player who = Player.Find(message.Split(' ')[0]);

            // Makes sure the player is online and valid.
            if (who == null)
            {
                Player.SendMessage(p, "Player not found!");
                return;
            }

            // Code here makes it so you cannot warn your-self.
            if (who == p)
            {
                Player.SendMessage(p, "Cannot warn yourself.");
                return;
            }

            // Check the rank.
            if (p != null && p.group.Permission < who.group.Permission)
            {
                Player.SendMessage(p, "Cannot warn someone higher than you.");
                return;
            }

            // Your reason.
            if (message.Split(' ').Length == 1)
            {
                Player.SendMessage(p, "You need add a valid rule.");
            }
            else
            {
                if (reason == "1")
                {
                    Player.GlobalMessage(who.color + who.PublicName + Server.DefaultColor + " was warned: " + c.white + "1. EDIT ONLY THIS PART ADD REASON HERE");
                    Command.all.Find("spawn").Use(who, "");
                }
                else if (reason == "2")
                {
                    Player.GlobalMessage(who.color + who.PublicName + Server.DefaultColor + " was warned: " + c.white + "2. EDIT ONLY THIS PART ADD REASON HERE");
                    Command.all.Find("spawn").Use(who, "");
                }
                else if (reason == "3")
                {
                    Player.GlobalMessage(who.color + who.PublicName + Server.DefaultColor + " was warned: " + c.white + "3. EDIT ONLY THIS PART ADD REASON HERE");
                    Command.all.Find("spawn").Use(who, "");
                }
                else if (reason == "4")
                {
                    Player.GlobalMessage(who.color + who.PublicName + Server.DefaultColor + " was warned: " + c.white + "4. EDIT ONLY THIS PART ADD REASON HERE");
                    Command.all.Find("spawn").Use(who, "");
                }
                else if (reason == "5")
                {
                    Player.GlobalMessage(who.color + who.PublicName + Server.DefaultColor + " was warned: " + c.white + "5. DoEDIT ONLY THIS PART ADD REASON HERE");
                    Command.all.Find("spawn").Use(who, "");
                }
                else if (reason == "6")
                {
                    Player.GlobalMessage(who.color + who.PublicName + Server.DefaultColor + " was warned: " + c.white + "6. EDIT ONLY THIS PART ADD REASON HERE");
                    Command.all.Find("spawn").Use(who, "");
                }
                else if (reason == "7")
                {
                    Player.GlobalMessage(who.color + who.PublicName + Server.DefaultColor + " was warned: " + c.white + "7. EDIT ONLY THIS PART ADD REASON HERE.");
                    Command.all.Find("spawn").Use(who, "");
                }
                else
                {
                    Player.SendMessage(p, "Invalid rule.");
                }
            }
        }

        public override void Help(Player p)
        {
            Player.SendMessage(p, "/warn <player> [rule] - Warns a player for [rule] then sends them back to spawn. Example, /warn bob 2");
        }
    }
}


The defaut number of reasons is 7. If you must add more, Add this under the "else" in reason 7:
Code: Select all
if (reason == "REASONNUMBER")
{
    Player.GlobalMessage(who.color + who.PublicName + Server.DefaultColor + " was warned: " + c.white + "8. EDIT ONLY THIS PART ADD REASON HERE.");
    Command.all.Find("spawn").Use(who, "");
}
else


If you have any problems with this let me know. I have a free week and i am able to fix it and get right back to you.
Catching_Fire
 
Posts: 35
Joined: 23 Jul 2011, 05:31

Re: Another warn system.

Postby jkl139 » 23 Jul 2011, 11:31

Wow, thbat's some genius warn system. You made that yourself?
Image
Image
User avatar
jkl139
 
Posts: 444
Joined: 13 Jun 2011, 11:46
Location: MCDzienny Forum

Re: Another warn system.

Postby Catching_Fire » 23 Jul 2011, 21:28

Post by jkl139 » Today, 12:31
Wow, thbat's some genius warn system. You made that yourself?

Yes, Sir. Actually, Me and my good friend develop a server together and we both came up with that idea. So we both made it.
Catching_Fire
 
Posts: 35
Joined: 23 Jul 2011, 05:31

Re: Another warn system.

Postby jkl139 » 23 Jul 2011, 21:39

Great work!
Image
Image
User avatar
jkl139
 
Posts: 444
Joined: 13 Jun 2011, 11:46
Location: MCDzienny Forum

Re: Another warn system.

Postby Catching_Fire » 23 Jul 2011, 21:45

Thank you. :)
Catching_Fire
 
Posts: 35
Joined: 23 Jul 2011, 05:31

Re: Another warn system.

Postby g0d01w4r99 » 24 Jul 2011, 20:02

First real command that hasn't been seen anywhere else was posted here, nice job with this Catching_Fire. You might want to disassamble the MCDzienny.dll and find the method that tells the software to give player points, then make a new method stating that if the var PlayerWarned or something is 1, which is set to 1 when you warn a player, then that player does not get points.. however on a second thougt, that would have to be implented into the method that gives the players points, and you cant do that unless you have the source. So, Dzienny, if your up for it, take this command (with Catching_Fire's permission ofcourse) and add the no points for a warn method in it.

Cheers.
Image
User avatar
g0d01w4r99
 
Posts: 453
Joined: 09 May 2011, 13:05
Location: Behind you.

Re: Another warn system.

Postby jkl139 » 24 Jul 2011, 20:08

And its easy tho...
Image
Image
User avatar
jkl139
 
Posts: 444
Joined: 13 Jun 2011, 11:46
Location: MCDzienny Forum

Re: Another warn system.

Postby Catching_Fire » 24 Jul 2011, 20:28

First real command that hasn't been seen anywhere else was posted here, nice job with this Catching_Fire. You might want to disassamble the MCDzienny.dll and find the method that tells the software to give player points, then make a new method stating that if the var PlayerWarned or something is 1, which is set to 1 when you warn a player, then that player does not get points.. however on a second thougt, that would have to be implented into the method that gives the players points, and you cant do that unless you have the source. So, Dzienny, if your up for it, take this command (with Catching_Fire's permission ofcourse) and add the no points for a warn method in it.


That's a good idea, But it wouldn't work like that. If you edit a .DLL file it's a compiled type. So all the things are in the right order. If you add one word, or delete one thing it will completely mess up your application. So you'd need the full code of MCDziennyLava, Then add what you said into it. And then compile. I wish .DLL's stayed .CS because then id do it in a heart beat, If you know what i'm saying ;)
Catching_Fire
 
Posts: 35
Joined: 23 Jul 2011, 05:31

Re: Another warn system.

Postby PlatinumKiller » 25 Jul 2011, 14:12

Catching, will it work for me?

%f ----------------------------------------------------.
%f #1. Respect Others
%f #2. No WoM Hacks
%f #3. Do NOT Grief
%f #4. Cannot Build Where lava Cannot Get(On Top Of Maps)
%e ---------------How To Rank Up (/buy promotion)------
%d Active: %a Get To Lvl 3 (Or Buy It)
%d Survivor: %a Get To Lvl 6 (Or Buy It)
%d SuperSurvivor: %a Get to Lvl 10 (Or Buy It)
%d EpicSurvivor: %a Get to Lvl 15 (Or Buy It)
%d Trusted+: %a Get to Lvl 20 %e or %c Get Trust From LavaGod%e Also Will Be Reset To Level 1.
%f ----------------------------------------------------
Image
User avatar
PlatinumKiller
 
Posts: 388
Joined: 22 Jun 2011, 22:55
Location: MCDzienny Forums

Re: Another warn system.

Postby g0d01w4r99 » 25 Jul 2011, 16:17

Catching_Fire wrote:
First real command that hasn't been seen anywhere else was posted here, nice job with this Catching_Fire. You might want to disassamble the MCDzienny.dll and find the method that tells the software to give player points, then make a new method stating that if the var PlayerWarned or something is 1, which is set to 1 when you warn a player, then that player does not get points.. however on a second thougt, that would have to be implented into the method that gives the players points, and you cant do that unless you have the source. So, Dzienny, if your up for it, take this command (with Catching_Fire's permission ofcourse) and add the no points for a warn method in it.


That's a good idea, But it wouldn't work like that. If you edit a .DLL file it's a compiled type. So all the things are in the right order. If you add one word, or delete one thing it will completely mess up your application. So you'd need the full code of MCDziennyLava, Then add what you said into it. And then compile. I wish .DLL's stayed .CS because then id do it in a heart beat, If you know what i'm saying ;)


Yeah, I said that you'd need the MCDzienny source. I hope Dzienny decides to implent it.
Image
User avatar
g0d01w4r99
 
Posts: 453
Joined: 09 May 2011, 13:05
Location: Behind you.

Next

Return to Custom Commands

Who is online

Users browsing this forum: No registered users and 1 guest

cron