AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Forcing a player with a different groupinfo to render (AddToFullPack) (https://forums.alliedmods.net/showthread.php?t=313764)

gabuch2 01-21-2019 21:30

Forcing a player with a different groupinfo to render (AddToFullPack)
 
Hello

I'm trying to render a player from another groupinfo using AddToFullPack.

I'm returning 1 on this forward to force a propagation to the client but it doesn't seem to be working.

What I am doing wrong? How can I achieve this?

Code:
public plugin_init() {     register_forward(FM_AddToFullPack, "pred", 1) } /* 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 · "ent_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 "edict_t_ent" are the entity that is being added to the update, if 1 is returned · "edict_t_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 */ public pred(ent_state,e,edict_t_ent,edict_t_host,hostflags,player,pSet) {       if(player)     {         [...]         forward_return(FMV_CELL,1);         return FMRES_OVERRIDE;     }         return FMRES_IGNORED; }

Thanks in advance.

EDIT: Forgot my return value, recompiled the plugin but it still doesn't work.

klippy 01-22-2019 06:48

Re: Forcing a player with a different groupinfo to render (AddToFullPack)
 
The state probably doesn't get filled. The game code will take THIS path and not continue further down, which is most likely the issue.
You could try removing groupinfo from the player in question in the pre-hook, then set it back in the post-hook.

CrazY. 01-22-2019 07:36

Re: Forcing a player with a different groupinfo to render (AddToFullPack)
 
Return values are ignored in post forwards as far I know.

gabuch2 01-22-2019 13:05

Re: Forcing a player with a different groupinfo to render (AddToFullPack)
 
Quote:

Originally Posted by KliPPy (Post 2635939)
The state probably doesn't get filled. The game code will take THIS path and not continue further down, which is most likely the issue.
You could try removing groupinfo from the player in question in the pre-hook, then set it back in the post-hook.

Is there no other way to force its rendering?

I can't change the groupinfo on the go since this is being used as a semiclip method from AngelScript (Sven Co-op), and I'm managing the AddToFullPack method from AMXX. (AddToFullPack is not supported by AS)

I'm not using metamod's semiclip because the latest update changed the SV_ClipToLinks method in the engine, so the metamod plugin no longer works.

Quote:

Originally Posted by CrazY. (Post 2635948)
Return values are ignored in post forwards as far I know.

Makes sense, but still wouldn't work because of what was written previously. (Already tested it)

klippy 01-22-2019 13:36

Re: Forcing a player with a different groupinfo to render (AddToFullPack)
 
You will change it only for a single call (AddToFullPack), it won't affect any other code. Collision is not processed in AddToFullPack so it won't matter for collision. At least give it a try and see the results for yourself, it may work.

gabuch2 01-22-2019 16:14

Re: Forcing a player with a different groupinfo to render (AddToFullPack)
 
Quote:

Originally Posted by KliPPy (Post 2636058)
You will change it only for a single call (AddToFullPack), it won't affect any other code. Collision is not processed in AddToFullPack so it won't matter for collision. At least give it a try and see the results for yourself, it may work.

You were right, now it renders the players, however, every time I pass through one of them I get a small "bump", cancelling my speed. Probably because I changed the groupinfo in the pre hook.

Final Code
Code:
public semiclip_pre(ent_state,e,edict_t_ent,edict_t_host,hostflags,player,pSet) {       if(player)     {         g_iGroupInfoBuffer[edict_t_ent] = pev(edict_t_ent, pev_groupinfo);         set_pev(edict_t_ent, pev_groupinfo, pev(edict_t_host, pev_groupinfo));     }         return FMRES_IGNORED; } public semiclip_post(ent_state,e,edict_t_ent,edict_t_host,hostflags,player,pSet) {       if(player)     {         if(pev(edict_t_host, pev_groundentity) == edict_t_ent)             set_es(ent_state, ES_Solid, 1);         else             set_es(ent_state, ES_Solid, 0);         set_pev(edict_t_ent, pev_groupinfo, g_iGroupInfoBuffer[edict_t_ent]);     }         return FMRES_IGNORED; }

I guess it's enough for now as a workaround, I don't know if that's fixable.

Thank you.

klippy 01-22-2019 17:40

Re: Forcing a player with a different groupinfo to render (AddToFullPack)
 
g_iGroupInfoBuffer doesn't have to be an array (that is probably 33 long?), it can be a single cell because no other player will get processed between pre and post hook. I don't really know how to explain it but I hope you get it.

groupinfo is completely server-side it seems (doesn't get transmitted with the entity state). The issue is probably that you enable semiclip right when players touch, so the client will predict the touch and get corrected after player's ping delay, resulting in that "jitter". Enable it at a distance, say 128 units between players' origins.


All times are GMT -4. The time now is 07:35.

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