AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   When String Contain " " (Backslash) (https://forums.alliedmods.net/showthread.php?t=134479)

mottzi 08-05-2010 09:45

When String Contain " " (Backslash)
 
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

lucas_7_94 08-05-2010 10:18

Re: When String Contain " " (Backslash)
 
if( containi( szTemp, " " ) != 1 )
{
stuff

mottzi 08-05-2010 14:19

Re: When String Contain " " (Backslash)
 
hey, thanks gonna try that

fysiks 08-05-2010 17:53

Re: When String Contain " " (Backslash)
 
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?

mottzi 08-06-2010 04:59

Re: When String Contain " " (Backslash)
 
oh sry, i forgot to add the "\". But the thing is the same, isnt it. :)

fysiks 08-06-2010 19:00

Re: When String Contain " " (Backslash)
 
Quote:

Originally Posted by mottzi (Post 1263077)
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.

mottzi 08-07-2010 02:59

Re: When String Contain " " (Backslash)
 
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 :D

fysiks 08-07-2010 13:19

Re: When String Contain " " (Backslash)
 
Quote:

Originally Posted by mottzi (Post 1263951)
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 :D

I have no clue what you just said.

Raddish 08-07-2010 13:21

Re: When String Contain " " (Backslash)
 
PHP Code:

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



fysiks 08-07-2010 13:23

Re: When String Contain " " (Backslash)
 
Quote:

Originally Posted by Raddish (Post 1264292)
PHP Code:

    if(!strlen(szSay) || !szSay[0]) 


Redundant.


All times are GMT -4. The time now is 00:15.

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