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-04-2010 , 07:02   Information about destroy objects on maps
Reply With Quote #1

I have a question and problem.
How can I make message, when someone destroy any object on map.
For example, on zm_ maps is footbridge and it have id 67 and what i must write in plugin to cause message when someone destroy it?
yetj is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-04-2010 , 15:31   Re: Information about destroy objects on maps
Reply With Quote #2

Hook Ham_Killed for the classname of this "footbridge".

Code:
RegisterHam( Ham_Killed, "footbridge_classname", "HAM_Footbridge_Killed_Post", 1 )
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
yetj
Junior Member
Join Date: Dec 2008
Location: Poland
Old 05-04-2010 , 15:56   Re: Information about destroy objects on maps
Reply With Quote #3

Hmm good idea ;)
But how can I get classname when i have only ID this item?
yetj is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-04-2010 , 15:59   Re: Information about destroy objects on maps
Reply With Quote #4

You shouldn't really use ID's, since they vary by server, but if it's just going to your server, use this.
Code:
#include <amxmodx> #include <fakemeta> #define ITEM_ID 9999 // your item id public plugin_init() {     register_plugin( "Classname Checker", "1.0", "Wrecked" )     register_clcmd( "say /cname", "CMD_Cname" ) } public CMD_Cname( id ) {     new cname[32]     pev( ITEM_ID, pev_classname, cname, 31 )     client_print( id, print_chat, "Classname: %s", cname ) }

Type /cname in all chat to get the classname of the item. Replace ITEM_ID's value of 9999 with the item ID.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
yetj
Junior Member
Join Date: Dec 2008
Location: Poland
Old 05-04-2010 , 16:02   Re: Information about destroy objects on maps
Reply With Quote #5

Nice ;)
Very thanks for you
yetj is offline
yetj
Junior Member
Join Date: Dec 2008
Location: Poland
Old 05-04-2010 , 18:41   Re: Information about destroy objects on maps
Reply With Quote #6

;(
This don't work.

I write it:

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

public plugin_init()
{
    
register_plugin("name""1.0""author");
    
    
RegisterHam(Ham_Killed"func_breakable""Ham_destroy");
    
}

public 
Ham_destroy(itemdestroyershouldgib)
{
    new 
destroyerName[32];
    
get_user_name(destroyerdestroyerNamesizeof(destroyerName)-1);
    
    
client_print(0print_chat"*** %s destroy item ID: %d",destroyerNameitem);

and it never print any message when I destroy footbridge or window or etc.
yetj is offline
Old 05-04-2010, 20:11
drekes
This message has been deleted by drekes. Reason: nvm
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 05-05-2010 , 13:14   Re: Information about destroy objects on maps
Reply With Quote #8

i'm interested at this to, i've spend 3 houres figuring this out, but the function isn't called no matter what i do.
I'm curious what the asnwer will be
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
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 #9

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