Raised This Month: $ Target: $400
 0% 

Help HP regeniration!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
work_SSS
Junior Member
Join Date: Aug 2009
Old 11-21-2009 , 03:03   Help HP regeniration!
Reply With Quote #1

#include <amxmodx>
#include <amxmisc>
#include <fun>

#define Plugin "Health Regenerator"
#define Version "1.1"
#define Author "Doombringer"

new max_hp, hp_time, hp_give
public plugin_init()
{
register_plugin(Plugin, Version, Author)

register_event("DeathMsg", "hook_death", "a")
register_event("Damage", "hook_damage", "b")

max_hp = register_cvar("HR_maxhp", "30")
hp_time = register_cvar("HR_hptime", "0.45")
hp_give = register_cvar("HR_hpgive", "1")
}

public client_disconnect(id)
{
if(task_exists(id))
remove_task(id)
}

public hook_death()
{
new victim = read_data(2)

if(task_exists(victim))
remove_task(victim)
}

public hook_damage(id)
{
if(!task_exists(id))
set_task(get_pcvar_float(hp_time), "generate_hp", id,_,_, "b")
}

public generate_hp(id)
{
new health = get_user_health(id)

if(health >= get_pcvar_num(max_hp))
{
remove_task(id)
return PLUGIN_CONTINUE
}

new hptogive = clamp(health + get_pcvar_num(hp_give), 0, get_pcvar_num(max_hp))
set_user_health(id, hptogive)

return PLUGIN_CONTINUE
}


Problem!

L 11/21/2009 - 00:06:27: [AMXX] Displaying debug trace (plugin "regenhum.amxx")
L 11/21/2009 - 00:06:27: [AMXX] Run time error 10: native error (native "set_user_health")
L 11/21/2009 - 00:06:27: [AMXX] [0] regenhum.sma::generate_hp (line 53)
L 11/21/2009 - 00:06:27: [FUN] Invalid player 2

Hi I need your help!
work_SSS is offline
noodleboy347
AlliedModders Donor
Join Date: Mar 2009
Old 11-21-2009 , 04:52   Re: Help HP regeniration!
Reply With Quote #2

Wrong section.
noodleboy347 is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 11-21-2009 , 17:29   Re: Help HP regeniration!
Reply With Quote #3

Moved from the SourceMod forums.
bl4nk is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 11-21-2009 , 17:31   Re: Help HP regeniration!
Reply With Quote #4

After :

public generate_hp(id)
{

add :

if ( !is_user_alive( id ) )
{
return PLUGIN_CONTINUE;
}
__________________
Arkshine is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:33.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode