Raised This Month: $ Target: $400
 0% 

[solved] addtofullpack from an entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-13-2009 , 14:25   [solved] addtofullpack from an entity
Reply With Quote #1

I want to make an entity that I spawn glow to a single team, but I can't seem to make it working...

PHP Code:
public fw_addtofullpack(es_handleepidhostflagsplayerpSet)
{
    if(
player && iTeam[id] == && !is_player(p))
    {
          static class[
32]
 
          
entity_get_string(pEV_SZ_classname, class, 31)
 
          if(
equal(class, "my_entity_class"))
          {
               
set_es(es_handleES_RenderFxkRenderFxGlowShell)
               
set_es(es_handleES_RenderColor, {01000})
               
set_es(es_handleES_RenderAmt25)
          }
    }
 
    return 
FMRES_IGNORED

Or is this impossible ?
__________________
Hunter-Digital is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 05-13-2009 , 14:36   Re: addtofullpack from an entity
Reply With Quote #2

PHP Code:
new gMyEntity
when creating entity use gMyEntity for id then..
PHP Code:
public fw_addtofullpack(es_handleepidhostflagsplayerpSet) {
    if( !
player && == gMyEntity ) {
        if( 
iTeam[id] == ) {
            
set_eses_handleES_RenderFxkRenderFxGlowShell );
            
set_eses_handleES_RenderColor, {01000} );
            
set_eses_handleES_RenderAmt25 );
        }
    }
    
    return 
FMRES_IGNORED

__________________
xPaw is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-13-2009 , 18:01   Re: addtofullpack from an entity
Reply With Quote #3

Ok testing it out, but what does the "player" variable stands for ? if the host is a player or the ent ?

also hostflags and pSet, what are those for ? :}

edit: yep, works... it was like my version, but I checked if "player" was positive, I would have cached the ent afterwards anyway
__________________

Last edited by Hunter-Digital; 05-13-2009 at 18:07.
Hunter-Digital is offline
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 05-13-2009 , 18:44   Re: addtofullpack from an entity
Reply With Quote #4

never do something like retrieving a classname + equal() in addtofullpack, it takes a lot cpu! addtofullpack is called thousands of times within a few seconds! always cache data you need to check in addtofullpack.

Code:
FM_AddToFullPack(entState, e, ent, host, iHostFlags, iPlayer, pSet)

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.
__________________

Last edited by SchlumPF*; 05-13-2009 at 18:47.
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-13-2009 , 18:59   Re: [solved] addtofullpack from an entity
Reply With Quote #5

Yeah I know, it's like prethink, I used entity_get_string() just to test, so I don't do all the global variables and stuff and then I have the big surprise of not working xD

Hmm, would it help if I skip some frames from it... like so:
PHP Code:
#define SkipFrames 3
 
new iCancel 0
 
public fw_addtofullpack(/* etc */)
{
        if(
iCancel >= SkipFrames)
              
iCancel 0
        
else
        {
              
iCancel++
              return 
FMRES_IGNORED
        
}
 
        
// stuff...

? :}
__________________
Hunter-Digital is offline
SchlumPF*
Veteran Member
Join Date: Mar 2007
Old 05-13-2009 , 19:58   Re: [solved] addtofullpack from an entity
Reply With Quote #6

its not like prethink, test it yourself :X prethink is maybe called 10000 times when addtofullpack is near to 1mio (dont remember my testing values but addtofullpack also depends on the map).

skipping shouldnt be a huge thing to improve the plugins performance since you have to check, increment and reset the var.
__________________
SchlumPF* is offline
Send a message via ICQ to SchlumPF*
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 01:26.


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