Raised This Month: $ Target: $400
 0% 

Can't play animation


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 06-24-2017 , 09:32   Can't play animation
Reply With Quote #1

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)

Attached Files
File Type: zip lightzb.zip (1.01 MB, 56 views)

Last edited by Celena Luna; 06-24-2017 at 09:32.
Celena Luna is offline
asdian
Member
Join Date: Sep 2016
Location: Indonesia
Old 06-27-2017 , 06:19   Re: Can't play animation
Reply With Quote #2

try change
PHP Code:
set_entity_anim(i100.30
into
PHP Code:
set_entity_anim(id100.30
asdian is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 06-27-2017 , 07:44   Re: Can't play animation
Reply With Quote #3

Quote:
Originally Posted by asdian View Post
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.
Celena Luna is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-27-2017 , 12:27   Re: Can't play animation
Reply With Quote #4

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); }
__________________









Last edited by CrazY.; 06-27-2017 at 12:34.
CrazY. is offline
Shinya.
Member
Join Date: Jun 2017
Location: Morocco
Old 07-01-2017 , 11:52   Re: Can't play animation
Reply With Quote #5

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

Last edited by Shinya.; 07-01-2017 at 12:06.
Shinya. 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 23:07.


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