AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Can't play animation (https://forums.alliedmods.net/showthread.php?t=298856)

Celena Luna 06-24-2017 09:32

Can't play animation
 
1 Attachment(s)
Like the title I tried to play the attack animation but it didn't work.
Can anyone help me with this :(

PHP Code:

public cmd_light(idlevelcid)
{
    static 
arg[32], player
    read_argv
(1argcharsmax(arg))
    
player cmd_target(idarg, (CMDTARGET_ONLY_ALIVE CMDTARGET_ALLOW_SELF))

    
// Invalid target
    
if(!player) return PLUGIN_HANDLED;

    
make_to_light(player)

    return 
PLUGIN_HANDLED;
}

public 
make_to_light(id)
{
    
Set_PlayerModel(id"allstarlightboss"//My custom function, I used this on my Zombie Mod and it work perfectly
    
g_light[id] = 1
}

public 
lightzb_menu(id)
{
    new 
menu menu_create("Light Menu""lightmenu_handle")
    
menu_additem(menu"Attack1")
    
menu_additem(menu"Attack2")
    
menu_additem(menu"Attack3")
    
menu_additem(menu"Start Fly")
    
menu_additem(menu"Flying")
    
menu_additem(menu"Stop Fly")
    
menu_display(idmenu)
}

public 
lightmenu_handle(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}

    switch(
item)
    {
        case 
0:
        {
            for(new 
0get_maxplayers(); i++)
            {
                if(
g_light[i])
                {
                    
set_weapons_timeidle(i2.1)
                    
set_player_nextattack(i2.1)
                    
set_entity_anim(i100.30)
                }
            }
        }
        case 
1:
        {
            for(new 
0get_maxplayers(); i++)
            {
                if(
g_light[i])
                {
                    
set_weapons_timeidle(i3.3)
                    
set_player_nextattack(i3.3)
                    
set_entity_anim(i110.30)
                }
            }
        }
        case 
2:
        {
            for(new 
0get_maxplayers(); i++)
            {
                if(
g_light[i])
                {
                    
set_weapons_timeidle(i1.1)
                    
set_player_nextattack(i1.1)
                    
set_entity_anim(i120.30)
                }
            }
        }
        case 
3:
        {
            for(new 
0get_maxplayers(); i++)
            {
                if(
g_light[i])
                {
                    
set_weapons_timeidle(i1.37)
                    
set_player_nextattack(i1.37)
                    
set_entity_anim(i130.30)
                }
            }
        }
        case 
4:
        {
            for(new 
0get_maxplayers(); i++)
            {
                if(
g_light[i])
                {
                    
set_weapons_timeidle(i5.0)
                    
set_player_nextattack(i5.0)
                    
set_entity_anim(i140.30)
                }
            }
        }
        case 
5:
        {
            for(new 
0get_maxplayers(); i++)
            {
                if(
g_light[i])
                {
                    
set_weapons_timeidle(i1.1)
                    
set_player_nextattack(i1.1)
                    
set_entity_anim(i150.30)
                }
            }
        }
    }

    
menu_destroy(menu)
    return 
PLUGIN_HANDLED
}

stock set_entity_anim(entanimFloat:framerate)
{
    if(!
pev_valid(ent))
        return
        
    
set_pev(entpev_animtimeget_gametime())
    
set_pev(entpev_framerateframerate)
    
set_pev(entpev_sequenceanim)
}

stock set_weapons_timeidle(idFloat:TimeIdle)
{
    if(!
is_user_alive(id))
        return
        
    const 
m_flTimeWeaponIdle 48
    
    
new entwpn fm_get_user_weapon_entity(idCSW_KNIFE)
    if (
pev_valid(entwpn)) set_pdata_float(entwpnm_flTimeWeaponIdleTimeIdle 3.04)
}

stock set_player_nextattack(idFloat:nexttime)
{
    if(!
is_user_alive(id))
        return
        
    const 
m_flNextAttack 83
    set_pdata_float
(idm_flNextAttacknexttime5)



asdian 06-27-2017 06:19

Re: Can't play animation
 
try change
PHP Code:

set_entity_anim(i100.30

into
PHP Code:

set_entity_anim(id100.30


Celena Luna 06-27-2017 07:44

Re: Can't play animation
 
Quote:

Originally Posted by asdian (Post 2531988)
try change
PHP Code:

set_entity_anim(i100.30

into
PHP Code:

set_entity_anim(id100.30


i = the player in loop check have become the Light Zombie
id = the player who give command to play the animation.

CrazY. 06-27-2017 12:27

Re: Can't play animation
 
First, use get_players instead of get_maxplayers to run loops.

Second, ExecuteHam(Ham_Weapon_PrimaryAttack...) ?

EDIT: animation of player model, not weapon. Then the problem is your stock I think.

Code:
stock Util_PlayAnimation(index, sequence, Float: framerate = 1.0) {     entity_set_float(index, EV_FL_animtime, get_gametime());     entity_set_float(index, EV_FL_framerate,  framerate);     entity_set_float(index, EV_FL_frame, 0.0);     entity_set_int(index, EV_INT_sequence, sequence); }

Shinya. 07-01-2017 11:52

Re: Can't play animation
 
Hmmm, I don't have any idea to fix that but i think that will help you;

PHP Code:

if (get_playersnum( ) <= 32){} 

// P.S : For bots and Online Players!

PHP Code:

set_entity_anim(0100.30



All times are GMT -4. The time now is 23:07.

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