AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Custom player animations per weapons (https://forums.alliedmods.net/showthread.php?t=331966)

nG_getwreck 04-16-2021 04:48

Custom player animations per weapons
 
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);




All times are GMT -4. The time now is 19:32.

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