PDA

View Full Version : Anti Team Flash


Alber9091
12-29-2016, 04:39
Hello,

I had searched many plugins in this regard, which should stop team flash, but none works fine, so, anyone there out to please help and make simple Anti Team Flash Plugin?

wickedd
12-29-2016, 06:25
Search again because there's one written by ConnorMcLeod that works. It's in the request forum.

JOMENVEST
12-29-2016, 06:37
This? https://forums.alliedmods.net/showthread.php?t=274226

OciXCrom
12-29-2016, 07:10
This? https://forums.alliedmods.net/showthread.php?t=274226

How can you not see that that is for CS:GO? Literally every second word in there is "csgo".

Alber9091
12-29-2016, 09:33
Search again because there's one written by ConnorMcLeod that works. It's in the request forum.

I got it, Thanks Wickedd

Well, I haven't checked it yet but here is the link, if anyone needs it in future ..!!

https://forums.alliedmods.net/showpost.php?p=1122081&postcount=11

And if you want Team Flash Bang to follow ff, like in mix, uncomment the following line and recompile it ..!!
// #define FOLLOW_FRIENDLYFIRE
To
#define FOLLOW_FRIENDLYFIRE

Will also soon, let you know, how it works .!!


#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

new const VERSION[] = "1.1.2"

// #define FOLLOW_FRIENDLYFIRE

const MAX_ENTSARRAYS_SIZE = 64

new g_bitGonnaExplode[MAX_ENTSARRAYS_SIZE]
#define SetGrenadeExplode(%1) g_bitGonnaExplode[%1>>5] |= 1<<(%1 & 31)
#define ClearGrenadeExplode(%1) g_bitGonnaExplode[%1>>5] &= ~( 1 << (%1 & 31) )
#define WillGrenadeExplode(%1) g_bitGonnaExplode[%1>>5] & 1<<(%1 & 31)

#if defined FOLLOW_FRIENDLYFIRE
const XTRA_OFS_PLAYER = 5
const m_iTeam = 114
#define cs_get_user_team_index(%1) get_pdata_int(%1, m_iTeam, XTRA_OFS_PLAYER)
new mp_friendlyfire
new g_iCurrentFlasher
new g_iCurrentTeam
#endif

new Float:g_flCurrentGameTime, g_iCurrentFlashBang

new g_iMaxPlayers
#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )

public plugin_init()
{
register_plugin("Anti Flashbang Bug", VERSION, "Numb / ConnorMcLeod")

RegisterHam(Ham_Think, "grenade", "Ham__CGrenade_Think__Pre")

register_forward(FM_FindEntityInSphere, "Fm__FindEntityInSphere__Pre")

#if defined FOLLOW_FRIENDLYFIRE
mp_friendlyfire = get_cvar_pointer("mp_friendlyfire")
#endif

g_iMaxPlayers = get_maxplayers()
}

public Ham__CGrenade_Think__Pre( iEnt )
{
static Float:flGameTime, Float:flDmgTime

flGameTime = get_gametime()
pev(iEnt, pev_dmgtime, flDmgTime)

#if defined FOLLOW_FRIENDLYFIRE
static iOwner
if( flDmgTime <= flGameTime
&& get_pdata_int(iEnt, 114) == 0 // has a bit when is HE or SMOKE
&& !(get_pdata_int(iEnt, 96) & (1<<8)) // has this bit when is c4
&& IsPlayer( (iOwner = pev(iEnt, pev_owner)) ) ) // if no owner grenade gonna be removed from world
#else
if( flDmgTime <= flGameTime
&& get_pdata_int(iEnt, 114) == 0 // has a bit when is HE or SMOKE
&& !(get_pdata_int(iEnt, 96) & (1<<8)) // has this bit when is c4
&& IsPlayer( pev(iEnt, pev_owner) ) )
#endif
{
if( ~WillGrenadeExplode(iEnt) ) // grenade gonna explode on next think
{
SetGrenadeExplode( iEnt )
}
else
{
ClearGrenadeExplode( iEnt )
g_flCurrentGameTime = flGameTime
g_iCurrentFlashBang = iEnt

#if defined FOLLOW_FRIENDLYFIRE
g_iCurrentFlasher = iOwner
g_iCurrentTeam = cs_get_user_team_index(iOwner)
#endif
}
}
}

public Fm__FindEntityInSphere__Pre(iStartEnt, Float:fVecOrigin[3], Float:flRadius)
{
const Float:FLASHBANG_SEARCH_RADIUS = 1500.0
if( flRadius == FLASHBANG_SEARCH_RADIUS
&& get_gametime() == g_flCurrentGameTime )
{
new id = iStartEnt, Float:fVecPlayerEyeOrigin[3], Float:flFraction

while( IsPlayer( (id=engfunc(EngFunc_FindEntityInSphere, id, fVecOrigin, flRadius)) ) )
{
if( is_user_alive(id) )
{
pev(id, pev_origin, fVecPlayerEyeOrigin)
fVecPlayerEyeOrigin[2] += ((pev(id, pev_flags) & FL_DUCKING) ? 12.0 : 18.0)

engfunc(EngFunc_TraceLine, fVecOrigin, fVecPlayerEyeOrigin, DONT_IGNORE_MONSTERS, g_iCurrentFlashBang, 0)

get_tr2(0, TR_flFraction, flFraction)

if( flFraction < 1.0 && get_tr2(0, TR_pHit) == id )
{
engfunc(EngFunc_TraceLine, fVecPlayerEyeOrigin, fVecOrigin, DONT_IGNORE_MONSTERS, id, 0)
get_tr2(0, TR_flFraction, flFraction)
#if defined FOLLOW_FRIENDLYFIRE
if( flFraction == 1.0
&& ( get_pcvar_num(mp_friendlyfire)
|| id == g_iCurrentFlasher
|| cs_get_user_team_index(id) != g_iCurrentTeam ) )
#else
if( flFraction == 1.0 )
#endif
{
forward_return(FMV_CELL, id)
return FMRES_SUPERCEDE
}
}
}
}
forward_return(FMV_CELL, 0)
return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}

JOMENVEST
12-29-2016, 10:42
How can you not see that that is for CS:GO? Literally every second word in there is "csgo".

Oops, my bad he he he

baneado
12-29-2016, 12:06
ConnorMcLeod's plugin that you found is a remake of that plugin:
https://forums.alliedmods.net/showthread.php?t=70735

It fixes a bug on flashbang. But as I read on that post, Valve already have fixed it. So isn't necessary to have it
https://forums.alliedmods.net/showpost.php?p=1901513&postcount=44

Now, that plugin is only useful for block teammates flashbangs. That was not the purpose of the plugin, so we have unnecessary code.

We need a plugin with the purpose of block flash by teammates.

Searching, I have found this plugin (I added g_iOwner)
Plugin works, but has a bug which it makes invisible to enemies. I don't know why, probably the problem is "get_msg_arg_int(7)" ?
#include <amxmodx>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <hamsandwich>

#define VERSION "0.0.1"

new CsTeams:g_iTeamFlash, g_iOwner

public plugin_init()
{
register_plugin("No Team Flash", VERSION, "ConnorMcLeod")

register_message(get_user_msgid("ScreenFade"), "Message_ScreenFade")

RegisterHam(Ham_Think, "grenade", "Grenade_Think")
}

public Message_ScreenFade(iMsgId, MSG_DEST, id)
{
if ( get_msg_arg_int(4) != 255 || get_msg_arg_int(5) != 255 || get_msg_arg_int(6) != 255 || get_msg_arg_int(7) < 200 )
return PLUGIN_CONTINUE

if ( !is_user_alive(id) || g_iOwner != id && cs_get_user_team(id) != g_iTeamFlash )
return PLUGIN_CONTINUE

return PLUGIN_HANDLED
}

public Grenade_Think( iEnt )
{
static Float:flGameTime
flGameTime = get_gametime()
if( entity_get_float(iEnt, EV_FL_dmgtime) <= flGameTime
&& get_pdata_int(iEnt, 114) == 0
&& !(get_pdata_int(iEnt, 96) & (1<<8)) )
{
static iCount
if( ++iCount == 2 )
{
static iOwner ; iOwner = entity_get_edict(iEnt, EV_ENT_owner)
if( is_user_connected(iOwner) )
{
g_iOwner = iOwner
g_iTeamFlash = cs_get_user_team(iOwner)
}
else
{
g_iOwner = 0
g_iTeamFlash = CS_TEAM_UNASSIGNED
}
}
else
{
g_iOwner = 0
g_iTeamFlash = CS_TEAM_UNASSIGNED
if( iCount == 3 )
{
iCount = 0
}
}
}
}