FIX: Reloading animation bug while holding weapon with altered Maxclip#861
FIX: Reloading animation bug while holding weapon with altered Maxclip#861s1lentq merged 5 commits intorehlds:masterfrom
FIX: Reloading animation bug while holding weapon with altered Maxclip#861Conversation
|
Just for documentation, same fix from a metamod plugin: https://goldsrc.ru/threads/4165/ Also we have a video: https://www.youtube.com/watch?v=k_jGf7mLYBo |
This comment was marked as off-topic.
This comment was marked as off-topic.
Excuse me? I don't even know that forum 😆 I discovered this in a +10 year old plugin that describes this bug behaviour, which I was using in my weapon addons: https://forums.alliedmods.net/showthread.php?t=82093 if( iButton & IN_RELOAD && !fInReload )
{
if( iClip >= iMaxClip )
{
set_pev(id, pev_button, iButton & ~IN_RELOAD)
if( SILENT_BS & (1<<iId) && !get_pdata_int(iEnt, m_fSilent, XTRA_OFS_WEAPON) )
{
SendWeaponAnim( id, iId == CSW_USP ? 8 : 7 )
}
else
{
SendWeaponAnim(id, 0)
}
}The only way to fake client weapon data is by GetWeaponData function, which is way better than resetting weaponanim. Sorry for not reading the entire internet to avoid a kid's cry. I suggest you to be polite, this isn't a forum, nor a plugin submission system. |
…lip (rehlds#861) * Add functions for default weaponinfo array * Whitespace cleaning and pointer safety check * Added reload condition to enhance conditions
Sort of an old bug. If client prediction is activated (
cl_lw 1), player is holding a weapon whose maxclip was altered (easily nowadays withrg_set_iteminfonatives), active weapon's clip is equal to altered maxclip, and then presses the reload button, it will reproduce a client-side reload animation which stops until player releases the button, because client thinks you met the conditions to reload the weapon considering its clip differs from its maxclip.This fixes that weapon animation by faking the weapon's current clip in case the weapon has a different maxclip from its original, and is actually holding the gun with
clip == newmaxclip.You can see the conditions in the files changed.
I might say it needs tests 👍