AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Request]Check for same chatmessages (https://forums.alliedmods.net/showthread.php?t=270910)

RaZ_HU 09-01-2015 08:13

[Request]Check for same chatmessages
 
Hi,

I would like to request code stuff to prevent the same message spamming in the chat.
For example if someone binds "say x;say x;say x; say x" to a button and he/she presses it it fills the chat area with 4lines.

That would look like:
Code:

player: x
player: x
player: x
player: x

I have two idea to prevent that, but of course I can't do them.

1. Idea:
Check if the last message sent 2 sec ago and same as the new message, if yes grab the new one and do not display it.
Output would look like:
Code:

player: x
2. Idea:
Count up the lines if someone says the same thing under 2 sec ago and if yes count them up and say it once only with a counter.
Output would look like:
Code:

player: x    -x4

Are these even possible?

The only code I have yet...:

PHP Code:

public plugin_init()
{
    
register_clcmd("say""hook_say")
    
register_clcmd("say_team""hook_say")
}
public 
hook_say(id)
{
    new 
message[192]
    
read_args (message191)
    
remove_quotes (message)

    
// super stuff comes here what I don't know




Edit:
Thanks wickedd, I haven't seen that before :D

wickedd 09-01-2015 08:23

Re: [Request]Check for same chatmessages
 
Take a look at "No Chat Spam" by Exolent it should help you.


All times are GMT -4. The time now is 22:14.

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