hi all i would like create a plugin who regenerate the terrorist after 5seconds not hurt but i have errors in my code can you help me for correct please
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <fun>
#define PLUGIN "alien Regeneration"
#define VERSION "1.0"
#define AUTHOR "fry!"
new g_regen_time, g_regen_amount, g_class_regen
const alien_maxhealth = 500
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_regen_time = register_cvar("zp_regen_time", "5.0")
g_regen_amount = register_cvar("zp_regen_amount", "5.0")
register_event("Damage", "SetRegeneration", "be", "2>0")
}
public zp_user_infected_post(player)
{
if ((cs_get_user_team(player) == CS_TEAM_T) == g_class_regen)
{
Regenerate(player)
}
}
public SetRegeneration(player)
{
if (!is_user_alive(player) || (cs_get_user_team(player) == CS_TEAM_T))
return PLUGIN_CONTINUE
if ((cs_get_user_team(player) == CS_TEAM_T) != g_class_regen)
return PLUGIN_CONTINUE
if (get_user_health(player) < alien_maxhealth(player))
set_task(get_pcvar_float(g_regen_time), "Regenerate", player, _, _, "b")
return PLUGIN_CONTINUE
}
public Regenerate(player)
{
if (!is_user_alive(player) || (cs_get_user_team(player) == CS_TEAM_T))
return PLUGIN_CONTINUE
new regen_health = get_user_health(player)
new max_health = alien_maxhealth(player) - regen_health
if (max_health <= get_pcvar_num(g_regen_amount))
{
set_pev(player, pev_health, regen_health + float(max_health))
}
if (max_health <= get_pcvar_num(g_regen_amount) <= alien_maxhealth)
{
remove_task(player)
}
set_pev(player, pev_health, regen_health + get_pcvar_float(g_regen_amount))
return PLUGIN_CONTINUE
}
Code:
alienregeneration.sma(23) : warning 213: tag mismatch
alienregeneration.sma(34) : warning 213: tag mismatch
alienregeneration.sma(37) : error 012: invalid function call, not a valid address
alienregeneration.sma(37) : warning 215: expression has no effect
alienregeneration.sma(37) : error 001: expected token: ";", but found ")"
alienregeneration.sma(37) : error 029: invalid expression, assumed zero
alienregeneration.sma(37) : fatal error 107: too many error messages on one line
and i have an question i would like the terrorist have longjump this plugin is it correct ?
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>
new bool:g_hasLongJump[33]
#define AUTHOR "test"
#define VERSION "1.0"
#define PLUGIN "am_longjump"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Spawn, "id", "Player_Spawn", 1);
register_event("DeathMsg", "death", "a")
register_event("ResetHUD", "roundchange" , "b")
}
public client_connect(id)
{
g_hasLongJump[id] = false
return PLUGIN_HANDLED
}
public client_disconnect(id)
{
g_hasLongJump[id] = false
return PLUGIN_HANDLED
}
public death()
{
new id = read_data(2)
g_hasLongJump[id] = false
}
public Player_Spawn(id)
{
if(is_user_alive(id))
{
if(cs_get_user_team(id) == CS_TEAM_T)
give_item(id, "item_longjump")
g_hasLongJump[id] = true
}
return PLUGIN_CONTINUE
}
public roundchange(id)
{
if ( g_hasLongJump[id] == false )
{
return PLUGIN_HANDLED
}
if ( g_hasLongJump[id] == true )
{
give_item(id, "item_longjump")
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}