Hello.
I have made something for my server, an HP on Frag plugin (Feel free to use, but not publish under your name)
Anyway, I get errors.
Quote:
Originally Posted by Errors
L 10/23/2007 - 17:45:57: [FUN] Player out of range (0)
L 10/23/2007 - 17:45:57: [AMXX] Displaying debug trace (plugin "amx_healthonfrag.amxx")
L 10/23/2007 - 17:45:57: [AMXX] Run time error 10: native error (native "set_user_health")
L 10/23/2007 - 17:45:57: [AMXX] [0] amx_healthonfrag.sma::client_death (line 26)
|
The source:
Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fun>
#define PLUGIN "Health on frag"
#define VERSION "1.0"
#define AUTHOR "TheLinx"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("amx_healthonfrag_enabled", "1")
register_cvar("amx_healthonfrag_health", "25")
register_cvar("amx_healthonfrag_health_max", "175")
register_cvar("amx_healthonfrag_health_extra_hs", "25")
register_event("DeathMsg", "client_death", "a", "1>0")
register_event("DeathMsg", "client_death_hs", "a", "3=1")
}
public client_death(id)
{ // Line 26
increase_hp(id, 0)
check_hp(id)
return PLUGIN_CONTINUE
}
public client_death_hs(id)
{
new cvar_hpextraonhs = get_cvar_num("amx_healthonfrag_health_extra_hs")
increase_hp(id, cvar_hpextraonhs)
check_hp(id)
return PLUGIN_CONTINUE
}
public increase_hp(id, arg_extrahp)
{
new id_health = get_user_health(id)
new cvar_healthonfrag = get_cvar_num("amx_healthonfrag_health")
set_user_health(id, id_health + cvar_healthonfrag + arg_extrahp)
}
public check_hp(id)
{
new id_health = get_user_health(id)
new cvar_maxhealth = get_cvar_num("amx_healthonfrag_health_max")
if (id_health > cvar_maxhealth)
{
set_user_health(id, cvar_maxhealth)
}
}
Please tell me what I am doing wrong!