#include <amxmodx>
#include <fakemeta>
//全局声明
new g_SeqStart[33], g_SeqNum[33], Float:g_SeqFrame[33], Float:g_SeqLife[33], Float:g_SeqCheckTime[33]
public plugin_init()
{
//自定义玩家动作在这里执行
register_forward(FM_AddToFullPack,"fw_AddToFullPack")
}
//自定义玩家动作在这里执行,看不懂不要改
public fw_AddToFullPack(es_handle, e, id, host, hostflags, player, pSet)
{
if (!is_user_connected(id)) return FMRES_IGNORED
new mode=g_SeqStart[id]
if (!mode) return FMRES_IGNORED
if (!is_user_alive(id))
{
g_SeqStart[id]=0
return FMRES_IGNORED
}
set_pdata_int(id, 73, 28, 5)
if (mode!=1) set_pev(id, pev_gaitsequence, g_SeqNum[id])
if (mode!=2) set_pev(id, pev_sequence, g_SeqNum[id])
if (g_SeqFrame[id]>=255.0)
{
g_SeqStart[id]=0
g_SeqFrame[id]=0.0
}
new Float:animtime, Float:last_check=g_SeqCheckTime[id]
pev(id, pev_animtime, animtime)
g_SeqCheckTime[id]=animtime
g_SeqFrame[id]+=(255.0/g_SeqLife[id]*(animtime-last_check))
set_pev(id, pev_frame, g_SeqFrame[id])
return FMRES_HANDLED
}
//自定义玩家播放动作
//id,玩家实体索引
//anim,播放的动作
//life,整个动作在life秒内播放完(如果想要正常速度播放,秒数=帧Frame/播放速率FPS,具体打开HLMV动作项目有写)
//gait,0上半身动作,1下半身动作,2全身动作
stock stock_set_playeranim(id, anim, Float:life, gait)
{
g_SeqStart[id]=1+gait
g_SeqNum[id]=anim
g_SeqFrame[id]=0.0
g_SeqLife[id]=life
pev(id, pev_animtime, g_SeqCheckTime[id])
if (gait==1) set_pev(id, pev_gaitsequence, 0)
set_pev(id, pev_sequence, 0)
set_pev(id, pev_frame, 0.0)
set_pev(id, pev_animtime, get_gametime())
}
#include <fakemeta>
//全局声明
new g_SeqStart[33], g_SeqNum[33], Float:g_SeqFrame[33], Float:g_SeqLife[33], Float:g_SeqCheckTime[33]
public plugin_init()
{
//自定义玩家动作在这里执行
register_forward(FM_AddToFullPack,"fw_AddToFullPack")
}
//自定义玩家动作在这里执行,看不懂不要改
public fw_AddToFullPack(es_handle, e, id, host, hostflags, player, pSet)
{
if (!is_user_connected(id)) return FMRES_IGNORED
new mode=g_SeqStart[id]
if (!mode) return FMRES_IGNORED
if (!is_user_alive(id))
{
g_SeqStart[id]=0
return FMRES_IGNORED
}
set_pdata_int(id, 73, 28, 5)
if (mode!=1) set_pev(id, pev_gaitsequence, g_SeqNum[id])
if (mode!=2) set_pev(id, pev_sequence, g_SeqNum[id])
if (g_SeqFrame[id]>=255.0)
{
g_SeqStart[id]=0
g_SeqFrame[id]=0.0
}
new Float:animtime, Float:last_check=g_SeqCheckTime[id]
pev(id, pev_animtime, animtime)
g_SeqCheckTime[id]=animtime
g_SeqFrame[id]+=(255.0/g_SeqLife[id]*(animtime-last_check))
set_pev(id, pev_frame, g_SeqFrame[id])
return FMRES_HANDLED
}
//自定义玩家播放动作
//id,玩家实体索引
//anim,播放的动作
//life,整个动作在life秒内播放完(如果想要正常速度播放,秒数=帧Frame/播放速率FPS,具体打开HLMV动作项目有写)
//gait,0上半身动作,1下半身动作,2全身动作
stock stock_set_playeranim(id, anim, Float:life, gait)
{
g_SeqStart[id]=1+gait
g_SeqNum[id]=anim
g_SeqFrame[id]=0.0
g_SeqLife[id]=life
pev(id, pev_animtime, g_SeqCheckTime[id])
if (gait==1) set_pev(id, pev_gaitsequence, 0)
set_pev(id, pev_sequence, 0)
set_pev(id, pev_frame, 0.0)
set_pev(id, pev_animtime, get_gametime())
}