AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to make function to block spam commands SOLVED (https://forums.alliedmods.net/showthread.php?t=143572)

xakintosh 11-21-2010 14:55

How to make function to block spam commands SOLVED
 
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

SpeeDeeR 11-21-2010 15:00

Re: How to make function to block spam commands
 
Find the function in your plugin and return PLUGIN_HANDLED at its end.This way it won't be displayed in the chat.

xakintosh 11-21-2010 15:03

Re: How to make function to block spam commands
 
I wan't to make spam delay on the function not to hide it.

SpeeDeeR 11-21-2010 15:38

Re: How to make function to block spam commands
 
You want to stop the /tp spam, am I right?
If I am, make it that way.

xakintosh 11-21-2010 15:55

Re: How to make function to block spam commands
 
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!

xPaw 11-21-2010 16:04

Re: How to make function to block spam commands SOLVED
 
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; }

xakintosh 11-21-2010 16:06

Re: How to make function to block spam commands SOLVED
 
Working Flawless!


All times are GMT -4. The time now is 11:20.

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