Raised This Month: $ Target: $400
 0% 

Information about destroy objects on maps


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yetj
Junior Member
Join Date: Dec 2008
Location: Poland
Old 05-05-2010 , 13:17   Re: Information about destroy objects on maps
Reply With Quote #1

I found it:

PHP Code:
#include <amxmodx>
#include <fakemeta>

public plugin_init() {
    
register_plugin("break_alert""1.0""commonbullet")
    
register_message(SVC_TEMPENTITY"check_breakable"
    
}

public 
check_breakable(msgid) {
    if(
get_msg_arg_int(1) != TE_BREAKMODEL)
        return 
PLUGIN_CONTINUE
    
    
new Float:br_origin[3]
    new 
Float:br_size[3]    
    new 
Float:tempvector[3]
    new 
Float:health
    
new classname[32]
    new 
ent

    br_origin
[0] = get_msg_arg_float(2)
    
br_origin[1] = get_msg_arg_float(3)
    
br_origin[2] = get_msg_arg_float(4)
    
br_size[0] = get_msg_arg_float(5)
    
br_size[1] = get_msg_arg_float(6)
    
br_size[2] = get_msg_arg_float(7)
    
    while((
ent engfunc(EngFunc_FindEntityInSphereentbr_origin0))) {
        
pev(entpev_classnameclassname31)
        if(
equal(classname"func_breakable")) {
            
pev(entpev_healthhealth)
            if(
health && !(pev(entpev_spawnflags) & SF_BREAK_TRIGGER_ONLY))
                continue            
            
// breakable is still solid when this message is thrown
            // so it'll block already broken entities
            
if(pev(entpev_solid) == SOLID_NOT
                continue
            
fm_get_brush_entity_origin(enttempvector)
            if(!
equal_vector(tempvectorbr_origin))
                continue
            
pev(entpev_sizetempvector)
            if(!
equal_vector(tempvectorbr_size))
                continue            
            
            
// ------ ADD HANDLE CODE... --------
            
client_print(0print_chat"Entity %d has been broken."ent)
            
// ----------------------------------
            
            
break
        }
    }
    return 
PLUGIN_CONTINUE  
}

fm_get_brush_entity_origin(entFloat:orig[3]) {
    
// converted to fm from engine stocks
    
new Float:Min[3]
    new 
Float:Max[3]
    
pev(entpev_minsMin)
    
pev(entpev_maxsMax)
    
    
orig[0] = (Min[0] + Max[0]) * 0.5
    orig
[1] = (Min[1] + Max[1]) * 0.5
    orig
[2] = (Min[2] + Max[2]) * 0.5

    
return 1
}

equal_vector(const Float:vector1[3], const Float:vector2[3]) {
    return ((
vector1[0] == vector2[0]) && (vector1[1] == vector2[1]) && (vector1[2] == vector2[2]))

and this work fine, but I don't have any idea how check who destroy it?
Any Ideas?
yetj 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 03:48.


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