Код за потвърждение: Избери целия код
public client_putinserver(id)
set_task(1.25, "regenerate", id, .flags = "b")
public client_disconnect(id)
remove_task(id)
Код за потвърждение: Избери целия код
public client_putinserver(id)
set_task(1.25, "regenerate", id, .flags = "b")
public client_disconnect(id)
remove_task(id)
Малко ме обърка, до колкото разбирам няма да има нужда от таск-а при този метод. Но как би се получило в целия код?
Код за потвърждение: Избери целия код
#include <amxmodx>
#include <fakemeta>
#include <fun>
#include <zombie_plague_reload>
new const zclass3_name[] = { "Enemy zombie" }
new const zclass3_info[] = { "Human skin" }
new const zclass3_model[] = { "gign" }
new const zclass3_clawmodel[] = { "knife_enemy.mdl" }
const zclass3_health = 2000
const zclass3_speed = 280
const Float:zclass3_gravity = 1.0
const Float:zclass3_knockback = 1.0
new g_izclass3
public plugin_init()
{
register_plugin("Enemy zombie", "1.2", "MeRcyLeZZ")
}
public plugin_precache()
{
g_izclass3 = zp_register_zombie_class(zclass3_name, zclass3_info, zclass3_model, zclass3_clawmodel, zclass3_health, zclass3_speed, zclass3_gravity, zclass3_knockback)
}
public client_putinserver(id)
{
set_task(1.25, "regenerate", id, .flags = "b")
}
public client_disconnect(id)
{
remove_task(id)
}
public regenerate(id)
{
if(!is_user_alive(id) || !zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_izclass3)
return
new iHealth = get_user_health(id)
if(iHealth >= zclass3_health)
return
set_user_health(id, clamp(iHealth + 1, .max = zclass3_health))
}
Код за потвърждение: Избери целия код
#include <amxmodx>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <zombie_plague_reload>
new const zclass3_name[] = { "Enemy zombie" }
new const zclass3_info[] = { "Human skin" }
new const zclass3_model[] = { "gign" }
new const zclass3_clawmodel[] = { "knife_enemy.mdl" }
const zclass3_health = 2000
const zclass3_speed = 280
const Float:zclass3_gravity = 1.0
const Float:zclass3_knockback = 1.0
new g_izclass3
public plugin_init()
{
register_plugin("Enemy zombie", "1.2", "MeRcyLeZZ")
RegisterHam(Ham_TakeDamage, "player", "OnTakeDamage")
}
public plugin_precache()
{
g_izclass3 = zp_register_zombie_class(zclass3_name, zclass3_info, zclass3_model, zclass3_clawmodel, zclass3_health, zclass3_speed, zclass3_gravity, zclass3_knockback)
}
public client_putinserver(id)
{
set_task(1.25, "regenerate", id, .flags = "b")
}
public client_disconnect(id)
{
remove_task(id)
}
public OnTakeDamage(id)
{
if (task_exists(id))
{
change_task(id, 3.25)
}
}
public regenerate(id)
{
if(!is_user_alive(id) || !zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_izclass3)
return
new iHealth = get_user_health(id)
if(iHealth >= zclass3_health)
return
set_user_health(id, clamp(iHealth + 1, .max = zclass3_health))
change_task(id, 1.25)
}
Щом си мераклия да учиш, ще обеснявам
Код за потвърждение: Избери целия код
#include <amxmodx>
#include <reapi>
#include <zombieplague>
new const zclass3_name[] = { "Enemy zombie" }
new const zclass3_info[] = { "Human skin" }
new const zclass3_model[] = { "gign" }
new const zclass3_clawmodel[] = { "knife_enemy.mdl" }
const zclass3_health = 2000
const zclass3_speed = 280
const Float:zclass3_gravity = 1.0
const Float:zclass3_knockback = 1.0
new g_iZombieID // Declare variable to store the zombie ID
public plugin_init()
{
register_plugin("Enemy zombie", "1.2", "MeRcyLeZZ Edit mi0")
RegisterHookChain(RG_CBasePlayer_TakeDamage, "OnTakeDamage", 1) // Register TakeDamage Event
}
public plugin_precache()
{
g_iZombieID = zp_register_zombie_class(zclass3_name, zclass3_info, zclass3_model, zclass3_clawmodel,
zclass3_health, zclass3_speed, zclass3_gravity, zclass3_knockback) // Registering the zombie
}
// Check whether the player has drowndmg and if so removeing it so it doesnt heal him while he is human
public zp_user_humanized_post(id)
{
if (zp_get_user_zombie(id)) // If the player is zombie we dont need to remove it
{
return
}
new iDrownDMG = get_member(id, m_idrowndmg)
if (iDrownDMG > 0) // If the drowndmg is bigger than 0
{
set_member(id, m_idrowndmg, 0) // Set the drowndmg to 0
}
}
public OnTakeDamage(id, iInf, iAttacker, Float:fDmg)
{
if (zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_iZombieID) // Check if the player is zombie and if he is check whether that zombie is the regen one or not
{
return
}
set_member(id, m_idrowndmg, get_member(id, m_idrowndmg) + floatround(fDmg)) // Set the drowndmg to the previous + the dmg
}
Потребители разглеждащи този форум: 0 регистрирани и 12 госта