求受伤后自动缓慢回血的插件
受伤后每X秒回Y滴血,回到满为止回复: 求受伤后自动缓慢回血的插件
#include <amxmodx>
#include <fun>
#define PLUGIN "Test"
#define AUTHOR "Jim"
#define VERSION "1.0"
new pchp
new pcmaxhp
new pct
new task
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
pchp = register_cvar("recover_hp", "1")
pcmaxhp = register_cvar("recover_maxhp", "100")
pct = register_cvar("recover_interval", "1")
register_event("Damage", "event_damage", "be")
register_event("DeathMsg", "event_death", "a")
}
public client_disconnect(id)
{
remove_task(id)
task = 0
}
public event_death()
{
new id = read_data(2)
remove_task(id)
task = 0
}
public event_damage(id)
{
if(!task)
{
task = set_task(float(get_pcvar_num(pct)), "addhp", id, _, _, "b")
}
}
public addhp(id)
{
new maxhp = get_pcvar_num(pcmaxhp)
new hp = get_user_health(id) + get_pcvar_num(pchp)
if(hp < maxhp)
{
set_user_health(id, hp)
}
else
{
set_user_health(id, maxhp)
remove_task(id)
task = 0
}
}
回复: 求受伤后自动缓慢回血的插件
这插件我以前完过..记得点通有这插件的回复: 求受伤后自动缓慢回血的插件
你給的這個 他只回1滴血而已並不會回到HP 100耶
回复: 求受伤后自动缓慢回血的插件
不好意思,太久没写amxx代码了,都忘了set_task怎么用了,谢谢你的测试与提醒,程序已改正回复: 求受伤后自动缓慢回血的插件
等等去測試那你看這個你寫得出來嗎? 拜託了
http://www.dt-club.net/forum/showthread.php?t=41998
回复: 求受伤后自动缓慢回血的插件
以確認測試可以了有回到HP 100了
页:
[1]