Raised This Month: $ Target: $400
 0% 

how to upgrade say_bs?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FIYA
Member
Join Date: Sep 2007
Location: Cracow, Poland
Old 09-11-2007 , 15:21   how to upgrade say_bs?
Reply With Quote #1

Hi!
First of all, I'm newb if it comes to scripting and I don't have any idea how it works so please be understanding.
I've recently come across this plugin "say_bs" by f117bomb which I noticed is really basic and everyone knows it.

Code:
/* AMXMOD script.
   *
   * (c) Copyright 2000-2002, f117bomb
   * This file is provided as is (no warranties).
   *
   */
   #include <amxmod>
   new phrase[4][] = { "bs", "bullshit", "bullsh*t", "hack"}
   public say_event(id)
   {
       new sid[10]
       num_to_str(id,sid,10)
       new said[192]
       read_args(said,191)

       for(new i = 0 ;i < 4; i += 1)
           if(containi(said,phrase[i]) != -1)
               set_task(1.0,"client",0,sid,10)
   }
   public client(sid[])
   {
       new id = str_to_num(sid)
       engclient_cmd(id,"say", "But then agian, I am a noob...")
   }
   public plugin_init()
   {
       register_plugin("Say BS","0.3","f117bomb")
       register_clcmd("say","say_event")
       return PLUGIN_CONTINUE
   }
Without any knowledge of scripting or whatsoever I've put some slight changes with the key words triggering this plugin and the response to those words to adapt it to my language so it would work fine on my server.
Now, the situation is that some of these really short words are parts of other words in my language that are not offensive so I wouldn't want them to trigger the afterward response, but that's the way it works in this form. As I tried to logically solve this problem I noticed the "containi" part that might be the problem but only based on my english language knowledge. I looked at some other plugins and found the possible alternative which is "equali". I tried some different combinations but either the plugin works as it was at the beginning, triggers on every word written or it doesn't work at all. All I want to know is how to set it up so it would work only on the words given the way they are exactly written, not being parts of any other words. Oh, and not case sensitive as I came across that issue too. So please, help me if you can
FIYA is offline
FIYA
Member
Join Date: Sep 2007
Location: Cracow, Poland
Old 09-12-2007 , 11:24   Re: how to upgrade say_bs?
Reply With Quote #2

come on guys, it's only one line (i guess). give it a sec and help me - poor thing ;)
FIYA is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-12-2007 , 11:41   Re: how to upgrade say_bs?
Reply With Quote #3

Give a try to this plugin :

http://forums.alliedmods.net/showthread.php?p=89648
ConnorMcLeod is offline
FIYA
Member
Join Date: Sep 2007
Location: Cracow, Poland
Old 09-12-2007 , 12:05   Re: how to upgrade say_bs?
Reply With Quote #4

but doesn't it work on the same basis?
isn't "if ( containi ( said, g_swearWords[i++] ) != -1 )" the same as "if(containi(said,phrase[i]) != -1)"?
that's what i'm trying to avoid. i don't want it to find words containing a trigger word but exactly those words.

for example: lets assume the word i'm trying to set as a trigger is "muff". so if someone writes it on chat it works. but if someone writes "muffler" it works as well and it shouldn't.

i tried to switch containi with equali but then it just triggers with any word or letter written on chat. so if anyone can give it a look and suggest the solution i'd be really grateful.
FIYA is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-12-2007 , 14:11   Re: how to upgrade say_bs?
Reply With Quote #5

Sure, but of someone write "f..y..b.st.rd" (sorry for admins..),without any spaces but in real letters, you you manage to do what you want it won't be detected...
ConnorMcLeod is offline
FIYA
Member
Join Date: Sep 2007
Location: Cracow, Poland
Old 09-12-2007 , 15:13   Re: how to upgrade say_bs?
Reply With Quote #6

that's right, but it's not really what i'm aiming for here. i'm not planning to use it exactly for swearing (because then i could use this more advanced plugin that you recommended). i want to eliminate some annoying replies from fragged people that aren't considered as swearing. it's a language thing, i cant explain it. if i used the term 'swear' it was just to make the description easier to understand for you.

i'm just looking for technical side of my problem, not content-related.
it's how to detect these defined words without spaces, being parts of other words or other stuff that would make it harder to detect. just detecting them the way they are normally written. i'm really expecting nothing more, it's supposed to be really simple plugin.

how to modify "if(containi(said,phrase[i]) != -1)" to make it work? or maybe there's more to it? i hope i made it as clear as possible
FIYA is offline
Old 09-12-2007, 16:37
Lord_Destros
This message has been deleted by Lord_Destros. Reason: Just realized this only does beginning of words, reposting in a sec
Lord_Destros
Veteran Member
Join Date: Jul 2004
Location: With stupid.
Old 09-12-2007 , 23:49   Re: how to upgrade say_bs?
Reply With Quote #7

Sorry, forgot to repost XD. After re-reading this I got confused on what you want. If you want to block the word ass but not asymptote; you could just put spaces before and after each word in the array.
Your example would be:
Code:
   new phrase[4][] = { " bs ", " bullshit ", " bullsh*t ", " hack "}
__________________
Quote:
Originally Posted by Twilight Suzuka
Don't worry m'lord. The turtles day will come.
Lord_Destros is offline
Send a message via AIM to Lord_Destros
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 09-13-2007 , 08:21   Re: how to upgrade say_bs?
Reply With Quote #8

If you want to dissallow exact phrases, rather than anything containing them, replace "contan[i]" with "equal[i]".

Adding the "i" to the end makes it case-insensitive.
purple_pixie is offline
FIYA
Member
Join Date: Sep 2007
Location: Cracow, Poland
Old 09-13-2007 , 09:25   Re: how to upgrade say_bs?
Reply With Quote #9

thank you Lord_Destros, that should do it, so simple
edit: on second thought, wouldn't it work only when there is a space before and after the phrase?

purple_pixie, i've tried that already but something's messed up then, it doesn't work at all :/

Last edited by FIYA; 09-13-2007 at 09:41.
FIYA is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 09-13-2007 , 09:38   Re: how to upgrade say_bs?
Reply With Quote #10

Oh, it's because you're reading them all, not just the word.

Try putting "say " in front of each one or similar.

Or of course, just go with Destros :-D

Just trying to find the actual problem over work-arounds.

EDIT: Try using equal() and replacing "read_args(" with "read_argv(1," which reads the first argument, rather than all of them (i.e. reads "text" instead of "say text" )

Last edited by purple_pixie; 09-13-2007 at 09:46.
purple_pixie 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 16:11.


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