Raised This Month: $ Target: $400
 0% 

Hook an entity's touch of ground


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ezio_auditore
Senior Member
Join Date: May 2013
Old 11-03-2014 , 07:27   Hook an entity's touch of ground
Reply With Quote #1

Hey. I would like to know that how can we hook the event in which an entity touches the ground.
I know that it can be done by using
Code:
register_touch(...)
.
But what is the entity-name of the ground, i don't know that. So please help.
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 11-03-2014 , 08:27   Re: Hook an entity's touch of ground
Reply With Quote #2

I think you can do
PHP Code:
register_touch("your_entity""*""your_touch_func"); 
to register touch between your and any other entity.
klippy is offline
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 11-03-2014 , 08:46   Re: Hook an entity's touch of ground
Reply With Quote #3

What about FL_ONGROUND?
RateX is offline
ezio_auditore
Senior Member
Join Date: May 2013
Old 11-03-2014 , 12:32   Re: Hook an entity's touch of ground
Reply With Quote #4

Quote:
Originally Posted by KliPPy View Post
I think you can do
PHP Code:
register_touch("your_entity""*""your_touch_func"); 
to register touch between your and any other entity.
I know how to register the touches of an entity, I was asking how can I hook its touch with ground.
And about
Code:
//FL_ONGROUND if (pev(id, pev_flags) & FL_ONGROUND) {...}
I know this method. But this is meant for the players only. Does it have anything to do with entities?
__________________

Last edited by ezio_auditore; 11-03-2014 at 12:36.
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
RateX
Veteran Member
Join Date: Jun 2012
Location: 0o. SEA .o0
Old 11-03-2014 , 12:45   Re: Hook an entity's touch of ground
Reply With Quote #5

Instead of asking, why don't you test it yourself?
RateX is offline
ezio_auditore
Senior Member
Join Date: May 2013
Old 11-03-2014 , 13:38   Re: Hook an entity's touch of ground
Reply With Quote #6

I am away right now. Testing would be possible only after a few days.
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
Xalus
Veteran Member
Join Date: Dec 2009
Location: Belgium
Old 11-03-2014 , 16:30   Re: Hook an entity's touch of ground
Reply With Quote #7

PHP Code:
public pfn_touch(entityid)
{
    if(
pev_valid(entity)
    && !
task_exists(entity+16541))
    {
        if(
pev(entitypev_classname) == g_eClassnameid)
        {
            static 
intOwner
            intOwner 
pev(entitypev(entitypev_euser2) ? pev_euser1 pev_owner)
            
            
client_print(0print_chat"Owner %i: id: %i"intOwnerid)
            
            if(!
pev_valid(id))
            {
                
// Entity System
                
static Float:vecOrigin[3], Float:vecOutput[3]
                
pev(entitypev_originvecOrigin)
                
xs_vec_copy(vecOriginvecOutput)
                
vecOutput[2] -= 30.0
                
                
new iTraceHandle create_tr2()
                
engfunc(EngFunc_TraceLinevecOriginvecOutputIGNORE_MONSTERSidiTraceHandle)
                
get_tr2(iTraceHandleTR_vecEndPosvecOutput)
                
free_tr2(iTraceHandle)
                
                new 
intDiff = (floatround(vecOrigin[2]) - floatround(vecOutput[2]))
                
                
            }
        }
    }
    return 
PLUGIN_CONTINUE

Play with this, it checks walls & ground, so check height or something, to find out
__________________
Retired.

Last edited by Xalus; 11-03-2014 at 16:31.
Xalus is offline
Old 11-04-2014, 07:43
hleV
This message has been deleted by hleV.
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 11-04-2014 , 10:03   Re: Hook an entity's touch of ground
Reply With Quote #8

@Xalus, you don't get what he is asking. If this is what I think, it's for his last plugin, when he force a drop on the weapon and he needs to remove the dropped weapon ent. Also, he is asking how to hook touch for an entity with unknow classname, which is impossible. So, instead of asking this question, explain what's your real problem so we can give you the best way.
__________________
HamletEagle is offline
ezio_auditore
Senior Member
Join Date: May 2013
Old 11-05-2014 , 01:10   Re: Hook an entity's touch of ground
Reply With Quote #9

Quote:
Originally Posted by HamletEagle View Post
@Xalus, you don't get what he is asking. If this is what I think, it's for his last plugin, when he force a drop on the weapon and he needs to remove the dropped weapon ent. Also, he is asking how to hook touch for an entity with unknow classname, which is impossible. So, instead of asking this question, explain what's your real problem so we can give you the best way.
You mistook me again.
I am asking for a new plugin
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 11-05-2014 , 10:34   Re: Hook an entity's touch of ground
Reply With Quote #10

Quote:
Originally Posted by ezio_auditore View Post
You mistook me again.
I am asking for a new plugin
Actually not, your question doesn't make sense. You want to hook touch for an entity that you don't know ? How you can't know it's classname ? This seems very strange to me, so you should say what are you really trying to do so we can help you. If it's a default map entity you can find it's classname by searching, if it's an ent that you are creating, then you can set it's classname when you create it, so you will know. If this are not the cases, you need to provide more info.
__________________
HamletEagle 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 22:03.


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