AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need help, semiclip. (https://forums.alliedmods.net/showthread.php?t=134874)

t3hNox 08-09-2010 15:19

Need help, semiclip.
 
Hi,
Once again I need help. This time with semiclip. I want to make so that if player has bool Respawning[id] = true he can walk through enemy team players (but not his own team players). I suppose I just need to put somewhere if(Respawning[id]) check. The problem is that I don't know which of addToFullPack function's parameters refers to id/player (I have tried Respawning[player]).
PHP Code:

public addToFullPack(eseenthosthostflagsplayerpSet)
{
    if(
player)
    {
        if(
plrSolid[host] && plrSolid[ent] && plrTeam[host] == plrTeam[ent])
        {
            
set_es(esES_SolidSOLID_NOT)
            
set_es(esES_RenderModekRenderTransAlpha)
            
set_es(esES_RenderAmt85)
        }
    }
}

FirstThink()
{
    for(new 
1<= maxplayersi++)
    {
        if(!
is_user_alive(i))
        {
            
plrSolid[i] = false
            
continue
        }
        
        
plrTeam[i] = get_user_team(i)
        
plrSolid[i] = pev(ipev_solid) == SOLID_SLIDEBOX true false
    
}
}

public 
preThink(id)
{
    static 
iLastThink
    
    
if(LastThink id)
    {
        
FirstThink()
    }
    
LastThink id

    
    
if(!plrSolid[id]) return
    
    for(
1<= maxplayersi++)
    {
        if(!
plrSolid[i] || id == i) continue
        
        if(
plrTeam[i] == plrTeam[id])
        {
            
set_pev(ipev_solidSOLID_NOT)
            
plrRestore[i] = true
        
}
    }
}

public 
postThink(id)
{
    static 
i
    
    
for(1<= maxplayersi++)
    {
        if(
plrRestore[i])
        {
            
set_pev(ipev_solidSOLID_SLIDEBOX)
            
plrRestore[i] = false
        
}
    }


Thanks.

Jack86 08-09-2010 15:43

Re: Need help, semiclip.
 
Quote:

Originally Posted by ConnorMcLeod (Post 761925)
host is the player who you send the data (receiver), ent is the player from who you send datas (when player == 0, ent is not a player)

Bad english :(


t3hNox 08-09-2010 16:34

Re: Need help, semiclip.
 
Ok. It means that Respawning[ent] should be used to check whether to make player able to go through others or not.
PHP Code:

public addToFullPack(eseenthosthostflagsplayerpSet

    if(
player && Respawning[ent] == true// if true
    

        if(
plrSolid[host] && plrSolid[ent] && plrTeam[host] != plrTeam[ent])  // != to check whether the teams are different 
        

            
set_es(esES_SolidSOLID_NOT
            
set_es(esES_RenderModekRenderTransAlpha
            
set_es(esES_RenderAmt85
        } 
    } 


But what to do with the other forward ?
As a side question - the loop in the forward means that looping is done the whole time, isn't it (too) much CPU consuming ?

t3hNox 08-10-2010 06:56

Re: Need help, semiclip.
 
Sorry for double post :/
I remembered that xPaw's DR manager uses semiclip that I could edit. I have get this far:
PHP Code:

new bool:Respawning[33] = falsebool:g_NoSolid[33] = false

public plugin_init()
{
    
register_forwardFM_StartFrame,    "FwdStartFrame");
    
register_forwardFM_AddToFullPack,    "FwdFullPack",   );
}

public 
FwdFullPackeseenthostflagsplayerpSet ) {
    
    if( !
is_user_alive(ent) || !IsPlayer(ent) )
        return 
FMRES_IGNORED;
    
    if( 
is_user_alive(ent) && player && cs_get_user_team(ent) != cs_get_user_team(host) ) {
        
set_esesES_SolidSOLID_NOT );
        
set_esesES_RenderModekRenderTransAlpha );
        
set_esesES_RenderAmt85 );
    }
    
    return 
FMRES_IGNORED;
}

public 
FwdStartFrame( ) {
    
    static 
iPlayers32 ], iNumiPlayeriPlayer2ij;
    
get_playersiPlayersiNum"ach" );
    
    
arraysetg_NoSolid032 );
    
    if( 
iNum <= )
        return 
FMRES_IGNORED;
    
    for( 
0iNumi++ ) {
        
iPlayer iPlayers];
        
        if(
Respawning[iPlayer])
            continue;
        
        for( 
0iNumj++ ) {
            
iPlayer2 iPlayers];
            
            if( 
iPlayer == iPlayer2 )
                continue;
            
            if( 
RespawningiPlayer ] && cs_get_user_team(iPlayer) != cs_get_user_team(iPlayer2))
                continue;
            
            if( 
entity_rangeiPlayeriPlayer2 ) < 128 ) {
                
g_NoSolidiPlayer ] = true;
            }
        }
    }
    
    for( 
0iNumi++ ) {
        
iPlayer iPlayers];
        
        
set_peviPlayerpev_solidg_NoSolidiPlayer ] ? SOLID_NOT SOLID_SLIDEBOX );
    }
    
    return 
FMRES_IGNORED;


The problems I've enountered with are that it seems that T has only semiclip (all the time) and T is always half-visible. What I wanted to make is that is CT has Respawning[id] true, he can go through T.

t3hNox 08-11-2010 10:48

Re: Need help, semiclip.
 
I'm sorry for posting repeatedly but this semiclip part is now the only thing that keeps me away from finishing a plugin and also I have been working on these two functions for over a day now.
PHP Code:

new bool:Respawning[33] = falsebool:g_NoSolid[33] = false
public plugin_init()
{
    
register_forwardFM_StartFrame,    "FwdStartFrame");
    
register_forwardFM_AddToFullPack,    "FwdFullPack",   );
}

public 
FwdFullPackeseenthostflagsplayerpSet ) {

    if( 
player && g_NoSolident ] && g_NoSolidhost ] ) {
        
set_esesES_SolidSOLID_NOT );
        
set_esesES_RenderModekRenderTransAlpha );
        
set_esesES_RenderAmt85 );
    }
    
    return 
FMRES_IGNORED;
}

public 
FwdStartFrame( ) {

    static 
iPlayers32 ], iNumiPlayeriPlayer2ij;
    
get_playersiPlayersiNum"ah" );
    
    
arraysetg_NoSolid032 );
    
    if( 
iNum <= )
        return 
FMRES_IGNORED;
    
    for( 
0iNumi++ ) {
        
iPlayer iPlayers];
        
        for( 
0iNumj++ ) {
            
iPlayer2 iPlayers];
            
            if( 
iPlayer == iPlayer2 )
                continue;
            
            if( 
g_NoSolidiPlayer ] && g_NoSolidiPlayer2 ])
                continue;
                
            if(
Respawning[iPlayer] || Respawning[iPlayer2])
                continue;
            else                            
//else part not actually needed
                
break;
            
            if( 
entity_rangeiPlayeriPlayer2 ) < 100 ) {
                
g_NoSolidiPlayer ]    = true;
                
g_NoSolidiPlayer2 ]    = true;
            }
        }
    }
    
    for( 
0iNumi++ ) {
        
iPlayer iPlayers];
        
        
set_peviPlayerpev_solidg_NoSolidiPlayer ] ? SOLID_NOT SOLID_SLIDEBOX );
    }
    
    return 
FMRES_IGNORED;


Without if(Respawning[iPlayer] || Respawning[iPlayer2]) part everything is working, everyone has semiclip, but with Respawning check nothing is working.
IDK, where could be the problem.


All times are GMT -4. The time now is 21:57.

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