/report (name) (reason)

/report (name) (reason)

Postby Stuwie » 05 Jun 2013, 21:24

Sorry for requesting another command but this one will be important for me to use.

I get complaints that people abuse rights, grief etc and no one is there to stop them. so I thought that they could be a command where someone can type /report (name) (reason) then it goes into a .txt file in your MCDzienny text folder. So that way I can check and see who's doing what. This might not be possible or it might be, It would be awesome if this command existed. Thanks!
Image
User avatar
Stuwie
 
Posts: 78
Joined: 27 Nov 2011, 23:49

Re: /report (name) (reason)

Postby HETAL » 05 Jun 2013, 21:31

i think this was added most probably by ismellike, search /report in the search tab
YOU HAVENT SEEN THE LAST OF ME ISMELLIKE
HETAL
 
Posts: 397
Joined: 24 May 2013, 12:10

Re: /report (name) (reason)

Postby dzienny » 05 Jun 2013, 21:35

If you want to search the forum you are probably better off using google. Write in google:
Code: Select all
/report site:mcdzienny.cba.pl


site:mcdzienny.cba.pl makes google search only this site.
User avatar
dzienny
Administrator
 
Posts: 1181
Joined: 23 Jan 2011, 14:27

Re: /report (name) (reason)

Postby Conor » 05 Jun 2013, 21:37

Stuwie wrote:Sorry for requesting another command but this one will be important for me to use.

I get complaints that people abuse rights, grief etc and no one is there to stop them. so I thought that they could be a command where someone can type /report (name) (reason) then it goes into a .txt file in your MCDzienny text folder. So that way I can check and see who's doing what. This might not be possible or it might be, It would be awesome if this command existed. Thanks!


There are about 17 of these on the forums somewhere if you search for them.

I will code a new one though, so that it saves your warning to a text file.

Do you want me to create /warn check [player] to see previous warnings for players, and /warn clear - to clear all saved warnings?

If so, this would be pretty useful yet it would take some time, so get back to me asap and I'll go ahead and code.
Conor (Conanza121)
User avatar
Conor
Coder
 
Posts: 390
Joined: 10 Oct 2012, 21:36
Location: @21Conor

Re: /report (name) (reason)

Postby ismellike » 05 Jun 2013, 21:42

Hope you're not too into it Conor, but gonna post the one I have in my server :P

Still post yours though, I might like it better.

Code: Select all
using System;
using System.IO;
using System.Threading;

namespace MCDzienny
{
    public class CmdReport : Command
    {
        public override string name { get { return "report"; } }
        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 CmdReport() { }

        public override void Use(Player p, string message)
        {
            if (String.IsNullOrEmpty(message))
            {
                Help(p);
                return;
            }
            else
            {
                if (!File.Exists("extra/report.txt"))
                {
                    File.CreateText("extra/report");
                }
                else
                {
                    string reason = "";
                    Player noob = Player.Find(message.Split(' ')[0]);
                    if (noob == null)
                    {
                        Player.SendMessage(p, message.Split(' ')[0] + " was not found.");
                        return;
                    }
                    try
                    {
                        reason = message.Substring(message.IndexOf(' ') + 1);
                    }
                    catch
                    {
                        Player.SendMessage(p, "Please enter a valid reason");
                        return;
                    }
                    File.AppendAllText("extra/report.txt", Environment.NewLine + p.name + "->" + noob.name + "--" + reason + " Map: " + p.level.name);
                    Player.SendMessage(p, "Thank you for your report :)");
                }
            }
        }

        public override void Help(Player p)
        {
            Player.SendMessage(p, "/report [name] [reason]");
        }
    }
}
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: /report (name) (reason)

Postby Stuwie » 05 Jun 2013, 21:44

Conor that would be awesome. ismellike, I use that code and it came up with ''an error as occured when using this command!'' when I typed /report.
Image
User avatar
Stuwie
 
Posts: 78
Joined: 27 Nov 2011, 23:49

Re: /report (name) (reason)

Postby Stuwie » 05 Jun 2013, 21:46

Actually my bad your code does work. If I report someone where does it go?
Image
User avatar
Stuwie
 
Posts: 78
Joined: 27 Nov 2011, 23:49

Re: /report (name) (reason)

Postby ismellike » 05 Jun 2013, 21:47

It goes in a text file called report, in the extra folder.
What a beast...
User avatar
ismellike
Coder
 
Posts: 731
Joined: 31 Oct 2012, 04:04
Location: Kansas

Re: /report (name) (reason)

Postby Stuwie » 05 Jun 2013, 21:50

ismellike, There was a file named ''report'' in extra but it wouldn't save there. I hade to make a .txt file. Now it works :).
Image
User avatar
Stuwie
 
Posts: 78
Joined: 27 Nov 2011, 23:49

Re: /report (name) (reason)

Postby Conor » 05 Jun 2013, 21:51

Ah nice job guys, I won't make one with /report check [player] and /report clear if this is suitable enough :)
Conor (Conanza121)
User avatar
Conor
Coder
 
Posts: 390
Joined: 10 Oct 2012, 21:36
Location: @21Conor


Return to Requests for Addon

Who is online

Users browsing this forum: No registered users and 4 guests

cron