Raised This Month: $51 Target: $400
 12% 

[L4D2] Delay to enable again lamp


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 01-12-2023 , 21:28   [L4D2] Delay to enable again lamp
Reply With Quote #1

Some people think that it is funny to spam lamp with macro, which makes a very annoying noise.
JLmelenchon is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 01-13-2023 , 06:25   Re: [L4D2] Delay to enable again lamp
Reply With Quote #2

Can try checking for impulse flashlight parameter on OnPlayerRunCmd and maybe block the sound with SoundHook
__________________
Marttt is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-21-2023 , 08:59   Re: [L4D2] Delay to enable again lamp
Reply With Quote #3

Simple 1 sec cooldown for impulse command
PHP Code:
public void OnPluginStart()
{
    
AddCommandListener(listen"impulse");
}

public 
Action listen(int client, const char[] commandint argc)
{
    static 
int cooldown[MAXPLAYERS+1];

    
int time GetTime();
    
    if(
cooldown[client] > time)
        return 
Plugin_Handled;

    
cooldown[client] = time 1;

    return 
Plugin_Continue;

*edit
Here version of coold down to turn flashlight on again.
PHP Code:
#define EF_DIMLIGHT 0x004 // player flashlight

#include <sdktools>

public void OnPluginStart()
{
    
AddCommandListener(listen"impulse");
}

public 
Action listen(int client, const char[] commandint argc)
{
    static 
int cooldown[MAXPLAYERS+1];

    if(
argc 1)
        return 
Plugin_Continue;

    
char buffer[5];
    
GetCmdArg(1buffersizeof(buffer));

    if(
StringToInt(buffer) != 100)
        return 
Plugin_Continue;
        

    if(
GetEntProp(clientProp_Send"m_fEffects") & EF_DIMLIGHT)
        return 
Plugin_Continue;
        

    
int time GetTime();


    if(
cooldown[client] > time)
        return 
Plugin_Handled;

    
cooldown[client] = time 5;

    return 
Plugin_Continue;

__________________
Do not Private Message @me

Last edited by Bacardi; 01-21-2023 at 13:05.
Bacardi is offline
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:49.


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