Raised This Month: $51 Target: $400
 12% 

Detect when entity touch player head


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mashinata619
Member
Join Date: Aug 2010
Old 12-17-2019 , 04:15   Detect when entity touch player head
Reply With Quote #1

I am trying to detect when an entity (func_tracktrain) is touching (Ham_Touch) the player head and if touching it take some damage to the player. I try to create a new entity on the players head but i have not idea how detect when two entities touch between them.
mashinata619 is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 12-17-2019 , 06:30   Re: Detect when entity touch player head
Reply With Quote #2

https://forums.alliedmods.net/showthread.php?t=137489

Found on page one of google search.
redivcram is offline
mashinata619
Member
Join Date: Aug 2010
Old 12-17-2019 , 07:07   Re: Detect when entity touch player head
Reply With Quote #3

I search only functions with Ham_Touch... your idea is use RegisterHam(Ham_TakeDamage, "func_tracktrain", ...)?

https://forums.alliedmods.net/showpo...3&postcount=17

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

#define PLUGIN ""
#define VERSION "0.0.1"

new g_iMaxPlayers
#define IsPlayer(%0)    ( 1 <= (%0) <= g_iMaxPlayers )

public plugin_init()
{
    
register_pluginPLUGINVERSION"ConnorMcLeod" )
    
RegisterHam(Ham_Player_PostThink"func_tracktrain""OnCBasePlayer_PostThink"false)
    
g_iMaxPlayers get_maxplayers()
}

public 
OnCBasePlayer_PostThinkent )
{
    new 
target pev(entpev_groundentity// <-- I found that an entity not have pev_groundentity
    
if( IsPlayer(target) && is_user_alive(target) )
    {
         
client_print(0print_chat"An entity is touching your head")
    }


Last edited by mashinata619; 12-17-2019 at 11:39.
mashinata619 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 15:19.


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