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

Custom player animations per weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nG_getwreck
Senior Member
Join Date: Oct 2020
Location: Philippines from South K
Old 04-16-2021 , 04:48   Custom player animations per weapons
Reply With Quote #1

Hello, is it possible to have different player animations per different knife, weapons, and etc...
I ask this because I have different csnz knives and I want to use the player anims from CSNZ.

Sample codes:

Test1 Knife
PHP Code:
#define PLAYER_ANIM "test1"

public plugin_init()
{
    
register_event(FM_CmdStart"fw_CmdStart")
}

public 
fw_CmdStart(iduc_handleseed)
{
    if(!
is_user_alive(id)) return FMRES_IGNORED

    
new button get_uc(uc_handleUC_Buttons)

    if(
button IN_ATTACK)
    {
        new 
szAnim[64]

        
formatex(szAnimcharsmax(szAnim), pev(idpev_flags) & FL_DUCKING "crouch_shoot_%s" "ref_shoot_%s"PLAYER_ANIM)
        
UTIL_PlayerAnimation(idszAnim)
    }
}

stock UTIL_PlayerAnimation(idszAnimation[]) 
{
    static 
iAnimDesiredFloat:fFrameRateFloat:fGroundSpeedbool:bLoops;
    if((
iAnimDesired lookup_sequence(idszAnimationfFrameRatebLoopsfGroundSpeed)) == -1iAnimDesired 0;
    static 
Float:fGameTime;
    
fGameTime get_gametime();
    
set_pev(idpev_frame0.0);
    
set_pev(idpev_framerate1.0);
    
set_pev(idpev_animtimefGameTime);
    
set_pev(idpev_sequenceiAnimDesired);
    
set_pdata_int(id40bLoops4);
    
set_pdata_int(id3904);
    
set_pdata_float(id36fFrameRate4);
    
set_pdata_float(id37fGroundSpeed4);
    
set_pdata_float(id38fGameTime4);
    
set_pdata_int(id7328);
    
set_pdata_int(id7428);   
    
set_pdata_float(id220fGameTime);

Test2 Knife
PHP Code:
#define PLAYER_ANIM "test2"

public plugin_init()
{
    
register_event(FM_CmdStart"fw_CmdStart")
}

public 
fw_CmdStart(iduc_handleseed)
{
    if(!
is_user_alive(id)) return FMRES_IGNORED

    
new button get_uc(uc_handleUC_Buttons)

    if(
button IN_ATTACK)
    {
        new 
szAnim[64]

        
formatex(szAnimcharsmax(szAnim), pev(idpev_flags) & FL_DUCKING "crouch_shoot_%s" "ref_shoot_%s"PLAYER_ANIM)
        
UTIL_PlayerAnimation(idszAnim)
    }
}

stock UTIL_PlayerAnimation(idszAnimation[]) 
{
    static 
iAnimDesiredFloat:fFrameRateFloat:fGroundSpeedbool:bLoops;
    if((
iAnimDesired lookup_sequence(idszAnimationfFrameRatebLoopsfGroundSpeed)) == -1iAnimDesired 0;
    static 
Float:fGameTime;
    
fGameTime get_gametime();
    
set_pev(idpev_frame0.0);
    
set_pev(idpev_framerate1.0);
    
set_pev(idpev_animtimefGameTime);
    
set_pev(idpev_sequenceiAnimDesired);
    
set_pdata_int(id40bLoops4);
    
set_pdata_int(id3904);
    
set_pdata_float(id36fFrameRate4);
    
set_pdata_float(id37fGroundSpeed4);
    
set_pdata_float(id38fGameTime4);
    
set_pdata_int(id7328);
    
set_pdata_int(id7428);   
    
set_pdata_float(id220fGameTime);

__________________
nG_getwreck 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 05:36.


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