Raised This Month: $ Target: $400
 0% 

Bullets fly through entity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ewardd
Junior Member
Join Date: Aug 2012
Old 08-22-2013 , 14:19   Bullets fly through entity
Reply With Quote #1

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?
ewardd is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 08-22-2013 , 17:46   Re: Bullets fly through entity
Reply With Quote #2

search: creating func_breakable

Last edited by .Dare Devil.; 08-22-2013 at 17:46.
.Dare Devil. is offline
ewardd
Junior Member
Join Date: Aug 2012
Old 09-20-2013 , 13:26   Re: Bullets fly through entity
Reply With Quote #3

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.
ewardd is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 09-20-2013 , 22:27   Re: Bullets fly through entity
Reply With Quote #4

You could hook Ham_TakeDamage and then use trace_line(), checking the attacker'a aim vector and see if it hit your entity.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
ewardd
Junior Member
Join Date: Aug 2012
Old 09-21-2013 , 06:28   Re: Bullets fly through entity
Reply With Quote #5

It sounds pretty hard, can you give me please an example?
ewardd 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 19:14.


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