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

[CS:GO] Testing anti flash plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 12-19-2019 , 12:56   [CS:GO] Testing anti flash plugin
Reply With Quote #1

Can someone test this plugin if its working correctly?

PHP Code:

#include <sourcemod>
#include <sdktools>
#include <cstrike>

#define NO_FLASH_DURATION    0.0
float g_FlashDuration[MAXPLAYERS 1];

public 
void OnPluginStart()
{
    
HookEvent("flashbang_detonate"Event_FlashbangDetonate);
}

public 
void Event_FlashbangDetonate(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    if (!
client || !IsClientInGame(client))
    {
        return;
    }
    
    
GetFlashDurations(client);
    
RequestFrame(SetFlashDurations);
}

void GetFlashDurations(int thrower)
{
    
int teamThrower GetClientTeam(thrower);
    
    
// Anti flash alive teammates
    
for (int i 1<= MaxClientsi++)
    {
        
g_FlashDuration[i] = NO_FLASH_DURATION;
        if (
== thrower || !IsClientInGame(i) || !IsPlayerAlive(i) || GetClientTeam(i) != teamThrower)
        {
            continue;
        }
        
        
g_FlashDuration[i] = GetEntPropFloat(iProp_Send"m_flFlashDuration");
    }
    
    
// The spectators will see exactly what the player that they are spectating sees
    
for (int i 1<= MaxClientsi++)
    {        
        if (!
IsClientInGame(i) || !IsClientObserver(i))
        {
            continue;
        }
        
        
int specTarget GetEntPropEnt(iProp_Send"m_hObserverTarget");
        if (
specTarget == -1)
        {
            continue;
        }
        
        
g_FlashDuration[i] = g_FlashDuration[specTarget];
    }
}

void SetFlashDurations(any data)
{
    for (
int i 1<= MaxClientsi++)
    {
        if (!
IsClientInGame(i) || g_FlashDuration[i] == NO_FLASH_DURATION)
        {
            continue;
        }
        
        
SetEntPropFloat(iProp_Send"m_flFlashDuration"g_FlashDuration[i]);
    }

I don't have a server (with players) to test it. It should anti flash alive teammates. The spectators will see exactly what the player that they are spectating sees (if the player is flashed they will be flashed etc).
If the my teammate was flashed by the enemy and then i flash him, my teammate will be still flashed by the enemy flash. I've seen that currently anti flash plugins doesn't have this feature, thats why i wrote it ...
__________________
Ilusion9 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 01:53.


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