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

A little help on a Team Semi clip


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 04-25-2018 , 23:42   A little help on a Team Semi clip
Reply With Quote #1

Hello folks I need a help with the semiclip team plugin made by Master ConnorMcLeod, what changes should I make so as not to cross the enemy team, just the team itself?

PHP Code:
#define ENABLE_SHOTS_DAMAGE
#define SEMICLIP_RENDERING_RADIUS 400.0

// DON'T EDIT BELOW

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

#pragma semicolon 1

#define PLUGIN "SemiClip"
#define VERSION "0.2.0"

const Float:SEMICLIP_RADIUS SEMICLIP_RENDERING_RADIUS;

const 
groupNone 0;

new const 
PLAYER_CLASS[] = "player";

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

#define MaskEnt(%0)    ( 1<<(%0 & 31) )

new g_bitIsPlayerInSphere;
#define IsPlayerInSphere(%0)    ( g_bitIsPlayerInSphere & MaskEnt(%0) )

new g_bitBots;
#define MarkPlayerBot(%0)    g_bitBots |= MaskEnt(%0)
#define ClearPlayerBot(%0)    g_bitBots &= ~MaskEnt(%0)
#define IsUserBot(%0)        ( g_bitBots & MaskEnt(%0) )

new g_iPlayers[32], g_iNum;

new 
g_iLastPlayerIndex;

new 
HamHook:g_iHhPreThinkHamHook:g_iHhPreThinkPost;
new 
g_iFhAddToFullPackPost;

new 
bool:g_bPreThinkHooked;

#if defined ENABLE_SHOTS_DAMAGE
new HamHook:g_iHhPostThinkHamHook:g_iHhPostThinkPost;
new 
bool:g_bPostThinkHooked;
#endif

new bool:g_bReadPackets true;

public 
plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" );

    
register_forward(FM_CmdStart"OnCmdStart"false);

    
DisableHamForwardg_iHhPreThink RegisterHam(Ham_Player_PreThinkPLAYER_CLASS"OnCBasePlayer_PreThink"false) );
    
DisableHamForwardg_iHhPreThinkPost RegisterHam(Ham_Player_PreThinkPLAYER_CLASS"OnCBasePlayer_PreThink_P"true) );

#if defined ENABLE_SHOTS_DAMAGE
    
DisableHamForwardg_iHhPostThink RegisterHam(Ham_Player_PostThinkPLAYER_CLASS"OnCBasePlayer_PostThink"false) );
    
DisableHamForwardg_iHhPostThinkPost RegisterHam(Ham_Player_PostThinkPLAYER_CLASS"OnCBasePlayer_PostThink_P"true) );
#endif

    
RegisterHam(Ham_SpawnPLAYER_CLASS"OnCBasePlayer_Spawn_P"true);
    
RegisterHam(Ham_KilledPLAYER_CLASS"OnCBasePlayer_Killed_P"true);

    
register_forward(FM_UpdateClientData"OnUpdateClientData_P"true);

    
g_iMaxPlayers get_maxplayers();
}

public 
client_putinserver(id)
{
    if( 
is_user_bot(id) )
    {
        
MarkPlayerBot(id);
    }
    else
    {
        
ClearPlayerBot(id);
    }
}

public 
OnCmdStart(id)
{
    if( !
g_bReadPackets )
    {
        
g_bReadPackets true;
        
SetPlayersGroups ;;
    }

    if( 
g_iLastPlayerIndex && is_user_alive(g_iLastPlayerIndex) )
    {
        
entity_set_int idEV_INT_groupinfoMaskEnt(g_iLastPlayerIndex) ;
    }

    if( 
is_user_alive(id) )
    {
        
entity_set_int idEV_INT_groupinfoMaskEnt(id) ;
        if( !
IsUserBot(id) )
        {
            if( !
g_bPreThinkHooked )
            {
                
EnableHamForward g_iHhPreThink ;
                
EnableHamForward g_iHhPreThinkPost ;
                
g_bPreThinkHooked true;
            }
        }
        else if( 
g_bPreThinkHooked )
        {
            
DisableHamForward g_iHhPreThink ;
            
DisableHamForward g_iHhPreThinkPost ;
            
g_bPreThinkHooked false;
        }
#if defined ENABLE_SHOTS_DAMAGE
        
if( !g_bPostThinkHooked )
        {
            
EnableHamForward g_iHhPostThink ;
            
EnableHamForward g_iHhPostThinkPost ;
            
g_bPostThinkHooked true;
        }
#endif
    
}
    else
    {
        
entity_set_int idEV_INT_groupinfogroupNone ;
        
g_iLastPlayerIndex id;
        if( 
g_bPreThinkHooked )
        {
            
DisableHamForward g_iHhPreThink ;
            
DisableHamForward g_iHhPreThinkPost ;
            
g_bPreThinkHooked false;
        }
#if defined ENABLE_SHOTS_DAMAGE
        
if( g_bPostThinkHooked )
        {
            
DisableHamForward g_iHhPostThink ;
            
DisableHamForward g_iHhPostThinkPost ;
            
g_bPostThinkHooked false;
        }
#endif
    
}
}

public 
OnCBasePlayer_PreThink(id)
{
    
entity_set_int idEV_INT_groupinfogroupNone ;
}

public 
OnCBasePlayer_PreThink_P(id)
{
    
entity_set_int idEV_INT_groupinfoMaskEnt(id) ;
}

#if defined ENABLE_SHOTS_DAMAGE
public OnCBasePlayer_PostThink(id)
{
    
entity_set_int idEV_INT_groupinfogroupNone ;
}

public 
OnCBasePlayer_PostThink_P(id)
{
    
entity_set_int idEV_INT_groupinfoMaskEnt(id) ;
}
#endif

public OnCBasePlayer_Spawn_P(id)
{
    if( 
is_user_alive(id) )
    {
        
entity_set_int idEV_INT_groupinfoMaskEnt(id) ;
    }
}

public 
OnCBasePlayer_Killed_P(id)
{
    if( !
is_user_alive(id) )
    {
        
entity_set_int idEV_INT_groupinfogroupNone ;
    }
}

SetPlayersGroups()
{
    static 
id;
    
get_players g_iPlayersg_iNum"a" ;
    for(--
g_iNumg_iNum>=0g_iNum--)
    {
        
id g_iPlayersg_iNum ];
        
entity_set_int idEV_INT_groupinfoMaskEnt(id) ;
    }
}

public 
server_frame()
{
    
g_iLastPlayerIndex 0;
    
g_bReadPackets false;
    
SetPlayersGroups ;;
}

public 
OnUpdateClientData_P(idsendweaponscd)
{
    
entity_set_int idEV_INT_groupinfogroupNone ;

    if( !
IsUserBot(id) && is_user_alive(id) )
    {
        if( !
g_iFhAddToFullPackPost )
        {
            
g_iFhAddToFullPackPost register_forward(FM_AddToFullPack"OnAddToFullPack_P"true);
        }

        
g_bitIsPlayerInSphere 0;
        
g_iNum find_sphere_class(idPLAYER_CLASSSEMICLIP_RADIUSg_iPlayersg_iMaxPlayers);
        for(--
g_iNumg_iNum>=0g_iNum--)
        {
            
MarkPlayerInSphereg_iPlayersg_iNum ] );
        }
    }
}

public 
OnAddToFullPack_P(eseentidhostflagsplayerpSet)
{
    if( 
player )
    {
        if( 
get_orig_retval() )
        {
            
set_es esES_SolidSOLID_NOT // should be useless since SEMICLIP_RADIUS gonna never be set to 72 or less
            
if( IsPlayerInSphere(ent) )
            {
                
set_es esES_RenderModekRenderTransAlpha ;
                
set_es esES_RenderAmtfloatround(entity_range(ident) * 255.0 SEMICLIP_RADIUSfloatround_floor) ;
            }
        }
    }
    else
    {
        
entity_set_int idEV_INT_groupinfoMaskEnt(id) ;
        
unregister_forward FM_AddToFullPackg_iFhAddToFullPackPosttrue ;
        
g_iFhAddToFullPackPost 0;
    }

thanks in advance.

Last edited by iceeedr; 04-25-2018 at 23:43. Reason: .
iceeedr is offline
Send a message via Skype™ to iceeedr
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:12.


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