Raised This Month: $51 Target: $400
 12% 

while i++ == containi[i] problem, i need to skip letters ( fixed)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Owyn
Veteran Member
Join Date: Nov 2007
Old 04-10-2009 , 08:22   while i++ == containi[i] problem, i need to skip letters ( fixed)
Reply With Quote #1

PHP Code:
new said[6], 0
    read_argv
(1said5)
    
    while (
containi(said[i], "> !") != -1)
    {
        
i++
    }
    
    while (
said[i] == '!')
    {
        
i++
    } 
hi, i'm trying to modify admin chat, so when admin types !hi it will make a hud message like @hi, but also i want to make a hud message appear he admin types > !hi
and this part i can't get to work, when admin types > !hi nothing happens, it just shows in chat like usual

and i tried
PHP Code:
if (containi(said"> !") != -1)
    {
        
i++
        
log_amx("> ! Found!")
    } 
but when admin typed > !hi
nothing it didn't found it )= no amx log was made

and if i do while (containi(said[i], "!") != -1) it works only for first characters, i want to make string like "> !hi" make an hud chat like @hi and "> !!hi" make it like @@hi
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.

Last edited by Owyn; 04-10-2009 at 08:37.
Owyn is offline
Send a message via ICQ to Owyn
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-10-2009 , 08:32   Re: while i++ == containi[i] problem
Reply With Quote #2

You are comparing a single character (said[i]) to a string of three characters ("> !")
__________________
fysiks is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 04-10-2009 , 08:35   Re: while i++ == containi[i] problem
Reply With Quote #3

yea i thought of it, and i want to know how make comparation right so it would compare to three characters right and after remove it from message like it removes "!" if it begins with em and make i++ or a thing like that like this code does with single character !
PHP Code:

    
while (said[i] == '!')
    {
        
i++
    } 
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.

Last edited by Owyn; 04-10-2009 at 08:46.
Owyn is offline
Send a message via ICQ to Owyn
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-10-2009 , 08:45   Re: while i++ == containi[i] problem
Reply With Quote #4

Code removed.

But, the first character after the last '!' will be expected to be a color indicator.
__________________

Last edited by fysiks; 04-10-2009 at 09:36. Reason: fixed replace() args
fysiks is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 04-10-2009 , 08:51   Re: while i++ == containi[i] problem
Reply With Quote #5

Quote:
replace(said, "> ", "")
that gives an argument type mismatch (arg 2) error on compile
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
Owyn is offline
Send a message via ICQ to Owyn
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 04-10-2009 , 08:54   Re: while i++ == containi[i] problem
Reply With Quote #6

Code:
replace(said, 5, "> ", "")
Spunky is offline
Send a message via AIM to Spunky
Old 04-10-2009, 08:54
xPaw
This message has been deleted by xPaw. Reason: hai Spunky
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-10-2009 , 08:54   Re: while i++ == containi[i] problem
Reply With Quote #7

Oops, I forgot an argument. http://www.amxmodx.org/funcwiki.php?go=func&id=47

Wow, three posts all at once .
__________________
fysiks is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 04-10-2009 , 09:02   Re: while i++ == containi[i] problem
Reply With Quote #8

PHP Code:
new said[6], 0
    read_argv
(1said5)
    
    if(
contain(said"> !") != -1)
    {
        
replace(said5"> """)
    }
    
    while (
said[i] == '!')
    {
        
i++
    } 
does not work, it does not catch when i type "> !hi" and does nothing
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
Owyn is offline
Send a message via ICQ to Owyn
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-10-2009 , 09:06   Re: while i++ == containi[i] problem
Reply With Quote #9

Quote:
Originally Posted by .Owyn. View Post
does not work, it does not catch when i type "> !hi" and does nothing
Try to debug it then.
__________________
fysiks is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 04-10-2009 , 09:07   Re: while i++ == containi[i] problem
Reply With Quote #10

i get no errors, and as i mentioned in 1st post thins condition does not met, dunno what is wrong
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
Owyn is offline
Send a message via ICQ to Owyn
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 08:44.


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