Raised This Month: $ Target: $400
 0% 

How to make function to block spam commands SOLVED


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xakintosh
I run no-steam servers!
Join Date: Feb 2010
Location: Edge of nowhere
Old 11-21-2010 , 14:55   How to make function to block spam commands SOLVED
Reply With Quote #1

I have build /tp command with some function that may make lag to server when one or more users start spamm /tp command.
Is there any way to detect if player spam the button for /tp or just the command and detect it, something like that:
Please don't spam this command (wait 5sec)

*But the first time aways work when user say /tp

Last edited by xakintosh; 11-21-2010 at 16:02.
xakintosh is offline
Send a message via Yahoo to xakintosh Send a message via Skype™ to xakintosh
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 11-21-2010 , 15:00   Re: How to make function to block spam commands
Reply With Quote #2

Find the function in your plugin and return PLUGIN_HANDLED at its end.This way it won't be displayed in the chat.
SpeeDeeR is offline
xakintosh
I run no-steam servers!
Join Date: Feb 2010
Location: Edge of nowhere
Old 11-21-2010 , 15:03   Re: How to make function to block spam commands
Reply With Quote #3

I wan't to make spam delay on the function not to hide it.
xakintosh is offline
Send a message via Yahoo to xakintosh Send a message via Skype™ to xakintosh
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 11-21-2010 , 15:38   Re: How to make function to block spam commands
Reply With Quote #4

You want to stop the /tp spam, am I right?
If I am, make it that way.
SpeeDeeR is offline
xakintosh
I run no-steam servers!
Join Date: Feb 2010
Location: Edge of nowhere
Old 11-21-2010 , 15:55   Re: How to make function to block spam commands
Reply With Quote #5

Yes i wanna just first time when use /tp work correct but when you try to spam it to block you.

Sorry i don't see this --- > http://forums.alliedmods.net/showthr...highlight=spam

*SOLVED*

Maybe anyone will delete this thread... Thanks!

Last edited by xakintosh; 11-21-2010 at 16:02.
xakintosh is offline
Send a message via Yahoo to xakintosh Send a message via Skype™ to xakintosh
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 11-21-2010 , 16:04   Re: How to make function to block spam commands SOLVED
Reply With Quote #6

Used this for ages, works like a charm.
Code:
new Float:g_flLastCmd[ 33 ]; public AnyCommand( id ) {     if( CheckFlood( id ) )         return PLUGIN_HANDLED;         // your code } bool:CheckFlood( const id ) {     new Float:flGametime = get_gametime( );         if( g_flLastCmd[ id ] < flGametime ) {         g_flLastCmd[ id ] = flGametime + 0.15;                 return false;     }         return true; }
__________________
xPaw is offline
xakintosh
I run no-steam servers!
Join Date: Feb 2010
Location: Edge of nowhere
Old 11-21-2010 , 16:06   Re: How to make function to block spam commands SOLVED
Reply With Quote #7

Working Flawless!

Last edited by xakintosh; 11-22-2010 at 15:56.
xakintosh is offline
Send a message via Yahoo to xakintosh Send a message via Skype™ to xakintosh
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 11:19.


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