Raised This Month: $51 Target: $400
 12% 

Swear Replacement/Filter


Post New Thread Reply   
 
Thread Tools Display Modes
Falco
SourceMod Donor
Join Date: Dec 2004
Location: CANADA
Old 09-28-2007 , 23:35   Re: Swear Replacement/Filter
Reply With Quote #41

NP, thanks for your efforts.
__________________
[DmZ|EPSILON CSS 70.75.139.92:27016
[DmZ|EPSILON GG 70.75.167.30:27015
[DmZ|EPSILON CS:GO Classic Casual 70.75.139.92:27013
[DmZ|EPSILON CS:GO Demolition 70.75.139.92:27014
[DmZ|EPSILON BF3 69.46.43.221:25203 (8-slot) Practice Server
www.dmzepsilon.ca
----------------------
Falco is offline
imported_Anth0ny
Senior Member
Join Date: Jan 2005
Location: Saturn
Old 09-29-2007 , 06:55   Re: Swear Replacement/Filter
Reply With Quote #42

no free time for test =(
any news about server stability with 1.3 ?
__________________
aka Mad.Eagle
Creator\Owner\Admin of
www.megatron.ws
imported_Anth0ny is offline
Send a message via ICQ to imported_Anth0ny
imported_sparky
Member
Join Date: Dec 2004
Old 09-29-2007 , 11:11   Re: Swear Replacement/Filter
Reply With Quote #43

running linux 1.3

server frooze not sure what triggered it
__________________
Longisland Game Servers
www.ligs.us
imported_sparky is offline
BAILOPAN
Join Date: Jan 2004
Old 09-29-2007 , 22:23   Re: Swear Replacement/Filter
Reply With Quote #44

We just spent a rather nasty debugging session and narrowed it down to a problem in this plugin I have unapproved this plugin until the problems can be fixed. Please PM me if you fix them and would like it to be re-approved.

The problem is this type of code in string_cleaner:
Code:
        while ( StrContains ( str, " ", false ) != -1 )             ReplaceString ( str, len, " ", "" );

That while loop is very bad. ReplaceString() is guaranteed to make all replacements at once. If it can't, it had an internal error. So, here are the two cases your code exhibits:

1) ReplaceString() succeeds. Your while loop only runs once.
2) ReplaceString() fails. Your while loop runs forever because ReplaceString() will always fail. The server locks up.

The other problem is that the "maxlength" parameter should refer to the buffer size, not the string length. That's the reason ReplaceString() was failing in the first place - you weren't leaving it enough room to work.

A correct implementation might look like this:
Code:
/* ... */ string_cleaner(clientName, sizeof(clientName)); /* ... */ string_cleaner( String:str[], maxlength ){     if (GetConVarInt(cvarswearmode) != 2){         ReplaceString ( str, maxlength, " ", "" );     }     ReplaceString ( str, maxlength, "|<", "k" );     ReplaceString ( str, maxlength, "|>", "p" );     ReplaceString ( str, maxlength, "()", "o" );

Good luck, and if you have any questions, please feel free to PM me!
__________________
egg
BAILOPAN is offline
imported_Anth0ny
Senior Member
Join Date: Jan 2005
Location: Saturn
Old 09-30-2007 , 14:49   Re: Swear Replacement/Filter
Reply With Quote #45

OMG
we need this plugin working...

it's a one from 10 mostly useful plugins...
__________________
aka Mad.Eagle
Creator\Owner\Admin of
www.megatron.ws
imported_Anth0ny is offline
Send a message via ICQ to imported_Anth0ny
pRED*
Join Date: Dec 2006
Old 09-30-2007 , 16:10   Re: Swear Replacement/Filter
Reply With Quote #46

Quick untested patched version. Compiles...
Attached Files
File Type: sp Get Plugin or Get Source (swear_replacement.sp - 517 views - 11.4 KB)
pRED* is offline
Hell Phoenix
Senior Member
Join Date: Jan 2005
Old 09-30-2007 , 18:38   Re: Swear Replacement/Filter
Reply With Quote #47

Wow...that was a stupid mistake. I never even thought about that either. I took most of that string cleaner function from the original and didnt give it two thoughts...doh! Well I put up a new version. Bail if you could look at it that would be great. Im pretty sure I got everything cleaned up now.
__________________
Hell Phoenix is offline
imported_Anth0ny
Senior Member
Join Date: Jan 2005
Location: Saturn
Old 10-01-2007 , 03:24   Re: Swear Replacement/Filter
Reply With Quote #48

sorry, but 1.4 KILLS my server too =)

Code:
[SM] Listing 36 plugins:
  01 "SQL Admin Connector (Threaded and UTF8 ready)" (1.2) by AngelX, based on o
riginal AlliedModders LLC code
  02 "SQL Admin Manager (UTF8 ready)" (1.2) by AngelX, based on original AlliedM
odders LLC code
  03 "Admin Help" (1.0.0.1512) by AlliedModders LLC
  04 "Admin Sounds" (1.1) by dalto
  05 "Admin loggin" (1.0) by vIr-Dan
  06 "Admin Menu" (1.1b) by LobioN
  07 "Ads" (1.0.2.0) by Shane A. ^BuGs^ Froebel
  08 "Advanced c4 Countdown Timer" (1.5) by dalto
  09 "Anti-Flood" (1.0.0.1512) by AlliedModders LLC
  10 "Advanced Team Attack Control" (1.3.3) by FlyingMongoose
  11 "Basic Ban Commands" (1.0.0.1512) by AlliedModders LLC
  12 "Basic Chat" (1.0.0.1512) by AlliedModders LLC
  13 "Basic Comm Control" (1.0.0.1512) by AlliedModders LLC
  14 "Basic Commands" (1.0.0.1512) by AlliedModders LLC
  15 "Basic Fun Commands" (1.0.0.1512) by AlliedModders LLC
  16 "Basic Fun Votes" (1.0.0.1512) by AlliedModders LLC
  17 "Basic Info Triggers" (1.0.0.1512) by AlliedModders LLC
  18 "Basic Votes" (1.0.0.1512) by AlliedModders LLC
  19 "Cvar Hider" (1.0.0.0) by AlliedModders LLC
  20 "HLstatsX Plugin" (1.6) by Tobi17
  21 "HP left" (1.1) by vIr-Dan
  22 "MapChooser" (1.0.0.1512) by AlliedModders LLC
  23 "Reserved Slots - Megatron Edition" (1.0.0.1512) by Lugavchik
  24 "Model Menu" (0.13) by pRED*
  25 "Nextmap" (1.0.0.1512) by AlliedModders LLC
  26 "Quake Sounds" (1.8) by dalto
  27 "RateChecker" (0.2) by pRED*
  28 "Reserved Slots" (1.0.0.1512) by AlliedModders LLC
  29 "Rock The Vote" (1.0.0.1512) by AlliedModders LLC
  30 "Client Execute" (1.0.0.3) by dubbeh
  31 "PlayersList" (0.3) by O!KAK
  32 "Swear Replacement" (1.4) by Hell Phoenix
  33 "Team Bets" (1.4) by ferret
  34 "Terms Agreement" (1.1) by MaTTe
  35 "Weapon Logging" (1.5) by Tobi17
  36 "YeGods High Ping Remover" (1.0.0.4) by dubbeh
If i remove plugin, servers stops crush.
__________________
aka Mad.Eagle
Creator\Owner\Admin of
www.megatron.ws
imported_Anth0ny is offline
Send a message via ICQ to imported_Anth0ny
imported_Anth0ny
Senior Member
Join Date: Jan 2005
Location: Saturn
Old 10-01-2007 , 03:33   Re: Swear Replacement/Filter
Reply With Quote #49

But version 1.1 work more-less fine.
And don't kill server.

(Win32)
__________________
aka Mad.Eagle
Creator\Owner\Admin of
www.megatron.ws
imported_Anth0ny is offline
Send a message via ICQ to imported_Anth0ny
Hell Phoenix
Senior Member
Join Date: Jan 2005
Old 10-01-2007 , 10:16   Re: Swear Replacement/Filter
Reply With Quote #50

Weird, the difference between 1.1 and 1.3 is I changed the define from 150 to 200 on the top. Thats it (1.2 had a = that I was using to debug at one point and forgot to take out...removed that for 1.3). I dont get any crashes with it, so im having a hard time with figuring out what the problem is. Do you get any errors in your SM logs or does it just hang? When does it hang (randomly, when someone says something, starting the server)?

*edit* And what mod is this that its hanging on?

*edit #2* What version of SM are you using?
__________________

Last edited by Hell Phoenix; 10-01-2007 at 10:19.
Hell Phoenix is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode