AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help with set_user_health (https://forums.alliedmods.net/showthread.php?t=96154)

~Ice*shOt 07-01-2009 11:34

help with set_user_health
 
Hi, i using code set_user_health:
PHP Code:

cvar_health_hunter register_cvar("hunter_health""200"

PHP Code:

set_user_health(id,(get_pcvar_float(cvar_health_hunter))) 

but i have 6546466565 HP whats can help with this ?

larito 07-01-2009 11:38

Re: help with set_user_health
 
Quote:

Originally Posted by ~Ice*shOt (Post 861657)
Hi, i using code set_user_health:
PHP Code:

cvar_health_hunter register_cvar("hunter_health""200"

PHP Code:

set_user_health(id,(get_pcvar_float(cvar_health_hunter))) 

but i have 6546466565 HP whats can help with this ?

The error is because you are seting a float on health, the form is this

PHP Code:

set_user_health(idget_pcvar_num(cvar_health_hunter)) 



Sorry for my bad english :)

xPaw 07-01-2009 11:38

Re: help with set_user_health
 
Just because you are idiot. set_user_health doesn`t uses float, guess what you need todo !!

~Ice*shOt 07-01-2009 13:44

Re: help with set_user_health
 
Yes, but example: i using "get_pcvar_num" but this works not good! works not good = BAD!

xPaw 07-01-2009 13:48

Re: help with set_user_health
 
Just you fail :o

~Ice*shOt 07-01-2009 14:12

Re: help with set_user_health
 
help!

hleV 07-01-2009 15:15

Re: help with set_user_health
 
Code:
#include <engine>
Code:
cvar_health_hunter = register_cvar("hunter_health", "200");
Code:
entity_set_float(id, EV_FL_health, get_pcvar_float(cvar_health_hunter))
FTW.

~Ice*shOt 07-02-2009 02:26

Re: help with set_user_health
 
Quote:

Originally Posted by hleV (Post 861862)
Code:
#include <engine>
Code:
cvar_health_hunter = register_cvar("hunter_health", "200");
Code:
entity_set_float(id, EV_FL_health, get_pcvar_float(cvar_health_hunter))
FTW.

PHP Code:

public fw_PlayerPreThink(id
{
    if(!
is_user_alive(id)) 
        return 
FMRES_IGNORED
     
    static 
Floatvelocity[3], FloatTime 
    
static buttonflag 
    button 
pev(idpev_button
    
flag pev(idpev_flags
    
Time get_gametime()
     
    if (
g_zombie[id] && PlayerClass[id] == 0
    { 
        if ( (!
g_infreezetime) && (button IN_DUCK) && (button IN_ATTACK) && (flag FL_ONGROUND)) 
        { 
            static 
FloatcooldownFloatlheightlforce 
            cooldown 
get_pcvar_float(cvar_cooldown
            
lforce get_pcvar_num(cvar_lforce
            
lheight get_pcvar_float(cvar_lheight
            if (
Time cooldown g_LastLeap[id]) 
            {  
                
emit_sound(idCHAN_ITEMHunterLeap1.0ATTN_NORM0PITCH_NORM); 
                
set_pev(idpev_buttonbutton & ~IN_ATTACK
                
velocity_by_aim(idlforcevelocity
                
velocity[2] = lheight 
                set_pev
(idpev_velocityvelocity
                
g_LastLeap[id] = Time 
            

        } 
    }
    if (!
g_infreezetime && g_zombie[id] && PlayerClass[id] == 0)
    {
        
set_user_health(id,(get_pcvar_float(cvar_health_hunter))) 
        
set_user_gravity(id,(get_pcvar_float(cvar_gravity_hunter)))
        
set_user_maxspeed(id,(get_pcvar_float(cvar_speed_hunter)))

          
copy(player_model[id], 31HUNTER_MODEL)
    } 


i think spawn is bad ? but gravity and speed are works only health not works

hleV 07-02-2009 06:38

Re: help with set_user_health
 
I can't see anything that sets player's health in your code.

~Ice*shOt 07-02-2009 08:37

Re: help with set_user_health
 
see now.


All times are GMT -4. The time now is 15:35.

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