Raised This Month: $ Target: $400
 0% 

word 3x in a row


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JocAnis
Veteran Member
Join Date: Jun 2010
Old 01-09-2011 , 09:52   word 3x in a row
Reply With Quote #1

hi, how to detect if player say same word three times in a row?

exemple:

JocA:hi guys
klsda:hi
kekesl:hi
JocA:hi guys
pqwr:hi pro
dal;:what
JocA:hi guys

And JocA will be that player...
JocAnis is offline
xakintosh
I run no-steam servers!
Join Date: Feb 2010
Location: Edge of nowhere
Old 01-09-2011 , 09:57   Re: word 3x in a row
Reply With Quote #2

I think you must save the every message every player witch is send and then check it for equal "message" or something like that ?
__________________
As soon as possible.
xakintosh is offline
Send a message via Yahoo to xakintosh Send a message via Skype™ to xakintosh
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 01-09-2011 , 10:08   Re: word 3x in a row
Reply With Quote #3

PHP Code:
#include <amxmodx>
#include <amxmisc>

new gSavedSay[33][256];
new 
gAmountSame[33];
public 
plugin_init()
{
    
register_clcmd"say""cmdSay" );
    
register_clcmd"say_team""cmdSay" );
}

public 
cmdSayid )
{
    new 
message[256];
    
read_argsmessagecharsmaxmessage ) );
    if( 
gAmountSame[id] == )
        
copymessage255gSavedSay[id], 255 );
    
    else if( 
equalmessagegSavedSay[id] ) )
    {
        
gAmountSame[id]++;
        
        if( 
gAmountSame 2  )
        {
            new 
name[32];
            
get_user_nameidname31 );

            
client_print0"%s has said the same thing 3 times in a row!"name );
        }
    }

    return 
PLUGIN_HANDLED;

Try that.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
JocAnis
Veteran Member
Join Date: Jun 2010
Old 01-09-2011 , 10:46   Re: word 3x in a row
Reply With Quote #4

Quote:
Originally Posted by nikhilgupta345 View Post
PHP Code:
#include <amxmodx>
#include <amxmisc>

new gSavedSay[33][256];
new 
gAmountSame[33];
public 
plugin_init()
{
    
register_clcmd"say""cmdSay" );
    
register_clcmd"say_team""cmdSay" );
}

public 
cmdSayid )
{
    new 
message[256];
    
read_argsmessagecharsmaxmessage ) );
    if( 
gAmountSame[id] == )
        
copymessage255gSavedSay[id], 255 );
    
    else if( 
equalmessagegSavedSay[id] ) )
    {
        
gAmountSame[id]++;
        
        if( 
gAmountSame 2  )
        {
            new 
name[32];
            
get_user_nameidname31 );

            
client_print0"%s has said the same thing 3 times in a row!"name );
        }
    }

    return 
PLUGIN_HANDLED;

Try that.
tnx, but errors in compiling..
JocAnis is offline
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 01-09-2011 , 10:52   Re: word 3x in a row
Reply With Quote #5

Some fixes,
and added: If he says another word, it saves that..

PHP Code:
#include <amxmodx>
#include <amxmisc>

new gSavedSay[33][256];
new 
gAmountSame[33];

public 
plugin_init() {
    
register_clcmd"say""cmdSay" );
    
register_clcmd"say_team""cmdSay" );
}

public 
cmdSayid ) {
    new 
message[256];
    
read_argsmessagecharsmaxmessage ) );

    if( 
equalmessagegSavedSay[id] ) ) {
        
gAmountSame[id]++;
        
        if( 
gAmountSame[id] > 2  ) {
            new 
name[32]; get_user_nameidname31 );
            
            
client_print0print_chat"[Spam] %s has said the same thing 3 times in a row!"name );
        }
    }
    else {
        
gAmountSame[id] = 0
        copy
message255gSavedSay[id] );
    }
    return 
PLUGIN_HANDLED;

__________________
Retired.

Last edited by Xalus; 01-09-2011 at 10:58.
Xalus is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 01-09-2011 , 10:56   Re: word 3x in a row
Reply With Quote #6

Need to reset gAmountSame to 1 in the else.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 01-09-2011 , 10:58   Re: word 3x in a row
Reply With Quote #7

To 0 U mean,
ye I edit

[Edit]

FIXED
__________________
Retired.
Xalus is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 01-09-2011 , 11:00   Re: word 3x in a row
Reply With Quote #8

Wouldn't it be to 1, because that would be the first time he said it, then if he says it again that means he said the same thing twice. So I think it should be 1 right?
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
JocAnis
Veteran Member
Join Date: Jun 2010
Old 01-09-2011 , 11:02   Re: word 3x in a row
Reply With Quote #9

Quote:
Originally Posted by Xalus View Post
Some fixes,
and added: If he says another word, it saves that..

PHP Code:
#include <amxmodx>
#include <amxmisc>

new gSavedSay[33][256];
new 
gAmountSame[33];

public 
plugin_init() {
    
register_clcmd"say""cmdSay" );
    
register_clcmd"say_team""cmdSay" );
}

public 
cmdSayid ) {
    new 
message[256];
    
read_argsmessagecharsmaxmessage ) );

    if( 
equalmessagegSavedSay[id] ) ) {
        
gAmountSame[id]++;
        
        if( 
gAmountSame[id] > 2  ) {
            new 
name[32]; get_user_nameidname31 );
            
            
client_print0print_chat"[Spam] %s has said the same thing 3 times in a row!"name );
        }
    }
    else {
        
gAmountSame[id] = 0
        copy
message255gSavedSay[id] );
    }
    return 
PLUGIN_HANDLED;

with this, chat is blocked
JocAnis is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 01-09-2011 , 11:03   Re: word 3x in a row
Reply With Quote #10

return PLUGIN_CONTINUE instead of HANDLED
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
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 02:06.


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