AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved AddToFullPack hide entity from specific player (https://forums.alliedmods.net/showthread.php?t=332713)

redivcram 05-28-2021 11:20

AddToFullPack hide entity from specific player
 
I am very confused as to how this thing works in AMXX. In a module, you would return a value of either MRES_IGNORED (To render the model to said player) or MRES_SUPERCEDE (To not render). I don't really want to set the rendering mode, because it doesn't even work. I am only trying to show/hide models to certain players with return values. Is it possible?

I don't understand how the AMXX equivalent works. Not many threads are correct nor provide enough detail about it.

PHP Code:

public FWAddToFullPackPost(es_handleeenthosthostflagsplayerpset) {

    if (!
player// Check whether target ent is player? Idk...
        
return FMRES_IGNORED;

    if (
KeyEnt(ent) && KeyPlayer(player))
        return 
FMRES_SUPERCEDE// Don't render key ent to key player

    
return FMRES_IGNORED;


The entities show whenever the second if statement is true or false and should only show if it's false.
Tried using 0 and 1 as return values. Nothing.

jimaway 05-28-2021 12:36

Re: AddToFullPack hide entity from specific player
 
you can't block anything after it is already happened

Code:

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 AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet )

try returning 0, but in pre hook

redivcram 05-28-2021 14:45

Re: AddToFullPack hide entity from specific player
 
Tried hooking Pre before, but I'm still being showed the entity.

jimaway 05-28-2021 15:29

Re: AddToFullPack hide entity from specific player
 
well probably could do it with orpheu then, if you still want to use fm you'll have to change rendering to make an entity invisible. or you could use groupinfo - that will also make addtofullpack return 0, but it does a lot more than just making it invisible

CrazY. 05-28-2021 15:31

Re: AddToFullPack hide entity from specific player
 
Code:
set_es(es_handle, ES_Effects, get_es(es_handle, ES_Effects) | EF_NODRAW)

redivcram 05-28-2021 17:03

Re: AddToFullPack hide entity from specific player
 
Well, I've tried everything now and got CrazY.'s method working, but should be hooked with Post and not Pre. Thanks!


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

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