AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get_user_health (https://forums.alliedmods.net/showthread.php?t=93544)

One 05-30-2009 11:08

get_user_health
 
its easy but i need a mini help.

if(get_user_health(id) >= 1000)
{
client_print(id,chat_print,"hp = over 1000")
}

so the user hp can be changed every time. how can i get user health every 5 sec. for example?

alan_el_more 05-30-2009 11:15

Re: get_user_health
 
PHP Code:

// ...
set_task(5.0"get_health"id__"b")

//...

public get_health(id)
{
      if(
get_user_health(id) >= 1000)
      {
            
client_print(id,chat_print,"hp = over 1000")
      }


???

Hunter-Digital 05-30-2009 11:21

Re: get_user_health
 
What exacly you want to do ?

You can hook Health message and manage health there if you want whenever health changes

One 05-30-2009 11:22

Re: get_user_health
 
tried the same before i posted but after the player get hp over 1000 this prints every 5 sec. the text.

edit : i want just get player health. if the hp is more then 1000, player become new model & willbe stripped + cant peak weapons & other player become for example 300 hp & maybe more things. the problem is, i dont like to repeat the hp check after anyone has more 1000. all this must be reseted after roundend. when i check the hp after every 5 sec. & a player got more 1000, this checks again if anyone has more 1000 ... u know what i mean? no repeat after checked :D

xPaw 05-30-2009 11:31

Re: get_user_health
 
make some bool... like gHadMore1000HP or smth =\

One 05-30-2009 11:36

Re: get_user_health
 
PHP Code:

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


public plugin_init() 
{
    
register_plugin("Hulk mod""1.0""One")
    
set_task(5.0"check_hulk"1__"b")
}
public 
plugin_precache()
{        
    
precache_model("models/player/hulk/hulk.mdl")
}
public 
check_hulk(id)
{
    if(
get_user_health(id) >= 1000)
    {
        
cs_set_user_model(id"models/player/hulk/hulk.mdl")
        if(
get_user_health(id) <= 100)
        {
            
not_hulked(id)
        }
    }
    
}
public 
not_hulked(id)
{
    
set_user_health(id300)


hehe what/how u mean? i think its same if i use bool or not. when the hulk become damages & the hp get under 1000, the model must be same. the plugin must be restarted after round end. u know what i mean? or when a playe with <= 100 hp, become +300 & become damages & the HP get under 100, he become again +300. this is not correct :(

IneedHelp 05-30-2009 11:55

Re: get_user_health
 
Hook the event Health

One 05-30-2009 12:39

Re: get_user_health
 
haha the question is how ?! never tried before :P need some tuts or help.

ty in ad.

crazyeffect 05-30-2009 13:20

Re: get_user_health
 
Aint it

PHP Code:

client_print(idprint_chat"hp = over 1000"


One 05-30-2009 13:30

Re: get_user_health
 
heh? was this a question? if yea : yea its so right. but its not the problem. this was just to see if my if works & yea i writed this wrong.

still need help. :cry:

nothing works :(((

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")
    
set_task(5.0"check_hulk"1__"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(
get_user_health(id) >= 1000)
    {
        
cs_set_user_model(id"models/player/hulk/hulk.mdl")
        
set_user_gravity(id0.7)
        
strip_user_weapons(id)
        
give_item(id"weapon_knife")
        
UTIL_ScreenFade(id,{0,255,0},1.0,99.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(id300)
    
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;


the flaer must be enabled after hulk activate. but its still on.
only i willbe stripped & other hulks, have still weapons.
the model works not. cl_minmodel still on 0 but same models.
the Ts. will not be transfered after hukl activation. :( where are/is my problem/s??


All times are GMT -4. The time now is 13:58.

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