Raised This Month: $ Target: $400
 0% 

invisible only to enemies


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 11-11-2012 , 11:41   invisible only to enemies
Reply With Quote #1

Hello,

Can someone help me how can i a team invisible but only to enemies, for example: i glow Ts invisbile, Ts can see each other, but a CT cannot see an invisible T and vice versa.

thanks in advance,
__________________
n0br41ner is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 11-11-2012 , 12:00   Re: invisible only to enemies
Reply With Quote #2

A possible solution could be 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 
__________________

Last edited by Neeeeeeeeeel.-; 11-11-2012 at 12:02.
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 11-11-2012 , 20:24   Re: invisible only to enemies
Reply With Quote #3

Thank you, i figured it out using AddToFullPack
__________________
n0br41ner is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 11-11-2012 , 23:37   Re: invisible only to enemies
Reply With Quote #4

Quote:
Originally Posted by n0br41ner View Post
Thank you, i figured it out using AddToFullPack
You should take care about that forward, it's called many times p/sec.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 11-12-2012 , 10:10   Re: invisible only to enemies
Reply With Quote #5

Yeah i know, i did the necessary checks and everything, also i had a look at another plugin that uses this method and i figured it out.

Yet thanks again xD
__________________
n0br41ner is offline
vitorrossi
Senior Member
Join Date: Apr 2012
Location: NY, USA
Old 11-12-2012 , 21:23   Re: invisible only to enemies
Reply With Quote #6

Could you share the code? I use

PHP Code:
public Forward_AddToFullPack_Post(es,e,iEntity,iHost,iHostFlags,iPlayer,pSet)
    {
        if(!
iPlayer){
            return 
FMRES_IGNORED;
        }
        
        else if(
g_iGetUserTeam[iEntity] == CS_TEAM_CT)
        {
            
set_es(es,ES_RenderMode,kRenderTransAdd);
            
            if(
g_iGetUserTeam[iHost] == CS_TEAM_T && isInvisible(iEntity) && is_user_alive(iHost)){
                
set_es(es,ES_RenderAmt,0);
            }
        
            else{
                
set_es(es,ES_RenderAmt,255);
            }
        }
        
        return 
FMRES_IGNORED
    } 
But I believe this is not efficient since addtofullpack is called many times per sec.
vitorrossi is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 11-13-2012 , 08:56   Re: invisible only to enemies
Reply With Quote #7

Sure i will just tell you where i found the function being used and based my code on that:
http://forums.alliedmods.net/showthread.php?t=168122 , download the source code and look at lines 1709 to 1720
__________________
n0br41ner is offline
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 06:37.


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