Raised This Month: $ Target: $400
 0% 

Little question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mrcolin
Member
Join Date: Aug 2009
Old 08-30-2009 , 05:29   Little question
Reply With Quote #1

Hi , I have a little question I am playing around with some scripts and making my own one but I have a problem I found a script that checks if the chat contains "gadget" but I would like to add another word
Code:
if(StrContains(originalstring,"gadget") != -1){
How do I add "Cake" to be also a chat trigger ?

thx
Mrcolin is offline
busy.orange
Member
Join Date: May 2009
Old 08-30-2009 , 05:37   Re: Little question
Reply With Quote #2

RegConsoleCmd("sm_cake",Commandcake);
will add !cake and /cake chat trigger
busy.orange is offline
Mrcolin
Member
Join Date: Aug 2009
Old 08-30-2009 , 06:01   Re: Little question
Reply With Quote #3

Quote:
Originally Posted by busy.orange View Post
RegConsoleCmd("sm_cake",Commandcake);
will add !cake and /cake chat trigger
ok thx but is there also a way to add it in the original code line ? like
Code:
if(StrContains(originalstring,"gadget"&"cake") != -1){
Mrcolin is offline
Whosat
Senior Member
Join Date: Nov 2007
Location: Singapore
Old 08-30-2009 , 06:11   Re: Little question
Reply With Quote #4

PHP Code:
if(StrContains(originalstring,"gadget"false) != -|| StrContains(originalstring,"cake"false) != -1) { 
The '||' means 'OR'

Oh and I put the , false in both StrContains statements so that its case insensitive. Remove it if you dont want it that way
__________________
Whosat is offline
Mrcolin
Member
Join Date: Aug 2009
Old 08-30-2009 , 06:30   Re: Little question
Reply With Quote #5

Quote:
Originally Posted by Whosat View Post
PHP Code:
if(StrContains(originalstring,"gadget"false) != -|| StrContains(originalstring,"cake"false) != -1) { 
The '||' means 'OR'

Oh and I put the , false in both StrContains statements so that its case insensitive. Remove it if you dont want it that way
thx man ! +
Mrcolin is offline
Whosat
Senior Member
Join Date: Nov 2007
Location: Singapore
Old 08-30-2009 , 08:12   Re: Little question
Reply With Quote #6

Glad to help
__________________
Whosat is offline
naris
AlliedModders Donor
Join Date: Dec 2006
Old 08-30-2009 , 13:00   Re: Little question
Reply With Quote #7

Quote:
Originally Posted by Whosat View Post
PHP Code:
if(StrContains(originalstring,"gadget"false) != -|| StrContains(originalstring,"cake"false) != -1) { 
The '||' means 'OR'

Oh and I put the , false in both StrContains statements so that its case insensitive. Remove it if you dont want it that way
That makes both gadget and cake perform the same action. If you want them to perform different actions, do this:
PHP Code:
if(StrContains(originalstring,"gadget"false) != -1){
    
// do something
} else if (StrContains(originalstring,"cake"false) != -1) {
    
// do something else

naris 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 18:40.


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