Raised This Month: $209 Target: $400
 52% 

Reload Animation Fix


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Technical/Development        Approver:   ConnorMcLeod (74)
MPNumB
Veteran Member
Join Date: Feb 2007
Location: Lithuania
Old 12-27-2011 , 08:00   Reload Animation Fix
Reply With Quote #1

Description:
This plugin fixes a glitch when your weapon reload animation isn't shown, even though you are currently reloading your weapon. Also this plugin fixes shotgun reload resume glitch, when you are deploying m3 or xm1014. And when shotgun is deployed while having 0 bullets, reload animation is always accurate. Last, but not least, when spectating a person who has deagle, you don't get deploy or reload animation when you shouldn't.

Requires:
FakeMeta
HamSandWich


Additional info:
Tested in Counter-Strike 1.6 with amxmodx 1.8.2 (dev build hg21). If you want to execute and test this bug, buy an automatic weapon (mp5, ak47, m4a1..), with 2 backup clips, fire one clip until you hit reload, then once reload is done, start firing second clip, until you reach 0 ammunition and start reload again - that's when animation glitch happens. There are more scenarios when this bug happens, however this plugin should fix all of them.


Warnings:
Animations are client-side, therefor there may be firing animation issue just when reload ended for people who are playing with high ping and are holding attack button at that moment.


Credits:
Thanks to FOUTA for requesting this bug-fix.


Change-Log:

* 1.1
- Fixed: When deploying shotguns they don't resume previous reload.
- Fixed: When switching to shotgun with 0 bullets, reload animation is always accurate.
- Fixed: Shotguns lost their reload-stop animations.
- Removed: No need to fix main glitch for shotguns - they don't have this bug anyway.

* 1.0
- First release.
Attached Files
File Type: sma Get Plugin or Get Source (reload_animation_fix.sma - 4879 views - 8.9 KB)
__________________
Skill and no annoying bugs with fixed balance issues is my goal!
My approved plugins what don't show up in Approved List:
* Bomb/Death/CSS Radar
* HotVision
___
Need help? Please check this documentation first.

Last edited by MPNumB; 12-28-2011 at 07:52.
MPNumB is offline
Send a message via Skype™ to MPNumB
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 12-27-2011 , 08:23   Re: Reload Animation Fix
Reply With Quote #2

Code:
    RegisterHam(Ham_Item_PostFrame, "weapon_glock18",      "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_usp",          "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_deagle",       "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_p228",         "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_elite",        "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_fiveseven",    "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_m3",           "Ham_Item_PostFrame_sgs_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_xm1014",       "Ham_Item_PostFrame_sgs_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_mp5navy",      "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_mac10",        "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_tmp",          "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_p90",          "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_ump45",        "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_galil",        "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_famas",        "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_ak47",         "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_m4a1",         "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_sg552",        "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_aug",          "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_g3sg1",        "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_sg550",        "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_scout",        "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_awp",          "Ham_Item_PostFrame_Pre", 0);     RegisterHam(Ham_Item_PostFrame, "weapon_m249",         "Ham_Item_PostFrame_Pre", 0);

->

Code:
new bitAllowWeapons = (1<<CSW_FLASHBANG)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_KNIFE)|(1<<CSW_HEGRENADE) new szWeaponsName[ 20 ] for( new i = CSW_P228 ; i <= CSW_P90 ; i++ ) {     if( ~bitAllowWeapons & 1<<i && get_weaponname( i , szWeaponName , charsmax( szWeaponName ) ) )     {         RegisterHam( Ham_Item_PostFrame , szWeaponsName , "Ham_Item_PostFrame_Pre" , false )     } }
__________________
You can do anything you set your mind to, man.

Devil259 is offline
MPNumB
Veteran Member
Join Date: Feb 2007
Location: Lithuania
Old 12-27-2011 , 09:29   Re: Reload Animation Fix
Reply With Quote #3

My method requires less CPU usage, while still remaining readable.
__________________
Skill and no annoying bugs with fixed balance issues is my goal!
My approved plugins what don't show up in Approved List:
* Bomb/Death/CSS Radar
* HotVision
___
Need help? Please check this documentation first.
MPNumB is offline
Send a message via Skype™ to MPNumB
Gam3ronE
SourceMod Donor
Join Date: Aug 2010
Old 12-27-2011 , 09:54   Re: Reload Animation Fix
Reply With Quote #4

Thank you for sharing MPNumB and very good job.

You were given some credit on the website too: http://gamerone.net/showthread.php?tid=792

I have noticed this bug a lot and it is good to see a fix congratulations.

Last edited by Gam3ronE; 12-27-2011 at 10:15.
Gam3ronE is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 12-27-2011 , 13:00   Re: Reload Animation Fix
Reply With Quote #5

Quote:
Originally Posted by MPNumB View Post
My method requires less CPU usage, while still remaining readable.
Are you sure ?
__________________
You can do anything you set your mind to, man.

Devil259 is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 12-27-2011 , 13:20   Re: Reload Animation Fix
Reply With Quote #6

Quote:
Originally Posted by Devil259 View Post
Are you sure ?
MPNumb's way uses slightly less CPU because of the non-existent for-loop in his code. He also doesn't have any get_weaponname natives which would use some CPU.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-28-2011 , 02:34   Re: Reload Animation Fix
Reply With Quote #7

Generally a bad idea to cache alive players status because switch plugins easily mess up your plugin.
Also, if you keep it, you can directly pass g_iAlive in the macro since it is the only variable you use.
__________________
- tired and retired -

Last edited by ConnorMcLeod; 12-28-2011 at 02:35.
ConnorMcLeod is offline
MPNumB
Veteran Member
Join Date: Feb 2007
Location: Lithuania
Old 12-28-2011 , 07:55   Re: Reload Animation Fix
Reply With Quote #8

Quote:
Originally Posted by ConnorMcLeod View Post
Generally a bad idea to cache alive players status because switch plugins easily mess up your plugin.
Also, if you keep it, you can directly pass g_iAlive in the macro since it is the only variable you use.
Switch plugins? You mean g_iAlive thing and pause/unpause? I know that, that's why I refresh all that info in public plugin_unpause(). Macro? What you mean by that?

---

Updated to 1.1
Fixed: When deploying shotguns they don't resume previous reload.
Fixed: When switching to shotgun with 0 bullets, reload animation is always accurate.
Fixed: Shotguns lost their reload-stop animations.
Removed: No need to fix main glitch for shotguns - they don't have this bug anyway.
__________________
Skill and no annoying bugs with fixed balance issues is my goal!
My approved plugins what don't show up in Approved List:
* Bomb/Death/CSS Radar
* HotVision
___
Need help? Please check this documentation first.
MPNumB is offline
Send a message via Skype™ to MPNumB
FOUTA
Senior Member
Join Date: Nov 2010
Location: Lebanon
Old 12-28-2011 , 08:48   Re: Reload Animation Fix
Reply With Quote #9

awesome work mpnumb
thanks for taking some time and make this plugin...
__________________
www.cstuts.tk
Everything you might for Counter Strike
FOUTA is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-28-2011 , 13:39   Re: Reload Animation Fix
Reply With Quote #10

For example a plugin that would switch a player from Ts to Spectator, your plugin could think he is still alive.


Just saying that
PHP Code:
new g_iAlive;
#define SetPlayerBit(%1,%2)    ( %1 |=  ( 1 << ( %2 & 31 ) ) )
#define ClearPlayerBit(%1,%2)  ( %1 &= ~( 1 << ( %2 & 31 ) ) )
#define CheckPlayerBit(%1,%2)  ( %1 &   ( 1 << ( %2 & 31 ) ) ) 
Would be better like :
PHP Code:
new g_iAlive;
#define MarkPlayerAlive(%0)    ( g_iAlive |=  ( 1 << ( %0 & 31 ) ) )
#define ClearPlayerAlive(%0)  ( g_iAlive &= ~( 1 << ( %0 & 31 ) ) )
#define CheckPlayerAlive(%0)  ( g_iAlive &   ( 1 << ( %0 & 31 ) ) ) 
__________________
- tired and retired -
ConnorMcLeod is offline
Reply


Thread Tools
Display Modes

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 12:07.


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