Raised This Month: $51 Target: $400
 12% 

Changing Sub-Model of v_ model


Post New Thread Reply   
 
Thread Tools Display Modes
hekaUA
Junior Member
Join Date: Mar 2014
Old 11-09-2014 , 11:22   Re: Changing Sub-Model of v_ model
Reply With Quote #21

Quote:
Originally Posted by meTaLiCroSS View Post
Problem is that client predicts animations. That's handled by the cl_lw cvar, and it was made for saving bandwidth. Server will know about cl_lw value of every client. And mod gets that value with CanSkipPlayer function.

SendWeaponAnim function it's the one who """sends""" animations to client. But they are never sent. Source code from CS:

PHP Code:
void CBasePlayerWeapon::SendWeaponAnim(int animationint skiplocal)
{
  
m_pPlayer->pev->weaponanim animation;
  if ( !
skiplocal || !ENGINE_CANSKIPm_pPlayer->edict() ) )
  {
    
MESSAGE_BEGINMSG_ONESVC_WEAPONANIMNULLm_pPlayer->pev );
    
WRITE_BYTEiAnim );                        // sequence number
    
WRITE_BYTEpev->body );                    // weaponmodel bodygroup.
    
MESSAGE_END();
  }

On CS, SendWeaponAnim is present on every specific event that animation should be sent (idle, reload, grenade/c4 specific, etc). But SVC_WEAPONANIM msg is never send because skiplocal param is always true and ENGINE_CANSKIP will return 1 if client has cl_lw cvar enabled. So, guessing, this would be never called.

If you want to force animation send to client, just hook FM_CanSkipPlayer, make it return false, and recode weapon fire animation because CS didn't implement that thing on PrimaryAttack functions. (hook PlaybackEvent as a method described on a tutorial, forget which one)

By following this logic, you'll just need to edit weapon entity's pev_body value to the correct handgroup you want to show to player.

Also, I haven't tested this because I don't know if client predicts first and gets a response then, because in that case animations will screw up and this will go hell
public UTIL_SendWeaponAnim(iPlayer, iAnim)
{
set_pev(iPlayer, pev_weaponanim, iAnim)
message_begin(MSG_ONE, SVC_WEAPONANIM, _, iPlayer)
write_byte(iAnim)
if(engfunc(EngFunc_CanSkipPlayer(iPlayer)) write_byte(1)
message_end()
}
Attached Images
File Type: jpg 51241.jpg (83.0 KB, 328 views)
hekaUA is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 11-09-2014 , 13:19   Re: Changing Sub-Model of v_ model
Reply With Quote #22

Quote:
Originally Posted by hekaUA View Post
public UTIL_SendWeaponAnim(iPlayer, iAnim)
{
set_pev(iPlayer, pev_weaponanim, iAnim)
message_begin(MSG_ONE, SVC_WEAPONANIM, _, iPlayer)
write_byte(iAnim)
if(engfunc(EngFunc_CanSkipPlayer(iPlayer)) write_byte(1)
message_end()
}
What the f*ck are you doing ahah
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
hekaUA
Junior Member
Join Date: Mar 2014
Old 11-10-2014 , 08:47   Re: Changing Sub-Model of v_ model
Reply With Quote #23

Quote:
Originally Posted by meTaLiCroSS View Post
What the f*ck are you doing ahah
Please explain how to use it.
hekaUA is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 11-10-2014 , 10:03   Re: Changing Sub-Model of v_ model
Reply With Quote #24

Quote:
Originally Posted by hekaUA View Post
Please explain how to use it.
And what do you think I did? It's not my fault that you don't understand english
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 11-11-2014 , 18:35   Re: Changing Sub-Model of v_ model
Reply With Quote #25

I don't think it's possible without looking wanky. I tried to do something similar for HE grenades in the past, the problem is that apparently when the client's animation changes, the information is sent to the server too late, 1 frame difference. So if you want to replace the submodel via animations, there will always be 1 frame flicker back to the original model, which looks stupid to say the least (can't imagine what it'd look like if you were actually shooting the weapon...)
__________________
Currently busy working on a very large scale anime database project.

Last edited by Backstabnoob; 11-11-2014 at 18:36.
Backstabnoob is offline
Reply



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 18:42.


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