AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How can i change the shot animation (https://forums.alliedmods.net/showthread.php?t=215686)

andyt0621 05-11-2013 04:32

How can i change the shot animation
 
i tried to use SeadWeaponAnim in TraceAttack_Post,PrimaryAttack_Post,CurWeapon ..
but all cant work properly..
even if i see the new anim..
i will see the original shot anim flashed/appeared before the new anim

or can someone teach me how to make a fake shot hole with smoke..
i can use CD_flNextAttack to block shot anim but i dont know how to make a bullet hole that is same to a real shot hole

sorry to my poor english

bibu 05-11-2013 06:47

Re: How can i change the shot animation
 
Could you upload the model?

Bos93 05-11-2013 08:46

Re: How can i change the shot animation
 
- ClientUpdatePost
- Check your animation and set new animation with CD_WeaponAnim

andyt0621 05-11-2013 09:45

Re: How can i change the shot animation
 
Quote:

Originally Posted by bibu (Post 1949811)
Could you upload the model?

i think it is not related to the model animation order

Quote:

Originally Posted by Bos93 (Post 1949872)
- ClientUpdatePost
- Check your animation and set new animation with CD_WeaponAnim

i see this: http://forums.alliedmods.net/showthread.php?t=88823 and try the following code
Code:

register_forward(FM_UpdateClientData , "UpdateClientData");

public UpdateClientData( id, iSendWeapons, cd_handle )
{
    new anim = get_cd( cd_handle , CD_WeaponAnim );
    if(3<= anim <= 5 ) // shot animation number
    {
        set_cd( cd_handle , CD_WeaponAnim , 3);
        return FMRES_OVERRIDE;
    }
    return FMRES_IGNORED;
}

it is not working because CD_WeaponAnim/pev_weaponanim cant return shot anim(3-5) but it can return idle,reload,draw
and then i tried this
Code:

register_forward(FM_UpdateClientData , "UpdateClientData");

public UpdateClientData( id, iSendWeapons, cd_handle )
{
    if(g_attack[id]) // return 1 when Ham_Weapon_PrimaryAttack and be 0 in Post
    {
        set_cd( cd_handle , CD_WeaponAnim , 3);
        return FMRES_OVERRIDE;
    }
    return FMRES_IGNORED;
}

it also not working
i think CD_WeaponAnim is a useless thing

Bos93 05-11-2013 10:49

Re: How can i change the shot animation
 
PHP Code:

#include < amxmodx >
#include < fakemeta >

public plugin_init( )
{
    
register_forwardFM_UpdateClientData"UpdateClientData__Post", ._post true );
}

public 
UpdateClientData__PostpPlayerSendWeaponsCD_Handle )
{
    static 
iAnimiAnim get_cdCD_Handle CD_WeaponAnim );
    
    switch( 
iAnim 
    {
        case 
345set_cdCD_Handle CD_WeaponAnim );
    }
    
    return 
FMRES_HANDLED;



bibu 05-11-2013 13:38

Re: How can i change the shot animation
 
Can't you hook with ham SendWeaponAnim?

Bos93 05-11-2013 13:43

Re: How can i change the shot animation
 
Yes, but I think it is better UpdateClientData

andyt0621 05-11-2013 23:34

Re: How can i change the shot animation
 
Quote:

Originally Posted by Bos93 (Post 1949949)
PHP Code:

#include < amxmodx >
#include < fakemeta >

public plugin_init( )
{
    
register_forwardFM_UpdateClientData"UpdateClientData__Post", ._post true );
}

public 
UpdateClientData__PostpPlayerSendWeaponsCD_Handle )
{
    static 
iAnimiAnim get_cdCD_Handle CD_WeaponAnim );
    
    switch( 
iAnim 
    {
        case 
345set_cdCD_Handle CD_WeaponAnim );
    }
    
    return 
FMRES_HANDLED;



iAnim cant return shot anim..
i see it by using client_print

Quote:

Originally Posted by bibu (Post 1950038)
Can't you hook with ham SendWeaponAnim?

can you give me an example please

bibu 05-12-2013 05:51

Re: How can i change the shot animation
 
Try something like the following code. I still don't get why you want to replace anim. If you're already using a custom model, then it should show the anim already correctly. Correct me if it's wrong.

PHP Code:

#include <amxmodx>
#include <hamsandwich>

#define ANIM_TO_REPLACE 1
#define REPLACE_ANIM_WITH 1337

public plugin_init()
{
    
RegisterHam(Ham_CS_Weapon_SendWeaponAnim"weapon_entity""WeaponSendWeaponAnim")
}

public 
WeaponSendWeaponAnim(idiAnim/*, skiplocal*/)
{
    
// Check the animation to replace.
    
if(iAnim == ANIM_TO_REPLACE)
    {
        
// Replace animation with the value you want.
        
SetHamParamInteger(2REPLACE_ANIM_WITH)
    }



bibu 05-12-2013 09:29

Re: How can i change the shot animation
 
What? There is seriously no problem to use SendWeaponAnim...


All times are GMT -4. The time now is 12:47.

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