Raised This Month: $ Target: $400
 0% 

Viewmodel bodygroup switch example


Post New Thread Reply   
 
Thread Tools Display Modes
Hanna
Member
Join Date: Sep 2016
Old 09-10-2016 , 15:53   Re: Viewmodel bodygroup switch example
Reply With Quote #31

Trying now hook skiplocal instead of using update client data. The bad of amxmodx 1.8.3 it's... I dunno wat to say. The new dev modified something in ham and it doesn't works correctly in new builds (SendWeaponAnim).
The 1.8.2 works perfectly, but 1.8.3 not.

void CBasePlayerWeapon::__MAKE_VHOOK(SendWeaponAni m)(int iAnim, int skiplocal)
{
m_pPlayer->pev->weaponanim = iAnim;

#ifdef 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();
}

that was in cs sdk, so i'm going now with hooking CanSkip forward and returning 0 always. There is some troubles but i think i can do it.
Hanna is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-10-2016 , 17:09   Re: Viewmodel bodygroup switch example
Reply With Quote #32

In CS, SendWeaponAnim doesn't have the same parameter as Hl (one param removed), that's why, in 1.8.3-dev you need to use Ham_CS_Weapon_SendWeaponAnim instead. That it was working in 1.8.2 is probably a bad thing.
__________________

Last edited by Arkshine; 09-10-2016 at 17:13.
Arkshine is offline
Hanna
Member
Join Date: Sep 2016
Old 09-10-2016 , 19:06   Re: Viewmodel bodygroup switch example
Reply With Quote #33

Quote:
Originally Posted by Arkshine View Post
In CS, SendWeaponAnim doesn't have the same parameter as Hl (one param removed), that's why, in 1.8.3-dev you need to use Ham_CS_Weapon_SendWeaponAnim instead. That it was working in 1.8.2 is probably a bad thing.
Maybe it is a bug in 1.8.2, yes.
Well, what i can say now.
I've compiled the mp.dll (removed the check of skiplocal and CanSkip part).

void CBasePlayerWeapon::__MAKE_VHOOK(SendWeaponAni m)(int iAnim, int skiplocal)
{
m_pPlayer->pev->weaponanim = iAnim;

MESSAGE_BEGIN(MSG_ONE, SVC_WEAPONANIM, NULL, m_pPlayer->pev);
WRITE_BYTE(iAnim); // sequence number
WRITE_BYTE(pev->body); // weaponmodel bodygroup.
MESSAGE_END();
}

The amxmod part should look like that:

RegisterHam(Ham_CS_Weapon_SendWeaponAnim, "weapon_glock18", "HamF_CS_Weapon_SendWeaponAnim", 1);
public HamF_CS_Weapon_SendWeaponAnim(iEnt, iAnim, Skiplocal)
{
Skiplocal = 0;
static id;

id = get_pdata_cbase(iEnt, m_pPlayer, 4);
client_print(id, print_chat, "%d", Skiplocal)
}

register_forward(FM_CanSkipPlayer, "Forward_CanSkipPlayer");
public Forward_CanSkipPlayer(pPlayer)
{
return 0;
}


And this is:

int PF_CanSkipPlayer( const edict_t *pClient )
{
client_t *client;
int entnum;

entnum = NUM_FOR_EDICT( pClient );
if (entnum < 1 || entnum > svs.maxclients)
{
Con_Printf ("tried to PF_CanSkipPlayer a non-client\n");
return 0;
}

client = &svs.clients[entnum-1];
return client->lw != 0;
}

So i guess playing just with send weapon anim and skiplocal will give nothing without setting client weapons to zero.

Btw, i found to make it without CD_ID like in previous examples.
Making now full plugin with native to change viewmodel body. Will take some time, just wait.
Hanna is offline
Hanna
Member
Join Date: Sep 2016
Old 09-13-2016 , 22:03   Re: Viewmodel bodygroup switch example
Reply With Quote #34

Moved here https://forums.alliedmods.net/showthread.php?t=287754
Hanna is offline
PartialCloning
Senior Member
Join Date: Dec 2015
Old 09-24-2016 , 20:10   Re: Viewmodel bodygroup switch example
Reply With Quote #35

Quote:
Originally Posted by Hanna View Post
Updated: ..... fix left-right hand auto switch
What was causing the left-right hand auto switch and how did you fix it? I'm just curious about what could cause it as I ran into that issue a while ago.
PartialCloning is offline
Hanna
Member
Join Date: Sep 2016
Old 09-28-2016 , 08:32   Re: Viewmodel bodygroup switch example
Reply With Quote #36

Quote:
Originally Posted by PartialCloning View Post
What was causing the left-right hand auto switch and how did you fix it? I'm just curious about what could cause it as I ran into that issue a while ago.
It happens only if you are stopping hooks in UpdateDataPost (if used) after player death or with checking alive players.
Or input cl_lw 1 or 0 in console (client) this does same.
Hanna 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 06:07.


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