Raised This Month: $ Target: $400
 0% 

get_user_health


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-30-2009 , 16:45   Re: get_user_health
Reply With Quote #11

Quote:
Originally Posted by One View Post
haha the question is how ?! never tried before need some tuts or help.

ty in ad.
This will catch whenever a players health changes.

PHP Code:
public plugin_init() 
{
    
register_event"Health" "fwHealth" "b" );
}

public 
fwHealthid )
{
    
client_printid print_chat "your health is now %d" read_data) );

__________________

Last edited by Bugsy; 05-30-2009 at 16:48.
Bugsy is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 05-30-2009 , 17:16   Re: get_user_health
Reply With Quote #12

and with that use a bool when you set the model so that it doesn't set every time health changes over 1000

PHP Code:
new bool:isHulk[33]
 
public 
fwHealth(id)
{
       static 
hp
 
       hp 
read_data(1)
 
       if(!
isHulk[id] && hp 1000)
       {
              
isHulk[id] = true
              
// the "set hulk" code
       
}
       else if(
isHulk[id] && hp 1000)
       {
              
isHulk[id] = false
              
// the "no more hulk" code
       
}

__________________
Hunter-Digital is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-30-2009 , 17:22   Re: get_user_health
Reply With Quote #13

ty, used so :

register_event( "Health" , "check_hulk" , "b" )

if(read_data( 1 ) >= 1000.0)

ty again. its working now. ( local ) must just test with more users.

edit : u was faster hunter.

ok which should i use ? i have this here :

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <screenfade_util>
#include <fakemeta>
#define FLARE_MODEL "models/w_flare.mdl"

#define is_ent_flare(%1) (pev(%1, pev_iuser4) == 1333) ? 1 : 0
new cvar_smokeflare_dur
new 
iconstatus  
new cvar_smokeflare 0
public plugin_init() 
{
    
register_plugin("Hulk mod""1.0""One")
    
register_event"Health" "check_hulk" "b" );
    
iconstatus get_user_msgid("StatusIcon")  
    
register_forward(FM_SetModel,    "fwd_setmodel");
    
register_forward(FM_Think,    "fwd_think");
    
cvar_smokeflare_dur    register_cvar("flare_duration""999.9"); 
}
public 
plugin_precache()
{        
    
precache_model("models/player/hulk/hulk.mdl")
    
precache_model(FLARE_MODEL);
}
public 
check_hulk(id)
{
    if(
read_data) >= 1000.0)
    {
        
client_print(idprint_chat" haha")
        
cs_set_user_model(id"models/player/hulk/hulk.mdl")
        
set_user_gravity(id0.7)
        
UTIL_ScreenFade(id,{0,255,0},1.0,9999.0,30)
        
cs_set_user_team(id1)
        
message_begin(MSG_ONE,iconstatus,{0,0,0},id);
        
write_byte(1); 
        
write_string("dmg_gas");
        
write_byte(0); 
        
write_byte(255); 
        
write_byte(0);
        
message_end();
        
cvar_smokeflare 1
        
if(get_user_health(id) <= 100)
        {
            
not_hulked(id)
        }
    }
    
}
public 
not_hulked(id)
{
    
set_user_health(id,300)
    
set_user_gravity(id400.0)
    
cs_set_user_team(id2)
    

}
public 
fwd_setmodel(ent, const model[]) 
{
    if(!
pev_valid(ent) || !equal(model[9], "smokegrenade.mdl"))
    return 
FMRES_IGNORED;

    static 
classname[32]; pev(entpev_classnameclassname31);
    if(
equal(classname"grenade") && cvar_smokeflare == 1) {
    
engfunc(EngFunc_SetModelentFLARE_MODEL);
    
set_pev(entpev_effectsEF_BRIGHTLIGHT);
    
set_pev(entpev_iuser4,   1333);
    
set_pev(entpev_nextthinkget_gametime() + get_pcvar_float(cvar_smokeflare_dur));
    
fm_set_rendering(entkRenderFxGlowShell150150250kRenderNormal16);
  
    return 
FMRES_SUPERCEDE;
    }
    return 
FMRES_IGNORED;
}
public 
fwd_think(ent)

    if(
pev_valid(ent) && is_ent_flare(ent))
    
engfunc(EngFunc_RemoveEntityent);


stock fm_set_rendering(entityfx kRenderFxNone255255255render kRenderNormalamount 16
{
    static 
Float:color[3]; color[2] = float(b), color[0] = float(r), color[1] = float(g);

    
set_pev(entitypev_renderfx,    fx);
    
set_pev(entitypev_rendercolorcolor);
    
set_pev(entitypev_rendermode,    render);
    
set_pev(entitypev_renderamt,    float(amount));
    return 
1;

__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-30-2009 , 17:30   Re: get_user_health
Reply With Quote #14

Don't use a decimal for checking the read_data value. It may work with the decimal but it is improper to evaluate 2 different types like that (in this case, integer and a float). Some calculations will get thrown off if you do this so try to get in the habit.

Code:
public check_hulk(id) {     if(read_data( 1 ) >= 1000.0)     {         client_print(id, print_chat, " haha")

Use

PHP Code:
if( read_data) >= 1000 
__________________

Last edited by Bugsy; 05-30-2009 at 17:32.
Bugsy is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 05-30-2009 , 17:34   Re: get_user_health
Reply With Quote #15

Shouldn't it be
Code:
cs_set_user_model(id, "hulk")
instead of
Code:
cs_set_user_model(id, "models/player/hulk/hulk.mdl")
?
__________________
hleV is offline
Old 05-30-2009, 17:59
One
This message has been deleted by One. Reason: nvm
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-31-2009 , 10:46   Re: get_user_health
Reply With Quote #16

so, the model will be added on new round. i have cs_reset_user_model(id) but happend nothing.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <screenfade_util>
#include <fakemeta>
#include <csstats>


#define FLARE_MODEL "models/w_flare.mdl"
#define is_ent_flare(%1) (pev(%1, pev_iuser4) == 1333) ? 1 : 0


new cvar_smokeflare_dur
new 
iconstatusg_EnableHudHelpg_playersets
new cvar_smokeflare 0
public plugin_init() 
{
    
register_plugin("Hulk mod""1.0""One")
    
register_event"Health" "check_hulk" "b" );
    
iconstatus get_user_msgid("StatusIcon")  
    
register_forward(FM_SetModel,    "fwd_setmodel");
    
register_forward(FM_Think,    "fwd_think");
    
cvar_smokeflare_dur    register_cvar("flare_duration""999.9"); 
    
set_task(1.0"modInfo"0""0"b");
    
g_EnableHudHelp register_cvar("cs_dod_enablehud_help""1");
    
g_playersets register_cvar("amx_player_numbermod""1")
}
public 
plugin_precache()
{        
    
precache_model("models/player/hulk/hulk.mdl")
    
precache_model(FLARE_MODEL);
}
public 
check_hulk(id)
{
    if(
read_data) >= 1000)
    {
        if(
get_user_health(id) <= 100)
        {
            
not_hulked(id)
        }
        new 
name[33]
        new 
sein_hp
        
new p_playernum;
        
p_playernum get_playersnum(1);
        
cs_reset_user_model(id)
        
cs_set_user_model(id"hulk")
        
set_user_gravity(id0.7)
        
UTIL_ScreenFade(id,{0,255,0},1.0,5.0,30)
        
cs_set_user_team(id1)
        
message_begin(MSG_ONE,iconstatus,{0,0,0},id);
        
write_byte(1); 
        
write_string("dmg_gas");
        
write_byte(0); 
        
write_byte(255); 
        
write_byte(0);
        
message_end();
        
cvar_smokeflare 1
        
if(get_pcvar_num(g_playersets) == 1)
        {
            if(
p_playernum == 1)
            {
                
set_user_health(id1000)
            }
            else if(
p_playernum == 2)
            {
                
set_user_health(id1200)
            }
            else if(
p_playernum == 4)
            {
                
set_user_health(id1500)
            }
            else if(
p_playernum == 8)
            {
                
set_user_health(id2000)
            }
            else if(
p_playernum == 12)
            {
                
set_user_health(id4000)
            }
            else if(
p_playernum == 15)
            {
                
set_user_health(id5000)
            }
            else if(
p_playernum == 18)
            {
                
set_user_health(id6000)
            }
            else if(
p_playernum >= 22)
            {
                
set_user_health(id9000)
            }
        }
        
sein_hp get_user_health(id)
        
get_user_name(id,name,32)
        
set_hudmessage(255,255,255,0.4,0.5,06.06.00.10.24);
        
show_hudmessage(0"%s with %d is now the HULK. TAKE CARE.",name,sein_hp);
    }
    
}
public 
modInfo()
{
    if(
get_pcvar_num(g_EnableHudHelp) == 1)
    {
        
set_hudmessage(255,255,255,0.75,0.05,01.01.00.10.213);
        
show_hudmessage(0"This server run: Hulk Mod by One^nType /help to know how to play");
    }
    return 
PLUGIN_CONTINUE;
}
public 
not_hulked(id)
{
    
set_user_health(id,300)
    
set_user_gravity(id400.0)
    
cs_set_user_team(id2)
}
public 
fwd_setmodel(ent, const model[]) 
{
    if(!
pev_valid(ent) || !equal(model[9], "smokegrenade.mdl"))
    return 
FMRES_IGNORED;

    static 
classname[32]; pev(entpev_classnameclassname31);
    if(
equal(classname"grenade") && cvar_smokeflare == 1) {
    
engfunc(EngFunc_SetModelentFLARE_MODEL);
    
set_pev(entpev_effectsEF_BRIGHTLIGHT);
    
set_pev(entpev_iuser4,   1333);
    
set_pev(entpev_nextthinkget_gametime() + get_pcvar_float(cvar_smokeflare_dur));
    
fm_set_rendering(entkRenderFxGlowShell150150250kRenderNormal16);
  
    return 
FMRES_SUPERCEDE;
    }
    return 
FMRES_IGNORED;
}
public 
fwd_think(ent)

    if(
pev_valid(ent) && is_ent_flare(ent))
    
engfunc(EngFunc_RemoveEntityent);


stock fm_set_rendering(entityfx kRenderFxNone255255255render kRenderNormalamount 16
{
    static 
Float:color[3]; color[2] = float(b), color[0] = float(r), color[1] = float(g);

    
set_pev(entitypev_renderfx,    fx);
    
set_pev(entitypev_rendercolorcolor);
    
set_pev(entitypev_rendermode,    render);
    
set_pev(entitypev_renderamt,    float(amount));
    return 
1;

maybe has anyone time & can check the code please.

all players must be tranfered to CT & only the hulk must be T. after roundend a random team. so that the game will be normal.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
znovit
Member
Join Date: Mar 2009
Location: Behind you :=
Old 05-31-2009 , 13:51   Re: get_user_health
Reply With Quote #17

PHP Code:
public not_hulked(id)
{
    
set_user_health(id,300)
    
set_user_gravity(id400.0)
    
cs_set_user_team(id2)

---->
PHP Code:
public not_hulked(id)
{
    
set_user_health(id,300)
    
set_user_gravity(id0.5// Otherwise it would be wrong ?:p
    
cs_set_user_team(id2)

__________________
znovit is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-31-2009 , 13:55   Re: get_user_health
Reply With Quote #18

That is correct.

http://www.amxmodx.org/funcwiki.php?go=func&id=125
__________________
Bugsy is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 06-04-2009 , 13:09   Re: get_user_health
Reply With Quote #19

still having a problem.

first for this i dont want to use fakemeta.
secund the problem :

how can i get another players? i mean i have the hulked id. so added the things on hulk & now i wannt to add things on another players.

if(get_user_health(id) >= 1000 ) << for example
do this & do that.
& set_user_health on another pleayers 300. << somthing like this. or cs_set_user_team CT.any ideas?

better said : catch the players who is not hulked.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-04-2009 , 14:32   Re: get_user_health
Reply With Quote #20

Code:
new g_iMaxPlayers; new g_bIsHulk[33]; // Use g_bIsHulk[id] = true, when you make player Hulk   public plugin_init()         g_iMaxPlayers = get_maxplayers();   public fnSomething()         for (new iCl = 1; iCl <= g_iMaxPlayers; iCl++)                 if (!g_bIsHulk[iCl]) // Player is not Hulk                 {                         // Your stuff                 }
__________________
hleV 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 13:58.


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