Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] [CS 1.6] CVAR for allowing Server-Side Weapon Prediction #3097

Open
Maxi605 opened this issue Apr 15, 2021 · 1 comment
Open

Comments

@Maxi605
Copy link

Maxi605 commented Apr 15, 2021

Implement a server-side cvar to allow the server to work if a client is using Server-Side weapon prediction (cl_lw 0). Since it seems that the whole CS 1.6 Community used to (Used to since they moved to CS:GO) considered cl_lw 0 to be a "Ilegal Command".

@Maxi605 Maxi605 changed the title [Feature Request] CVAR for allowing Server-Side Weapon Prediction [Feature Request] [CS 1.6] CVAR for allowing Server-Side Weapon Prediction Apr 15, 2021
@SamVanheer
Copy link

That's already possible by using this engine function:

int (*pfnCanSkipPlayer) ( const edict_t *player );

The function returns whether the player's cl_lw setting is non-zero.

The server already uses this to determine whether a client is using client predicted weapons and skips sending weapon animation updates if so:

halflife/dlls/weapons.cpp

Lines 866 to 884 in c7240b9

void CBasePlayerWeapon::SendWeaponAnim( int iAnim, int skiplocal, int body )
{
if ( UseDecrement() )
skiplocal = 1;
else
skiplocal = 0;
m_pPlayer->pev->weaponanim = iAnim;
#if defined( CLIENT_WEAPONS )
if ( skiplocal && ENGINE_CANSKIP( m_pPlayer->edict() ) )
return;
#endif
MESSAGE_BEGIN( MSG_ONE, SVC_WEAPONANIM, NULL, m_pPlayer->pev );
WRITE_BYTE( iAnim ); // sequence number
WRITE_BYTE( pev->body ); // weaponmodel bodygroup.
MESSAGE_END();
}

ENGINE_CANSKIP is a macro that resolves to that function:

#define ENGINE_CANSKIP ( *g_engfuncs.pfnCanSkipPlayer )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants