Raised This Month: $ Target: $400
 0% 

Set_user_health


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
reinert
Veteran Member
Join Date: Feb 2007
Old 06-06-2010 , 11:04   Set_user_health
Reply With Quote #1

Why this plugin isn't working properly ?

when I'm holding a knife it should restore my Health every 10 seconds, but it doesn't.

code:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>

#define PLUGIN "knife heal"
#define VERSION "1.0"
#define AUTHOR "addinol"
new gtimegmaxgadd
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("CurWeapon""Event_CurWeapon""be","1=1");
    
gtime register_cvar("inch_khptime","10.0")
    
gmax register_cvar("inch_khpmax","200")
    
gadd register_cvar("inch_khprestore","3")
}

public 
Event_CurWeapon(id)
{
    new 
clipammoweapon get_user_weapon(id,clip,ammo);
    if(
weapon == CSW_KNIFE) { 
    
set_task(get_pcvar_float(gtime), "hp")
}
}

public 
hp(id){
    new 
userHp get_user_health(id)
    if(
userHp >= get_pcvar_num(gmax))
    {
        
set_user_health(idget_pcvar_num(gmax))
    }else{
    
set_user_health(iduserHp get_pcvar_num(gadd))
    
set_task(get_pcvar_float(gtime), "hp")
    }

reinert is offline
 



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 05:21.


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