AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   get health from classname? (https://forums.alliedmods.net/showthread.php?t=225544)

Cigojlo 09-06-2013 05:38

get health from classname?
 
I want to get health from lasermine plugin but idk how pls help here is part when owner of plugin set health of lasermine in this line set_user_health(i_Ent,get_pcvar_num(g_LHEALTH )); and i want to get_user_health from lasermine to edit this plugin, pls someone?
PHP Code:

public Spawnid )
{
    
id -= TASK_PLANT
    
// motor
    
new i_Ent engfunc(EngFunc_CreateNamedEntity,g_EntMine);
    if(!
i_Ent)
    {
        
client_print(id,print_chat,"[ZP] Can't Create Entity");
        return 
PLUGIN_HANDLED_MAIN;
    }
    
set_pev(i_Ent,pev_classname,ENT_CLASS_NAME);

    
engfunc(EngFunc_SetModel,i_Ent,ENT_MODELS);

    
set_pev(i_Ent,pev_solid,SOLID_NOT);
    
set_pev(i_Ent,pev_movetype,MOVETYPE_FLY);

    
set_pev(i_Ent,pev_frame,0);
    
set_pev(i_Ent,pev_body,3);
    
set_pev(i_Ent,pev_sequence,TRIPMINE_WORLD);
    
set_pev(i_Ent,pev_framerate,0);
    
    
set_pev(i_Ent,pev_takedamage,DAMAGE_YES);
    
    
set_pev(i_Ent,pev_dmg,100.0);
    
set_user_health(i_Ent,get_pcvar_num(g_LHEALTH)); 


simanovich 09-06-2013 09:00

Re: get health from classname?
 
set_user_health only works for players, not for non-player entitys.

To set/get health to/from a non-player entity use pev_health (fakemeta way)

Cigojlo 09-06-2013 12:57

Re: get health from classname?
 
thanks i'll try ;;)

colossus 09-07-2013 19:34

Re: get health from classname?
 
Try:

Code:
set_pev(i_Ent, pev_health, get_pcvar_float(g_LHEALTH)); // Set entity health with fakemeta


All times are GMT -4. The time now is 19:08.

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