Raised This Month: $ Target: $400
 0% 

When String Contain " " (Backslash)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 08-05-2010 , 09:45   When String Contain " " (Backslash)
Reply With Quote #1

Hello AM,

I try to get the message, the Player write in Chat. When the Message Contains a Backslash i wanna do something.

I had the idea to chekc if the string contains a " " but i dont know how.

Heres my code:

PHP Code:
#include <amxmodx>  
public plugin_init()  
{  
    
register_clcmd("say /wordhere""cmdWord")  
    
register_clcmd("_mm_wordhere""mmWord")  
}  

public 
cmdWord(id)  
{  
    
client_cmd(id"messagemode _mm_wordhere")  
}  

public 
mmWord(id)  
{  
    new 
szTemp[64]  
    
read_args(szTempcharsmax(szTemp))  
    
remove_quotes(szTemp)
    if(
szTemp contains " ")
    { do 
that }
    else { do 
that }

Please help me
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 08-05-2010 , 10:18   Re: When String Contain " " (Backslash)
Reply With Quote #2

if( containi( szTemp, " " ) != 1 )
{
stuff
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 08-07-2010 , 14:32   Re: When String Contain " " (Backslash)
Reply With Quote #3

Quote:
Originally Posted by lucas_7_94 View Post
if( containi( szTemp, " " ) != 1 )
{
stuff
1 should be -1
Spunky is offline
Send a message via AIM to Spunky
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 08-05-2010 , 14:19   Re: When String Contain " " (Backslash)
Reply With Quote #4

hey, thanks gonna try that
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-05-2010 , 17:53   Re: When String Contain " " (Backslash)
Reply With Quote #5

Just to let you know, there is NO backslash (\) anywhere in your post.

Also, you say you want to do something if there is a 'backslash' in the command yet you check for a space?
__________________
fysiks is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 08-06-2010 , 04:59   Re: When String Contain " " (Backslash)
Reply With Quote #6

oh sry, i forgot to add the "\". But the thing is the same, isnt it.
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-06-2010 , 19:00   Re: When String Contain " " (Backslash)
Reply With Quote #7

Quote:
Originally Posted by mottzi View Post
oh sry, i forgot to add the "\". But the thing is the same, isnt it.
Honestly, I have no idea what you are talking about.
__________________
fysiks is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 08-07-2010 , 02:59   Re: When String Contain " " (Backslash)
Reply With Quote #8

PHP Code:
public mmWord(id)  
{  
    new 
szTemp[64]  
    
//read_args(szTemp, charsmax(szTemp))  
    //remove_quotes(szTemp)
    
if(szTemp contains " ")
    
//{ do that }
    //else { do that }

I just wrote " " to add a \ into the " " and then i forgot to add it you understand?
But doesnt matter
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-07-2010 , 13:19   Re: When String Contain " " (Backslash)
Reply With Quote #9

Quote:
Originally Posted by mottzi View Post
PHP Code:
public mmWord(id)  
{  
    new 
szTemp[64]  
    
//read_args(szTemp, charsmax(szTemp))  
    //remove_quotes(szTemp)
    
if(szTemp contains " ")
    
//{ do that }
    //else { do that }

I just wrote " " to add a \ into the " " and then i forgot to add it you understand?
But doesnt matter
I have no clue what you just said.
__________________
fysiks is offline
Raddish
BANNED
Join Date: Jul 2008
Location: Argentina
Old 08-07-2010 , 13:21   Re: When String Contain " " (Backslash)
Reply With Quote #10

PHP Code:
public hook_say(id// ?
{
    new 
szSay[128]
    
read_argsv(szSaycharsmax(szSay))
    
remove_quotes(szSay)
    if(!
strlen(szSay) || !szSay[0])
    {
        
// some stuff
    
}

Raddish 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 00:15.


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