Raised This Month: $170 Target: $400
 42% 

Semiclip Bug


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 06-12-2018 , 05:48   Semiclip Bug
Reply With Quote #1

I made this plugin to fix that blocking door opening. It doesn't work. Can you make my plugin as I want as. Thanks for helping

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

new entities[][] = {
    
"func_door",
    
"func_door_rotating",
    
"func_rotating",
    
"momentary_door",
    
"env_laser",
    
"env_beam",
    
"env_explosion",
    
"func_breakable"
}

new 
bool:g_semiclip[33], semiclip;
new 
bool:g_semiclip_block;

public 
plugin_init() {
    
register_plugin("Semiclip""1.0""PurposeLess");

    
register_forward(FM_StartFrame"fwStartFrame"0);
    
register_forward(FM_AddToFullPack"fwFullPack"1);
    
register_forward(FM_ShouldCollide"FwdShouldCollide");

    for(new 
i=0i<sizeof entitiesi++)
    {
        
RegisterHam(Ham_Blockedentities[i], "Ham_Block");
    }

    
bind_pcvar_num(create_cvar("semiclip""1"FCVAR_NONE"Semiclip", .has_min true, .min_val 0.0, .has_max true, .max_val 1.0), semiclip);
}

public 
Ham_Block(ident)
{
    if(!
semiclip) return HAM_IGNORED;

    
g_semiclip_block true;
    return 
HAM_IGNORED;
}

public 
fwFullPack(eseenthostflagsplayerset)
{
    if(!
semiclip) return FMRES_IGNORED;

    if(
player && g_semiclip[ent] && g_semiclip[host])
    {
        
set_es(esES_SolidSOLID_NOT);
        
set_es(esES_RenderModekRenderTransAlpha);
        
set_es(esES_RenderAmt100);
    }
    return 
FMRES_IGNORED;
}

public 
fwStartFrame()
{
    if(!
semiclip) return FMRES_IGNORED;

    new 
team[33] = {-1, ...};
    
arrayset(g_semiclip0sizeof(semiclip));

    for(new 
id=1id<=32id++)
    {
        if(!
is_user_alive(id)) continue;

        for(new 
Uid=1Uid<=32Uid++)
        {
            if(
id == Uid || !is_user_alive(Uid)) continue;

            static 
Float:vOrigin1[3], Float:vOrigin2[3];
            
pev(idpev_originvOrigin1);
            
pev(Uidpev_originvOrigin2);

            if(
vector_distance(vOrigin1vOrigin2) < 96)
            {
                if(
team[id] == -1)
                    
team[id] = get_user_team(id);
                if(
team[Uid] == -1)
                    
team[Uid] = get_user_team(Uid);

                if(
team[id] == team[Uid])
                {
                    
g_semiclip[id]    = true
                    
g_semiclip[Uid]    = true
                }
            }
        }
        
set_pev(idpev_solidg_semiclip[id] ? SOLID_NOT:SOLID_SLIDEBOX);
    }
    return 
FMRES_IGNORED;
}

#define IsPlayer(%1) (1 <= %1 <= get_maxplayers())

public FwdShouldCollide(const touched, const other)
{
    if(!
semiclip) return FMRES_IGNORED;

    if(
g_semiclip_block)
    {
        new 
iTeams[33] = {-1, ...};
        if(
IsPlayer(touched) && IsPlayer(other)) {
            
iTeams[touched]  = get_user_team(touched);
            
iTeams[other]    = get_user_team(other);

            if(
iTeams[touched] == iTeams[other]) {
                
forward_return(FMV_CELL0)
                return 
FMRES_SUPERCEDE;
            }
        }
        
g_semiclip_block false;
    }
    return 
FMRES_IGNORED;

PurposeLessx is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 06-12-2018 , 17:33   Re: Semiclip Bug
Reply With Quote #2

++
PurposeLessx is offline
Reply


Thread Tools
Display Modes

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 15:44.


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