AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Bullets fly through entity (https://forums.alliedmods.net/showthread.php?t=224310)

ewardd 08-22-2013 14:19

Bullets fly through entity
 
I created an entity which is solid,taking damage and have 200 hp.

Code:

new g_Model[] = {"models/chick.mdl"}
 
public plugin_init(){
 
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_concmd("chicken", "add_chicken")
}
public plugin_precache(){
    precache_model(g_Model)
}
public add_chicken(id){
 
    new Ent = create_entity("info_target")
 
    if(is_valid_ent(Ent)){
        entity_set_model(Ent, g_Model)
        entity_set_size(Ent,Float:{-6.0, -10.0, -10.0},Float:{6.0, 10.0, 36.0})
        new Float:f_Origin[3]
        entity_get_vector(id, EV_VEC_origin, f_Origin)   
        f_Origin[0] += 50.0
        entity_set_origin(Ent, f_Origin)       
        entity_set_int(Ent,EV_INT_solid,SOLID_BBOX)
 
        entity_set_float(Ent, EV_FL_takedamage, DAMAGE_YES)
        entity_set_float(Ent, EV_FL_health, 200.0)
 
        drop_to_floor(Ent)
    }
}

But when i shot in it, bullets fly through entity...
But it takes damage because it gones after getting 200 dmg.

So how can i fix it? And is it possible?

.Dare Devil. 08-22-2013 17:46

Re: Bullets fly through entity
 
search: creating func_breakable

ewardd 09-20-2013 13:26

Re: Bullets fly through entity
 
Thanks, i changed size and it works.

Next question.
How can i make bullets not damage through entity? This time i mean: not damage players through specific entity?
Like as everyone know in CS you can shot through walls/entitys, how can i block this for my entity?

Sorry for my bad english.

hornet 09-20-2013 22:27

Re: Bullets fly through entity
 
You could hook Ham_TakeDamage and then use trace_line(), checking the attacker'a aim vector and see if it hit your entity.

ewardd 09-21-2013 06:28

Re: Bullets fly through entity
 
It sounds pretty hard, can you give me please an example?


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

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