蓝染_惣右介 发表于 2012-4-7 20:43:44

找个人帮忙改下自动回血源码。

谁帮我改下这个【自动回血】源码
帮我把他改成OP才可以自动回血
谢谢 了#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
    }
}

673734294 发表于 2012-4-8 13:58:33

不会等好心人把

蓝染_惣右介 发表于 2012-4-8 14:26:42

673734294 发表于 2012-4-8 13:58 static/image/common/back.gif
不会等好心人把

sXe,我是黑翼恶魔= = 昨天我就知道你不会了,我无语:)

蓝染_惣右介 发表于 2012-4-8 14:27:42

{:soso__9424465344577227664_1:}
好心人啊,快出来吧,不然发个OP自动回血的插件也可以啊。

726691010 发表于 2012-4-8 23:17:57

01. #include <amxmodx>
02. #include <fun>
03. #define PLUGIN    "Test"
04. #define AUTHOR    "Jim"
05. #define VERSION    "1.0"
06. new pchp
07. new pcmaxhp
08. new pct
09. new task
10. public plugin_init()
11. {
12. register_plugin(PLUGIN, VERSION, AUTHOR)
13. pchp = register_cvar("recover_hp","1")
14. pcmaxhp = register_cvar("recover_maxhp","100")
15. pct = register_cvar("recover_interval","1")
16. register_event("Damage","event_damage", "be")
17. register_event("DeathMsg","event_death", "a")
18. }
19. public client_disconnect(id)
20. {
21. remove_task(id)
22. task = 0
23. }
24. public event_death()
25. {
26. new id = read_data(2)
27. remove_task(id)
28. task = 0
29. }
30. public event_damage(id)
31. {
32. if(!task)
33. {
34. task = set_task(float(get_pcvar_num(pct)), "addhp", id, _, _, "b")
35. }
36. }
37. public addhp(id)
38. {
39. if(get_user_flags(id) & ADMIN_IMMUNITY)
40. {
41. new maxhp = get_pcvar_num(pcmaxhp)
42. new hp = get_user_health(id)   get_pcvar_num(pchp)
43. if(hp < maxhp)
44. {
45. set_user_health(id, hp)
46. }
47. else
48. {
49. set_user_health(id, maxhp)
50. remove_task(id)
51. task = 0
52. }
53. }
貌似好像是这样!但我估计可能不行!我只知道加个OP权限,但我不知该如何去加判断,也不大清楚具体加在哪个位置!不好意思只因俺也是新手!你先试试看吧!不行在帮你搞搞!因为我这没得电脑上网!要么就等好人出现吧

By小伟 发表于 2012-4-9 01:26:23

#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 && get_user_flags(id) & ADMIN_IMMUNITY)
    {
      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
    }
}


自己试.自己试.自己试.自己试.自己试.自己试.自己试.

chungsy 发表于 2012-4-9 10:18:26

我有源码 大家互相帮助








#include <amxmodx>
#include <fun>
#include <cstrike>
#define PLUGIN_NAME   "Set Vip HP"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR   "lovehuai"
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
set_task(1.0,"run_check",422,"",0,"b")
}
public run_check(){
if (get_cvar_num("gg_replinishhealth")==0) return PLUGIN_CONTINUE
new players
new i, numofplayers, id
get_players(players, numofplayers)
for (i=0; i<numofplayers; i++){
id=players
if (!is_user_alive(id)) continue
SetHp(id)
}
return PLUGIN_CONTINUE
}
public SetHp(id)
{
if(get_user_flags(id) & ADMIN_LEVEL_C)
{
   new armor= (get_user_armor(id)) +5
   new health = (get_user_health (id)) +5
   if ( armor > 100) {
         cs_set_user_armor(id, 100, CS_ARMOR_VESTHELM)
   }
   else {
         cs_set_user_armor(id, armor, CS_ARMOR_VESTHELM)
   }
   if ( health > 100) {
         set_user_health (id,100)
   }
   else {
         set_user_health (id,health)
   }
}   
}

蓝染_惣右介 发表于 2012-4-22 18:08:09

chungsy 发表于 2012-4-9 10:18 static/image/common/back.gif
我有源码 大家互相帮助




这个是OP自动回血的?{:3_46:}

蓝染_惣右介 发表于 2012-4-22 18:33:24

By小伟 发表于 2012-4-9 01:26 static/image/common/back.gif
#include
#include
#define PLUGIN    "Test"


可以帮我改成每秒回5hp不{:3_46:}

coolhurter 发表于 2012-4-27 03:31:27

#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", "5")//每秒恢复的HP值
    pcmaxhp = register_cvar("recover_maxhp", "100")//恢复HP上限
    pct = register_cvar("recover_interval", "1")//每隔多少秒恢复HP
    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 && get_user_flags(id) & ADMIN_IMMUNITY)
    {
      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] 2
查看完整版本: 找个人帮忙改下自动回血源码。