Raised This Month: $ Target: $400
 0% 

Player touches my entity - how to detect?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 08-18-2009 , 00:08   Player touches my entity - how to detect?
Reply With Quote #1

All right, code:

PHP Code:
public myent(id){
    
    static 
Float:origin[3]
    
pev(idpev_originorigin)
    
    static 
ent
    ent 
engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    
    if(!
ent)
        return
    
    
set_pev(entpev_classname"myent")
    
    
engfunc(EngFunc_SetModelentMYMODEL)
    
    static 
Float:MinBox[3]
    static 
Float:MaxBox[3]
    for(new 
aa<3a++) {
        
MinBox[a] = -1.0
        MaxBox
[a] = 1.0
    
}
    
engfunc(EngFunc_SetSizeentMinBoxMaxBox)
    
engfunc(EngFunc_SetOriginentorigin)
    
    
set_pev(entpev_solidSOLID_SLIDEBOX)
    
set_pev(entpev_movetypeMOVETYPE_TOSS)
    
set_pev(entpev_ownerid)
    
    static 
Float:global_Time
    global_get
(glb_timeglobal_Time)
    
set_pev(entpev_nextthinkglobal_Time 1.0)

PHP Code:
RegisterHam(Ham_Touch"info_target""touched"1
But not works. I see my entity, but no action when I touch it. Why ?
__________________
Join US - custom Zombie Server - Custom Addons:



Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-18-2009 , 00:23   Re: Player touches my entity - how to detect?
Reply With Quote #2

register_touch("myent", "player", "YourFunction")


Then you won't have to filter through info_target and through toucher ents.
If nothing is triggered, see your ent properties.


set_pev(ent, pev_owner, id) MAY prevent id from touching it for example.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Old 08-18-2009, 00:51
Sn!ff3r
This message has been deleted by Sn!ff3r.
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-18-2009 , 00:54   Re: Player touches my entity - how to detect?
Reply With Quote #4

You also need to spawn the entity for the touch to trigger.
__________________
Hunter-Digital is offline
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 08-18-2009 , 00:55   Re: Player touches my entity - how to detect?
Reply With Quote #5

SOLID_SLIDEBOX -> SOLID_TRIGGER solved problem.

Quote:
You also need to spawn the entity for the touch to trigger.
False.
__________________
Join US - custom Zombie Server - Custom Addons:



Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
Old 08-18-2009, 19:09
Hunter-Digital
This message has been deleted by Hunter-Digital. Reason: nvm then :}
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 15:09.


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