Raised This Month: $ Target: $400
 0% 

Toggled by someone saying a certain word.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PropKiller
Member
Join Date: Nov 2009
Location: South-East USA
Old 06-25-2010 , 17:56   Toggled by someone saying a certain word.
Reply With Quote #1

Ok, this is what I need help on. (Probably a noobish question, I am new so..)
When someone says "blank" in chat, how would I get it to print something in chat to all the players. (PrintToChatAll)

I have:
RegConsoleCmd("say", Command_Say)
RegConsoleCmd("say_team", Command_Say)

How would i get that to work out?

I got it to print that to chat when the map starts, but how would I make it so that when a person says "blank".

Thanks.
PropKiller is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-25-2010 , 19:26   Re: Toggled by someone saying a certain word.
Reply With Quote #2

You could probably register "say blank" or if you mean he can say it anywhere in the chat line then you will have to register it like you have it and check if what was said contains the word "blank".

Also, your request is for SourceMod . SourceMod section is below AMX Mod X section (this section).
__________________
fysiks is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 06-25-2010 , 19:32   Re: Toggled by someone saying a certain word.
Reply With Quote #3

I think he wants that if someone types "blank" in a sentence. If so, register the "say" cmd and if you want, also the "say_team" cmd.

Then at ur function read the args, and use contain().
Be aware, false == -1
__________________
I am out of order!
grimvh2 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-25-2010 , 23:32   Re: Toggled by someone saying a certain word.
Reply With Quote #4

Quote:
Originally Posted by grimvh2 View Post
I think he wants that if someone types "blank" in a sentence. If so, register the "say" cmd and if you want, also the "say_team" cmd.

Then at ur function read the args, and use contain().
Be aware, false == -1
If you didn't notice, this is for SourceMod (as I stated above). The SourceMod function is StrContains()
__________________
fysiks is offline
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 06-26-2010 , 06:05   Re: Toggled by someone saying a certain word.
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
If you didn't notice, this is for SourceMod (as I stated above). The SourceMod function is StrContains()
Thats why I did'nt knew what regconsolecmd was xD
Still it would be the same way.
__________________
I am out of order!
grimvh2 is offline
PropKiller
Member
Join Date: Nov 2009
Location: South-East USA
Old 06-26-2010 , 08:36   Re: Toggled by someone saying a certain word.
Reply With Quote #6

Alright. On the API site, It says this for StrContains:

Quote:
Originally Posted by API-Reference
StrContains(const String:str[], const String:substr[], bool:caseSensitive=true);
Could someone post an example for StrContains, in an If event.

And, I would put that If, in the Command_Say, right?
[public Action:Command_Say(client, args)]

Thanks.

Last edited by PropKiller; 06-26-2010 at 08:42.
PropKiller is offline
PropKiller
Member
Join Date: Nov 2009
Location: South-East USA
Old 06-26-2010 , 08:07   Re: Toggled by someone saying a certain word.
Reply With Quote #7

Oh, srry guys. I clicked Scripting on AMX instead of Scripting on Sourcemod. Uhm. Could a moderator, or someone who can, move it to sourcemod > scripting please.

Alright, ill check StrContains out.
PropKiller is offline
RedRobster
Veteran Member
Join Date: Apr 2010
Location: Your Closet
Old 06-26-2010 , 08:48   Re: Toggled by someone saying a certain word.
Reply With Quote #8

I'm not sure about the rest, but to do the StrContains:
PHP Code:
if( StrContainsmsg"find"false) ) //This is going to find "find" in msg with no case sensitivity 
I'm not sure how to read args in SP, so I won't answer that, but this is how you would determine if msg contains the word "find".
RedRobster is offline
PropKiller
Member
Join Date: Nov 2009
Location: South-East USA
Old 06-26-2010 , 09:02   Re: Toggled by someone saying a certain word.
Reply With Quote #9

It comes up with an error, that says: Undefined symbol "msg". Is there something I should have changed from your example? (Again, im new.)
PropKiller is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-26-2010 , 10:11   Re: Toggled by someone saying a certain word.
Reply With Quote #10

Quote:
Originally Posted by PropKiller View Post
It comes up with an error, that says: Undefined symbol "msg". Is there something I should have changed from your example? (Again, im new.)
His example is incomplete and incorrect .

Remember you are talking with AMX'ers .

Code:
if( StrContains(your_string_var_here, "blank", false) != -1 )
{
    // string contains "blank"
}
My example is incomplete so you must make it complete .
__________________
fysiks 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:43.


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