1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40.
#include <amxmodx> #include <fun> #define REG_HP 1000 #define MAX_HP 3000 #define TIME_HP 5 public plugin_init() register_event("Health", "Health", "be"); public Health(id) { if(get_user_team(id) == 1 && is_user_alive(id)) if(!task_exists(id)) set_task(float(TIME_HP), "giveHp", id + 234); } public giveHp(id) { id -= 234; new iNowHP = get_user_health(id); if(iNowHP < MAX_HP) { if(task_exists(id + 234)) remove_task(id + 234); } for(new i = REG_HP; i > 0; i--) { if(iNowHP + i > MAX_HP) continue; else { if(iNowHP < MAX_HP) set_user_health(id, (iNowHP + i)); break; } } } public client_disconnect(id) { if(task_exists(id + 234)) remove_task(id + 234); }