![]() |
Optional Censoring - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51) +----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44) +------ Forum: Tutorials (https://mirage-engine.uk/forums/forumdisplay.php?fid=13) +------ Thread: Optional Censoring (/showthread.php?tid=2132) |
Optional Censoring - GIAKEN - 19-09-2008 Difficulty: ?/5 - It's not a direct C&P tutorial. I tried to explain things, but I don't have a copy of MS4 on my laptop currently so this will try to explain things as best as possible. < CLIENT SIDE > Make a new check box object on frmMirage. This will let players turn censoring on or off for themselves. Now double click the check box and add this: Code: Call SendData("censor" & END_CHAR) Now where the packets are checked, add this: Code: If Parse$(0) = "censor" Then < SERVER SIDE > Find where the player is logged in. It should be something like "LoadPlayer(Index, Name)". Add this to that section: Code: If CENSOR_ON = 1 Then Now find where all the packets are handled in the server. Add this to the list of Case's: Code: Case "censor" Open the Data.ini file and under MAX add: CENSOR=1 Now here's the magic function, in modGeneral (or wherever) add this: Code: Public Function CensorShip(ByVal Index As Long, ByVal Sentence As String) As String Add this at the top of a module: Code: ' Censoring data Find where the server is initialized (ServerInit?) and add this: Code: CENSOR_ON = GetVar(App.Path & "\Data.ini", "CONFIG", "CENSOR") This will be the piece of data in the player's collection that will tell if they want to see censors. In "PlayerRec" add this: Code: Censor As Byte Now in SavePlayer, add this after it sets the player's password: Code: Call PutVar(FileName, "GENERAL", "Censor", Trim$(Player(Index).Censor)) Now in LoadPlayer, add this after it gets the player's password: Code: Player(Index).Censor = Val(GetVar(FileName, "GENERAL", "Censor")) I'm not exactly sure where all the chat is handled, because this wasn't made for MS4. So wherever the server sends the chat to the client, you need to wrap the variable with the CensorShip function. Example: In MapMsg you'll see a loop and something like "Packet = "mapmsg" & SEP_CHAR & Msg ..." Change the Msg to: Censorship(I, Msg). Since we have each player able to turn the censoring on or off, we have to go directly inside the subs that send out the message so that it can use the function in the loop. Also make a new Censor.ini file where the Server.exe is and paste this inside the file: Code: [CENSOR1] Re: Optional Censoring - GIAKEN - 19-09-2008 Just saw a problem and fixed it ![]() I was looking it over and noticed that it would only censor one word. So I changed: Code: If CensorShip Sentence Then Exit For To: Code: If CensorShip Sentence Then Sentence = CensorShip Re: Optional Censoring - Robin - 19-09-2008 Faaail. Re: Optional Censoring - GIAKEN - 19-09-2008 Yeah that's true...I like to over complicating things :? I like everything to be in the server. Also this won't take away hardly any server power... Re: Optional Censoring - GIAKEN - 19-09-2008 Well I just tested the function against: fuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckshitshitshitshitshitshitbitchbitchbitchbitchbitch And turned censor on and off and both returned 0 ms. Re: Optional Censoring - GIAKEN - 19-09-2008 The actual function CensorShip (since that's all that the server requires extra work) from when it starts to when it ends. Time = GetTickCount, MsgBox GetTickCount - Time Re: Optional Censoring - Robin - 19-09-2008 GIAKEN Wrote:The actual function CensorShip (since that's all that the server requires extra work) from when it starts to when it ends. Time = GetTickCount, MsgBox GetTickCount - Time Awww, you already know your game is gonna fail so hard you think only one person is going to be talking at once? Set up 80 connections, all spamming it ![]() Re: Optional Censoring - GIAKEN - 19-09-2008 Well if each time they enter a message that takes the server less than a millisecond to process the censoring with then I doubt they would be able to even get the server to take a full second of processing unless they can send more than 1000 messages... Re: Optional Censoring - Doomy - 19-09-2008 wouldnt this be good if you make it add 1 to the ini with thier name and if it is over a certain number it mutes them"?" Re: Optional Censoring - GIAKEN - 19-09-2008 doomteam1 Wrote:wouldnt this be good No because the point is to let them choose if they want words to be censored or not. |