abhi2011 Posted May 6, 2012 Author Share Posted May 6, 2012 This tutorial will show you how to make a report system. How it works is that you can type "/report" and a form will come where you can choose between player and bug report. Currently only bug report issupported. When the server receives the reporters name and report it will save them as a text file in the data files of the server. Also if there is already a report from someone and the player reports again the report will not be saved. (something that should also be implemented) If someone finds a way to do so please post is as a comment!Download and add frmReport to your project!Ā [http://www.freemmorpgmaker.com/files/imagehost/pics/16549863c6fa5c5faf7c441a362b2384.rar](ftp://www.freemmorpgmaker.com/files/imagehost/pics/16549863c6fa5c5faf7c441a362b2384.rar)Client Side!Add```CBugReport```in modEnumerations above```' Make sure CMSG_COUNT is below everything else```Add```Sub sendBugReport(ByVal Name As String, ByVal report As String)Dim Buffer As New clsBufferĀ Ā If Options.Debug = 1 Then On Error GoTo errorhandlerĀ Ā Set Buffer = New clsBufferĀ Ā Buffer.WriteLong CBugReportĀ Ā Buffer.WriteString NameĀ Ā Buffer.WriteString reportĀ Ā SendData Buffer.ToArrayĀ Ā Set Buffer = NothingĀ Ā 'error handlerĀ Ā Exit Suberrorhandler:Ā HandleError "sendBugReport", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContextĀ Ā Err.ClearĀ Ā Exit SubEnd Sub```At the bottom of modClientTCP.In modInput find:``` Case "/stats"Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Set Buffer = New clsBufferĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Buffer.WriteLong CGetStatsĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā SendData Buffer.ToArray()Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Set Buffer = Nothing```below it add:```Case "/report"Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā frmReport.Show```END OF CLIENT SIDE! (YEP I KNOW IT IS SMALL!)ā------------------------------------------------------------------------------------------------------------------------------SERVER SIDEAdd this in modHandleData below the long lines of address!``` HandleDataSub(CBugReport) = GetAddress(AddressOf HandleBugReport)```Add this at the end of the mod :```Sub HandleBugReport(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBufferDim Name As StringDim report As StringDim intFileHandle As IntegerĀ Ā Set Buffer = New clsBufferĀ Ā Buffer.WriteBytes DataĀ Ā Name = Buffer.ReadStringĀ Ā report = Buffer.ReadStringĀ intFileHandle = FreeFileĀ Ā Open (App.Path & "\data\bug reports.txt") For Append As #intFileHandleĀ Ā Print #intFileHandle, vbCrLf & Name & " has reported a bug - " & reportĀ Ā Close #intFileHandleEnd Sub```In modEnumerations above```' Make sure CMSG_COUNT is below everything else```add:```CBugReport```For those who have added the following piece of code```ChkDir App.Path & "\data files\", "Bug Reports"```remove it as it's not neccesaryCredits go to Me!Credits also go to zomb88 for helping me figure out how to record multiple reports in the same file! Link to comment Share on other sites More sharing options...
abhi2011 Posted May 6, 2012 Author Share Posted May 6, 2012 The player report system is out.So before I say anything please download the new frmReport. I have updated the Bug Report system post frmReport also. This is a new frmReport. The old one was glitched.[http://www.freemmorpgmaker.com/files/imagehost/pics/16549863c6fa5c5faf7c441a362b2384.rar](ftp://www.freemmorpgmaker.com/files/imagehost/pics/16549863c6fa5c5faf7c441a362b2384.rar)CLIENT SIDEIn modClientTCP add this at the bottom :```Sub sendPlayerReport(ByVal Pname As String, ByVal report As String, ByVal RPname As String)Dim Buffer As New clsBufferĀ Ā If Options.Debug = 1 Then On Error GoTo errorhandlerĀ Ā Set Buffer = New clsBufferĀ Ā Buffer.WriteLong CPlayerReportĀ Ā Buffer.WriteString PnameĀ Ā Buffer.WriteString reportĀ Ā Buffer.WriteString RPnameĀ Ā SendData Buffer.ToArrayĀ Ā Set Buffer = NothingĀ Ā 'error handlerĀ Ā Exit Suberrorhandler:Ā HandleError "sendPlayerReport", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContextĀ Ā Err.ClearĀ Ā Exit SubEnd Sub```In mod enumerations before :```' Make sure CMSG_COUNT is below everything else```add this``` CPlayerReport```CLIENT SIDE DONE* * *In mod Enumerations above```' Make sure CMSG_COUNT is below everything else```add this :```CPlayerReport```In modHandleData at the end of the initMessages() add this```HandleDataSub(CPlayerReport) = GetAddress(AddressOf HandleplayerReport)```and add this at the bottom of the mod```Sub HandleplayerReport(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBufferDim Pname As StringDim report As StringDim RPname As StringDim intFileHandle As IntegerĀ Ā Set Buffer = New clsBufferĀ Ā Buffer.WriteBytes DataĀ Ā Pname = Buffer.ReadStringĀ Ā report = Buffer.ReadStringĀ Ā RPname = Buffer.ReadStringĀ Ā intFileHandle = FreeFileĀ Ā Open (App.Path & "\data\PlayerReports.txt") For Append As #intFileHandleĀ Ā Print #intFileHandle, vbCrLf & Pname & " Reported " & RPname & " - " & reportĀ Ā Close #intFileHandleEnd Sub```THE END.If you find any bugs just post them below the community will help you. :D Link to comment Share on other sites More sharing options...
zomb88 Posted May 6, 2012 Share Posted May 6, 2012 pretty useless tutorial Link to comment Share on other sites More sharing options...
abhi2011 Posted May 6, 2012 Author Share Posted May 6, 2012 @zomb88:> pretty useless tutorialY may do you say so? And if you think it is useless y did u go through it? Link to comment Share on other sites More sharing options...
zomb88 Posted May 6, 2012 Share Posted May 6, 2012 I didnt even need to go through it i merely took 5secs to look at it.1\. Why use a whole new form for the report then use a frame or something that just gets shown.2\. Look at your File Exists check.3\. Google vb6 text files.Very basic tutorial but could be done alot better imo Link to comment Share on other sites More sharing options...
abhi2011 Posted May 6, 2012 Author Share Posted May 6, 2012 @zomb88:> I didnt even need to go through it i merely took 5secs to look at it.> > 1\. Why use a whole new form for the report then use a frame or something that just gets shown.> 2\. Look at your File Exists check.> 3\. Google vb6 text files.> > Very basic tutorial but could be done alot better imo1\. I made a frame so that 2 reporting systems can be added Bug and Player. If you want make 2 forms. Bug Report and Player Report. But it will just increase the work. And also the good thing of a frame is that if you make a frame invisible all the controls in the frame will also be invisible. If you were thinking of making both the Bug and Player report in both the same form without the frame, it will take some time to write the code for making each and every wanted control to be visible and also might confuse you.2\. What is wrong with them?3\. I will am checking them right now! Link to comment Share on other sites More sharing options...
zomb88 Posted May 6, 2012 Share Posted May 6, 2012 ĆĘĆ¢ā¬Å”ĆāĆĀ·Ā Ā Ā Ā mode is one of the following three keywords: Input, Output, or Append.When a file is opened for Output, if it does not exist, it will be created; if it does exist, its previous contents will be overwritten.and if you keep reading you might find your answer to your next step in this.. tutorial```When a file is opened for Append, if it does not exist, it will be created, if it does exist, records will be added to the file after the last record in the file (the previous contents of the file will not be overwritten).```Btw i ment making a frame on the game formā¦ not on the form you made. Link to comment Share on other sites More sharing options...
farrel24 Posted May 6, 2012 Share Posted May 6, 2012 How to Use?How to Show frmReport?are use Command Button? Link to comment Share on other sites More sharing options...
santa-clause Posted May 6, 2012 Share Posted May 6, 2012 Just make a button and double click itand add```frmReport.visible=true``` Link to comment Share on other sites More sharing options...
abhi2011 Posted May 6, 2012 Author Share Posted May 6, 2012 Btw i forgot something in modInput. Updating tutorial. ("/report")@zomb88I knew the apend thing before you told me. Just didn't know how to implement it. That is write it on the .txt file Link to comment Share on other sites More sharing options...
farrel24 Posted May 6, 2012 Share Posted May 6, 2012 @santa-clause:> Just make a button and double click it> and add> ```> frmReport.visible=true> > ```why, when pressing the Report button, automatically, the client goes exit by itself? Link to comment Share on other sites More sharing options...
zomb88 Posted May 6, 2012 Share Posted May 6, 2012 When a file is opened for Append, if it does not exist, it will be created, if it does exist, records will be added to the file after the last record in the file (the previous contents of the file will not be overwritten).If that doesnt make sense there is something wrong.hint..>! THERES ONE WORD TO CHANGEAnd you still dont get whats wrong with your file exist? Link to comment Share on other sites More sharing options...
farrel24 Posted May 6, 2012 Share Posted May 6, 2012 hmm, No Code in lblReportP ? Link to comment Share on other sites More sharing options...
abhi2011 Posted May 6, 2012 Author Share Posted May 6, 2012 @farrel24:> hmm, No Code in lblReportP ?lblreportP is a work in progress. (lblReportPlayer) Will come soon! :D Link to comment Share on other sites More sharing options...
farrel24 Posted May 6, 2012 Share Posted May 6, 2012 @abhi2011:> lblreportP is a work in progress. (lblReportPlayer) Will come soon! :Dokay, I'll wait itĀ :cheesy: Link to comment Share on other sites More sharing options...
abhi2011 Posted May 6, 2012 Author Share Posted May 6, 2012 Solved! : Figure out a way to make multiple reports recorded in the same fileSERVER SIDEReplace HandleBugReport in modHandleData with```Sub HandleBugReport(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBufferDim Name As StringDim report As StringDim intFileHandle As IntegerĀ Ā Set Buffer = New clsBufferĀ Ā Buffer.WriteBytes DataĀ Ā Name = Buffer.ReadStringĀ Ā report = Buffer.ReadStringĀ intFileHandle = FreeFileĀ Ā Open (App.Path & "\data\bug reports\" & Name & ".txt") For Append As #intFileHandleĀ Ā Print #intFileHandle, reportĀ Ā Close #intFileHandleend sub```UPDATED MAIN POST! Link to comment Share on other sites More sharing options...
zomb88 Posted May 6, 2012 Share Posted May 6, 2012 and u got rid of the file existscongratz Link to comment Share on other sites More sharing options...
abhi2011 Posted May 6, 2012 Author Share Posted May 6, 2012 Thx. Culdn't do it without u though! I never fully understood Apend except reocrds will go to the end of the text . never actually thought it will make a text file. I will work on the player report now! Link to comment Share on other sites More sharing options...
erkro1 Posted May 6, 2012 Share Posted May 6, 2012 @farrel24:> why, when pressing the Report button, automatically, the client goes exit by itself?Try:```frmReport.Show```@abhi2011:> -snip-You're missing an End Sub at the end. Link to comment Share on other sites More sharing options...
abhi2011 Posted May 6, 2012 Author Share Posted May 6, 2012 @Erwin I tried frmReport.visible using cmdbutton in frmMain. But mine didn't auto close. thx. UPDATED! Link to comment Share on other sites More sharing options...
erkro1 Posted May 6, 2012 Share Posted May 6, 2012 @abhi2011:> @Erwin I tried frmReport.visible using cmdbutton in frmMain. But mine didn't auto close. thx. UPDATED!Well, I was answering to farrel24. Link to comment Share on other sites More sharing options...
zomb88 Posted May 6, 2012 Share Posted May 6, 2012 @abhi2011:> Thx. Culdn't do it without u though! I never fully understood Apend except reocrds will go to the end of the text . never actually thought it will make a text file. I will work on the player report now!You seem like you have the willingness to learn unlike 90% or more of ppl on this community. Glad you could figure it out with some abrupt direction xD Link to comment Share on other sites More sharing options...
abhi2011 Posted May 6, 2012 Author Share Posted May 6, 2012 I know that. I also wanted to answer him but when i tried what i said i tried i had no problem. Just saying ;) Link to comment Share on other sites More sharing options...
zomb88 Posted May 6, 2012 Share Posted May 6, 2012 I think you should look at having the bug reports all save to one text file and then player reports saved to separate files, just me but thats how id probably do that. Link to comment Share on other sites More sharing options...
farrel24 Posted May 6, 2012 Share Posted May 6, 2012 thanks for your answer, I apologize because I was always a lot to askĀ :embarrassed: Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now