#include #include #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); }