AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [CS:S] Anti Flash v1.2 (https://forums.alliedmods.net/showthread.php?t=159887)

Despirator 06-23-2011 04:43

[CS:S] Anti Flash v1.2
 
1 Attachment(s)
Description:
This plugin will prevents players to be blinded and (or) deafened. Prevents dead players, teammates or an owner to be flashed.

Console Variables:
Code:

// Enables/Disables flashbangs to blind players
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
sm_antiflash_blind "1"

// Prevents dead players to be flashed
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
sm_antiflash_dead "1"

// Enables/Disables flashbangs to deafen players
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
sm_antiflash_deafen "1"

// Enables/Disables the plugin
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
sm_antiflash_enable "1"

// Prevents an owner to be flashed
// -
// Default: "0"
// Minimum: "0.000000"
// Maximum: "1.000000"
sm_antiflash_owner "0"

// Prevents teammates to be flashed
// -
// Default: "1"
// Minimum: "0.000000"
// Maximum: "1.000000"
sm_antiflash_team "1"

Requirements:
Sourcemod 1.3 or higher

Credits:
SAMURAI16 for original plugin which can be found here

Special thanks to:
Bacardi for this http://forums.alliedmods.net/showpos...1&postcount=13
But he thinks that this way which he described there is useless. LOL :D

Installation:
Put anti-flash.sp to the sourcemod/scripting folder
Put anti-flash.smx to the sourcemod/plugins folder
Start server to auto-generate config file
Then configure the plugin in the config file here cstrike/cfg/sourcemod/plugin.anti-flash.cfg
Change map or restart server or execute on the server console this "exec sourcemod/plugin.anti-flash.cfg"

Changelog:
Quote:

  • v1.1
    Day: 24 Month:06 Year: 2011
  • Fixed bug removing blinds and (or) deafen effect even if player didn't flashed by owner.
    Bug: Entire an owner's team will be unflashed at any distance through walls even if they were flashed by another player
  • Script optimize

    v1.2
  • Fixed preventing dead player to be flashed


Bacardi 06-23-2011 05:02

Re: [CS:S] Anti Flash v1.0
 
You better use that [CS:S] Flashbang Tools

Despirator 06-23-2011 05:12

Re: [CS:S] Anti Flash v1.0
 
Quote:

Originally Posted by Bacardi (Post 1494004)
You better use that [CS:S] Flashbang Tools

but this plugin works well without it and there is no OnGameFrame forward because i found another way

Bacardi 06-23-2011 05:21

Re: [CS:S] Anti Flash v1.0
 
You not mind if I try make another versio, but this would only affect flashbang deafness... ?
*edit
Not blindness.

Despirator 06-23-2011 05:24

Re: [CS:S] Anti Flash v1.0
 
it prevents a player to be both blinded and deafened

and with it you can remove deafen or blind or both to opposite players

Of course, I don't. Try another version. But I think it wouldn't be sensible, because of this plugin

Edit
What do you mean?
It would affect both blindness and deafness

Bacardi 06-23-2011 05:43

Re: [CS:S] Anti Flash v1.0
 
I want replace that *beep sound to pure mute, using fade what @Greyscale mention
with settings

Despirator 06-23-2011 05:47

Re: [CS:S] Anti Flash v1.0
 
my plugin just blocks it at all with dsp_player command
and player can hear everything

Greyscale 06-23-2011 11:29

Re: [CS:S] Anti Flash v1.0
 
Anyone can make whatever they want. Just if you use code from anyone else, make sure you give credit.

Greyscale 06-23-2011 11:37

Re: [CS:S] Anti Flash v1.0
 
Since it is not a requirement for a plugin to be bug-free for approval, I will approve it. But you might want to double-check this:

Code:

if (b_antiteam && GetClientTeam(i) == GetClientTeam(client) && i != client)
                                StopFlash(i);
                        else if (b_antiowner && i == client)
                                StopFlash(i);
                        else if (b_antidead && !IsPlayerAlive(i))
                                StopFlash(i);
                        else
                        {
                                if (!b_blind)
                                        RemoveBlind(i);
                                if (!b_deafen)
                                        RemoveDeafen(i);
                        }

Everything below the first true if-statement will be ignored because you used 'else'. I don't know if that's what you intended.

Despirator 06-23-2011 15:05

Re: [CS:S] Anti Flash v1.0
 
Quote:

Originally Posted by Greyscale (Post 1494227)
Since it is not a requirement for a plugin to be bug-free for approval, I will approve it. But you might want to double-check this:

Code:

if (b_antiteam && GetClientTeam(i) == GetClientTeam(client) && i != client)
                                StopFlash(i);
                        else if (b_antiowner && i == client)
                                StopFlash(i);
                        else if (b_antidead && !IsPlayerAlive(i))
                                StopFlash(i);
                        else
                        {
                                if (!b_blind)
                                        RemoveBlind(i);
                                if (!b_deafen)
                                        RemoveDeafen(i);
                        }

Everything below the first true if-statement will be ignored because you used 'else'. I don't know if that's what you intended.

You forgot that there is cycle of it

thats what I intended

but I just noticed that i could call GetClientTeam(client) only once

PHP Code:

public Action:OnFlashDetonate_PrePost(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
owner GetClientOfUserId(GetEventInt(event,"userid"));
    new 
ownerteam GetClientTeam(owner);
    
    for (new 
1<= MaxClientsi++) // cycle
    
{
        if (
IsInGame[i] && IsInGame[owner]) // clients in game
        
{
            if (
b_antiteam && GetClientTeam(i) == ownerteam && != owner// if player is in owner team but not owner
                
StopFlash(i);
            else if (
b_antiowner && == owner// if player is owner
                
StopFlash(i);
            else if (
b_antidead && !IsPlayerAlive(i)) // if player is dead
                
StopFlash(i);
            else 
// if player is in opposite team and alive
            
{
                if (!
b_blind// check wherther sm_antiflash_blind is disabled
                    
RemoveBlind(i); // remove blind effect
                
if (!b_deafen// check wherther sm_antiflash_deafen is disabled
                    
RemoveDeafen(i); // remove deafen effect
            
}
        }
    }
    return 
Plugin_Continue;


Edit:
Found bug, now fixed
Plugin optimized


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

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