Raised This Month: $95 Target: $400
 23% 

Anti-Spam FlashLight


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Gameplay        Approver:   HamletEagle (33)
Leo_BH
Junior Member
Join Date: Dec 2014
Location: Ukraine
Old 12-24-2014 , 15:19   Anti-Spam FlashLight
Reply With Quote #1

The plugin prevent spam flashlight on the server!
And protection against flashlight spam script



Cvars:
flashlight_reload - How often can turn on / off the flashlight. (default: "1.5")

Requirements:
Engine module

Reapi version
Attached Files
File Type: sma Get Plugin or Get Source (flashlight_no_spam.sma - 821 views - 600 Bytes)
File Type: sma Get Plugin or Get Source (flashlight_no_spam_reapi.sma - 611 views - 894 Bytes)

Last edited by Leo_BH; 10-17-2017 at 18:31. Reason: Added video and Released ReApi version.
Leo_BH is offline
OnePL
Senior Member
Join Date: May 2012
Location: Kwidzyn, Poland
Old 12-24-2014 , 21:29   Re: Anti-Spam FlashLight
Reply With Quote #2

PHP Code:
new bool:BlockLight[33] = false
->
PHP Code:
new bool:BlockLight[33]; 
The default value of the variable is 0 (false).

PHP Code:
float_flashlight_reload float get_pcvar_num(pcvar_reload_flashlight) ) 
->
PHP Code:
float_flashlight_reload get_pcvar_float(pcvar_reload_flashlight
OnePL is offline
Send a message via Skype™ to OnePL
OnePL
Senior Member
Join Date: May 2012
Location: Kwidzyn, Poland
Old 12-25-2014 , 11:12   Re: Anti-Spam FlashLight
Reply With Quote #3

Fakemeta only:
PHP Code:
#include <amxmodx>
#include <fakemeta>

new lastUse[33];

public 
plugin_init() {
    
register_plugin("FlashLight No Spam""0.1""OnePL");

    
register_cvar("flashlight_reload""2");

    
register_forward(FM_CmdStart"CmdStart");
}

public 
CmdStart(iduc) {
    if(!
is_user_alive(id) || get_uc(ucUC_Impulse) != 100) return 1;

    if(
get_systime() - lastUse[id] < get_cvar_num("flashlight_reload")) {
        
set_uc(ucUC_Impulse0);
        return 
4;
    }
    
lastUse[id] = get_systime();
    return 
1;

Hamsandwich + fakemeta only:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

new lastUse[33];

public 
plugin_init() {
    
register_plugin("FlashLight No Spam""0.1""OnePL");

    
register_cvar("flashlight_reload""2");

    
RegisterHam(Ham_Player_ImpulseCommands"player""ImpulseCommand");
}

public 
ImpulseCommand(id) {
    if(!
is_user_alive(id) || pev(idpev_impulse) != 100) return 1;

    if(
get_systime() - lastUse[id] < get_cvar_num("flashlight_reload")) {
        
set_pev(idpev_impulse0);
        return 
4;
    }
    
lastUse[id] = get_systime();
    return 
1;

OnePL is offline
Send a message via Skype™ to OnePL
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-25-2014 , 11:36   Re: Anti-Spam FlashLight
Reply With Quote #4

Quote:
Originally Posted by OnePL View Post
PHP Code:
new bool:BlockLight[33] = false
->
PHP Code:
new bool:BlockLight[33]; 
The default value of the variable is 0 (false).
This doesn't matter. It's not bad to explicit the default value, I mean, for beginners but it's not bad to do not write it too.

Your cvar is already containing a float, so you would use get_pcvar_float and not get_pcvar_num. Also, you can use get_gametime to check when he can toggle flashlight again, no need for a task.

Also, reseting in client_connect and disconnect doesn't make sense, just do it in client_disconnect.

OnePL: FM_CmdStart is generally not a good way, since it's called many times and here you also have an alternative way.
__________________

Last edited by HamletEagle; 12-25-2014 at 11:37.
HamletEagle is offline
Blizzard_87
AlliedModders Donor
Join Date: Oct 2012
Old 12-26-2014 , 03:33   Re: Anti-Spam FlashLight
Reply With Quote #5

should also cache this cvar instead of getting the value each time a user hits flashlight button.

Code:
get_cvar_num("flashlight_reload")
__________________
Blizzard_87 is offline
Chihuahuax
Senior Member
Join Date: Oct 2014
Location: Malaysia
Old 12-27-2014 , 00:58   Re: Anti-Spam FlashLight
Reply With Quote #6

Never heard of flashlight spam script =.=
Chihuahuax is offline
Send a message via Skype™ to Chihuahuax
KaranMohadkar
Senior Member
Join Date: Oct 2012
Location: Reality !
Old 12-27-2014 , 12:15   Re: Anti-Spam FlashLight
Reply With Quote #7

Quote:
Originally Posted by Chihuahuax View Post
Never heard of flashlight spam script =.=
best way could be "scroll down/scroll up" = Flash Light On/Off
then comes the script ..
__________________

Last edited by KaranMohadkar; 12-27-2014 at 12:15.
KaranMohadkar is offline
Leo_BH
Junior Member
Join Date: Dec 2014
Location: Ukraine
Old 07-19-2015 , 10:54   Re: Anti-Spam FlashLight
Reply With Quote #8

UPDATE 1.1 - Optimization Plugin
Leo_BH is offline
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 07-25-2016 , 15:08   Re: Anti-Spam FlashLight
Reply With Quote #9

This plugin must be approved
baneado is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-01-2016 , 13:34   Re: Anti-Spam FlashLight
Reply With Quote #10

Can someone confirm that this exploit still works on latest hlds version?
__________________
HamletEagle is offline
Reply


Thread Tools
Display Modes

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:25.


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