AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   FM_AddToFullPack (https://forums.alliedmods.net/showthread.php?t=100862)

ot_207 08-18-2009 17:42

FM_AddToFullPack
 
I want details about all the function parameters what they mean.
What does the forward itself refer to?
Some example usages with explanations would be nice. :D

Arkshine 08-18-2009 17:48

Re: FM_AddToFullPack
 
I would love to say to you : search ! :mrgreen:

Really, there are already some threads about that, try to search, please. :p

ot_207 08-18-2009 17:51

Re: FM_AddToFullPack
 
Quote:

Originally Posted by Arkshine (Post 904851)
I would love to say to you : search ! :mrgreen:

Really, there are already some threads about that, try to search, please. :p

Will try, if I don't find something good enough I'll be back here :twisted:! Or at least with some questions.

Dr.G 08-18-2009 17:56

Re: FM_AddToFullPack
 
if you find something usefull dont keep it as a secret ;)

ot_207 08-18-2009 18:06

Re: FM_AddToFullPack
 
PHP Code:

/* 
AddToFullPack 

Return 1 if the entity state has been filled in for the ent and the entity will be propagated to the client, 0 otherwise 

state is the server maintained copy of the state info that is transmitted to the client 
a MOD could alter values copied into state to send the "host" a different look for a particular entity update, etc. 
e and ent are the entity that is being added to the update, if 1 is returned 
host is the player's edict of the player whom we are sending the update to 
player is 1 if the ent/e is a player and 0 otherwise 
pSet is either the PAS or PVS that we previous set up.  We can use it to ask the engine to filter the entity against the PAS or PVS. 
we could also use the pas/ pvs that we set in SetupVisibility, if we wanted to.  Caching the value is valid in that case, but still only for the current frame 
*/ 
int AddToFullPackstruct entity_state_s *stateint eedict_t *entedict_t *hostint hostflagsint playerunsigned char *pSet 

    
int                    i

    
// don't send if flagged for NODRAW and it's not the host getting the message 
    
if ( ( ent->v.effects == EF_NODRAW ) && 
         ( 
ent != host ) ) 
        return 
0

    
// Ignore ents without valid / visible models 
    
if ( !ent->v.modelindex || !STRINGent->v.model ) ) 
        return 
0

    
// Don't send spectators to other players 
    
if ( ( ent->v.flags FL_SPECTATOR ) && ( ent != host ) ) 
    { 
        return 
0
    } 

    
// Ignore if not the host and not touching a PVS/PAS leaf 
    // If pSet is NULL, then the test will always succeed and the entity will be added to the update 
    
if ( ent != host 
    { 
        if ( !
ENGINE_CHECK_VISIBILITY( (const struct edict_s *)entpSet ) ) 
        { 
            return 
0
        } 
    } 


    
// Don't send entity to local client if the client says it's predicting the entity itself. 
    
if ( ent->v.flags FL_SKIPLOCALHOST 
    { 
        if ( ( 
hostflags ) && ( ent->v.owner == host ) ) 
            return 
0
    } 
     
    if ( 
host->v.groupinfo 
    { 
        
UTIL_SetGroupTracehost->v.groupinfoGROUP_OP_AND ); 

        
// Should always be set, of course 
        
if ( ent->v.groupinfo 
        { 
            if ( 
g_groupop == GROUP_OP_AND 
            { 
                if ( !(
ent->v.groupinfo host->v.groupinfo ) ) 
                    return 
0
            } 
            else if ( 
g_groupop == GROUP_OP_NAND 
            { 
                if ( 
ent->v.groupinfo host->v.groupinfo 
                    return 
0
            } 
        } 

        
UTIL_UnsetGroupTrace(); 
    } 

    
memsetstate0sizeof( *state ) ); 

    
// Assign index so we can track this entity from frame to frame and 
    //  delta from it. 
    
state->number      e
    
state->entityType ENTITY_NORMAL
     
    
// Flag custom entities. 
    
if ( ent->v.flags FL_CUSTOMENTITY 
    { 
        
state->entityType ENTITY_BEAM
    } 

    
//  
    // Copy state data 
    // 

    // Round animtime to nearest millisecond 
    
state->animtime   = (int)(1000.0 ent->v.animtime ) / 1000.0

    
memcpystate->originent->v.originsizeof( float ) ); 
    
memcpystate->anglesent->v.anglessizeof( float ) ); 
    
memcpystate->minsent->v.minssizeof( float ) ); 
    
memcpystate->maxsent->v.maxssizeof( float ) ); 

    
memcpystate->startposent->v.startpossizeof( float ) ); 
    
memcpystate->endposent->v.endpossizeof( float ) ); 

    
state->impacttime ent->v.impacttime
    
state->starttime ent->v.starttime

    
state->modelindex ent->v.modelindex
         
    
state->frame      ent->v.frame

    
state->skin       ent->v.skin
    
state->effects    ent->v.effects

    
// This non-player entity is being moved by the game .dll and not the physics simulation system 
    //  make sure that we interpolate it's position on the client if it moves 
    
if ( !player && 
         
ent->v.animtime && 
         
ent->v.velocity] == &&  
         
ent->v.velocity] == &&  
         
ent->v.velocity] == 
    { 
        
state->eflags |= EFLAG_SLERP
    } 

    
state->scale      ent->v.scale
    
state->solid      ent->v.solid
    
state->colormap   ent->v.colormap

    
state->movetype   ent->v.movetype
    
state->sequence   ent->v.sequence
    
state->framerate  ent->v.framerate
    
state->body       ent->v.body

    for (
04i++) 
    { 
        
state->controller[i] = ent->v.controller[i]; 
    } 

    for (
02i++) 
    { 
        
state->blending[i]   = ent->v.blending[i]; 
    } 

    
state->rendermode    ent->v.rendermode
    
state->renderamt     ent->v.renderamt;  
    
state->renderfx      ent->v.renderfx
    
state->rendercolor.ent->v.rendercolor.x
    
state->rendercolor.ent->v.rendercolor.y
    
state->rendercolor.ent->v.rendercolor.z

    
state->aiment 0
    if ( 
ent->v.aiment 
    { 
        
state->aiment ENTINDEXent->v.aiment ); 
    } 

    
state->owner 0
    if ( 
ent->v.owner 
    { 
        
int owner ENTINDEXent->v.owner ); 
         
        
// Only care if owned by a player 
        
if ( owner >= && owner <= gpGlobals->maxClients 
        { 
            
state->owner owner;     
        } 
    } 

    
// HACK:  Somewhat... 
    // Class is overridden for non-players to signify a breakable glass object ( sort of a class? ) 
    
if ( !player 
    { 
        
state->playerclass  ent->v.playerclass
    } 

    
// Special stuff for players only 
    
if ( player 
    { 
        
memcpystate->basevelocityent->v.basevelocitysizeof( float ) ); 

        
state->weaponmodel  MODEL_INDEXSTRINGent->v.weaponmodel ) ); 
        
state->gaitsequence ent->v.gaitsequence
        
state->spectator ent->v.flags FL_SPECTATOR
        
state->friction     ent->v.friction

        
state->gravity      ent->v.gravity
//        state->team            = ent->v.team; 
//         
        
state->usehull      = ( ent->v.flags FL_DUCKING ) ? 0
        
state->health        ent->v.health
    } 

    return 
1


THis is a thing that I haven't seen it on the forums yet, anyway it is good.

Dr.G 08-19-2009 09:04

Re: FM_AddToFullPack
 
Thanks! So the forward is called as often as prethink or so?

And this will make team mates glow red:

PHP Code:

public plugin_init() 
{
 
register_forward(FM_AddToFullPack"func_AddToFullPack"1)
}
 
 
public 
func_AddToFullPack(es_handleeenthosthostflagsplayerpSet)
{
 if(!
player || !pev_valid(player)) 
  return 
FMRES_IGNORED
 
 
if(get_user_team(player) == get_user_team(ent) && pev_valid(ent))
 {
  
set_pev(playerpev_renderfxkRenderFxGlowShell)
  
set_pev(playerpev_rendercolor, {25500})
  
set_pev(playerpev_rendermodekRenderTransAlpha)
  
set_pev(playerpev_renderamt0)
 }
 return 
FMRES_IGNORED



or??

ot_207 08-19-2009 09:14

Re: FM_AddToFullPack
 
Quote:

Originally Posted by Dr.G (Post 905416)
Thanks! So the forward is called as often as prethink or so?

And this will make team mates glow red:

PHP Code:

public plugin_init() 
{
 
register_forward(FM_AddToFullPack"func_AddToFullPack"1)
}
 
 
public 
func_AddToFullPack(es_handleeenthosthostflagsplayerpSet)
{
 if(!
player || !pev_valid(player)) 
  return 
FMRES_IGNORED
 
 
if(get_user_team(player) == get_user_team(ent) && pev_valid(ent))
 {
  
set_pev(playerpev_renderfxkRenderFxGlowShell)
  
set_pev(playerpev_rendercolor, {25500})
  
set_pev(playerpev_rendermodekRenderTransAlpha)
  
set_pev(playerpev_renderamt0)
 }
 return 
FMRES_IGNORED



or??

Yes it should do it, although I didn't look carefully at it.
And this forward is called more times than prethink. 1000 per second. Prethink is called 33 times per second. So you must be careful.

Dr.G 08-19-2009 09:20

Re: FM_AddToFullPack
 
Quote:

Originally Posted by ot_207 (Post 905422)
... So you must be careful.


Just what i thought. Thanks

xPaw 08-19-2009 09:47

Re: FM_AddToFullPack
 
It is called damn many times xD for example after 1000 prethinks, addtofullpack already have been called for 1 million times lol

joaquimandrade 08-19-2009 10:05

Re: FM_AddToFullPack
 
Quote:

Originally Posted by Dr.G (Post 905416)
Thanks! So the forward is called as often as prethink or so?

And this will make team mates glow red:

PHP Code:

public plugin_init() 
{
 
register_forward(FM_AddToFullPack"func_AddToFullPack"1)
}
 
 
public 
func_AddToFullPack(es_handleeenthosthostflagsplayerpSet)
{
 if(!
player || !pev_valid(player)) 
  return 
FMRES_IGNORED
 
 
if(get_user_team(player) == get_user_team(ent) && pev_valid(ent))
 {
  
set_pev(playerpev_renderfxkRenderFxGlowShell)
  
set_pev(playerpev_rendercolor, {25500})
  
set_pev(playerpev_rendermodekRenderTransAlpha)
  
set_pev(playerpev_renderamt0)
 }
 return 
FMRES_IGNORED


or??

Its incorrect Dr. Corrected:

PHP Code:

public func_AddToFullPack(es_handleeenthosthostflagsplayerpSet)
{
     if(!
player)
      return 
FMRES_IGNORED
     
     
if(get_user_team(host) == get_user_team(ent))
     {
        
set_es(es,ES_RenderFxkRenderFxGlowShell)
        
set_es(es,ES_RenderColor, {25500})
        
set_es(es,ES_RenderMode,kRenderTransAlpha)
        
set_es(es,ES_RenderAmt,255// Chenge this value as needed (i'm guessing you dont want 0)
      
     
}
     return 
FMRES_IGNORED 




All times are GMT -4. The time now is 15:03.

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