[Small Release] Report Player (5165)

07/18/2010 02:56 .Beatz#1
Hey guys just a small release will help some people I hope.
I did not add PM/GM check to this but it can easily be added.

This is for every player so they can report players and give their reason for the report. You will need to go to your OldCODB folder and make 2 new .txt files.
Code:
reason.txt
Code:
report.txt
Now go to your NPCDialogue.cs and add this to the bottom.
Code:
#region Report Player
                            case 9873: // make sure you change this to the npc you want to use
                                {

                                    if (Control == 0)
                                    {
                                        GC.AddSend(Packets.NPCSay("What player would you like to report?"));
                                        GC.AddSend(Packets.NPCLink2("Type in players name", 1));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    else if (Control == 1)
                                    {
                                        string report = ReadString(Data);
                                        if (report != null)
                                        {
                                            string path = "C:\\OldCODB\\report.txt";
                                            StreamWriter SW;
                                            if (File.Exists(path))
                                            {
                                                SW = File.AppendText(path);
                                                SW.WriteLine(DateTime.Now + ": " + GC.MyChar.Name + ": " + report);
                                                //will write  --   Date and Time: Name: report
                                                SW.Close();
                                                Console.WriteLine("A player has been reported!");
                                            }
                                            else
                                            {
                                                SW = File.CreateText(path);
                                                SW.WriteLine(report);
                                                SW.Close();
                                                Console.WriteLine("A player has been reported!");
                                            }
                                        }
                                        GC.AddSend(Packets.NPCSay("Please type in the reason for reporting this player."));
                                        GC.AddSend(Packets.NPCSay("If the reason is not valid you will receive a warning."));
                                        GC.AddSend(Packets.NPCLink2("Type reason for report.", 2));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    else if (Control == 2)
                                    {
                                        string reason = ReadString(Data);
                                        if (reason != null)
                                        {
                                            string path = "C:\\OldCODB\\reason.txt";
                                            StreamWriter SW;
                                            if (File.Exists(path))
                                            {
                                                SW = File.AppendText(path);
                                                SW.WriteLine(DateTime.Now + ": " + GC.MyChar.Name + ": " + reason);
                                                //will write  --   Date and Time: Name: reason
                                                SW.Close();
                                                Console.WriteLine("A reason for report has been added!");
                                            }
                                            else
                                            {
                                                SW = File.CreateText(path);
                                                SW.WriteLine(reason);
                                                SW.Close();
                                                Console.WriteLine("A reason for report has been added!");
                                            }
                                        }
                                        GC.AddSend(Packets.NPCSay("Player has been reported. Thank you for helping keep the server friendly."));
                                        GC.AddSend(Packets.NPCLink("No problem.", 255));
                                        GC.AddSend(Packets.NPCSetFace(N.Avatar));
                                        GC.AddSend(Packets.NPCFinish());
                                    }
                                    break;
                                }
                            #endregion
Add this NPC
Code:
9873 1816 2 28 1036 173 105
This NPC is near to Carpenter in market.

Hit the thanks button if this helps.
07/28/2010 21:19 FrontBoy#2
thanks ;)
07/29/2010 00:27 Fish*#3
why dont u put it like: (in 1 txt)
Playername ReportedBy Reason
07/29/2010 00:44 .Beatz#4
Quote:
Originally Posted by grillmad View Post
why dont u put it like: (in 1 txt)
Playername ReportedBy Reason
Do you know what? I didn't actually think of doing that lol! Yeah that would be better. If someone wants to do that its fine by me. I would do it but I dont have the time as working on adding mob spawns to my source :)
07/30/2010 17:24 copz1337#5
Yeah really does it make sense having 2 different text files?
Btw there's a spelling error, "If the reason is not valid you will recieve a warning." should be "receive".
07/31/2010 16:08 Basser#6
Quote:
Originally Posted by copz1337 View Post
Yeah really does it make sense having 2 different text files?
Btw there's a spelling error, "If the reason is not valid you will recieve a warning." should be "received".
So, your saying it should have been received? Past simple? Really? Shit, my teachers lied to me.
07/31/2010 17:30 copz1337#7
Quote:
Originally Posted by Basser View Post
So, your saying it should have been received? Past simple? Really? Shit, my teachers lied to me.
*sigh* I meant "receive" lol ops. At least "received" is a word as well lol.
07/31/2010 17:42 Fish*#8
Quote:
Originally Posted by copz1337 View Post
*sigh* I meant "receive" lol ops. At least "received" is a word as well lol.
well, thats also a fail.
is recieve and not receive :)
07/31/2010 22:33 .Beatz#9
*updated*

Changed the spelling mistake, Sorry I was tired when I wrote this NPC :)

Also Grillmad it is Receive. Recieve is a common mis-spelling of the word.
08/01/2010 03:30 Fish*#10
True :)