Raised This Month: $ Target: $400
 0% 

Question about register_touch()


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ang52
Member
Join Date: Jan 2012
Old 05-05-2012 , 10:30   Question about register_touch()
Reply With Quote #1

if i will do this:

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

public plugin_init( )
{
    
register_touch"player""grenade""TouchEntity" );

it should called when player touch grenade right.
so how i sets the type of the grenade?
Ang52 is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-05-2012 , 11:04   Re: Question about register_touch()
Reply With Quote #2

Check the grenade's entity model.
__________________
<VeCo> is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 05-05-2012 , 11:07   Re: Question about register_touch()
Reply With Quote #3

I don't recommend to use Engine

Try hooking it with Ham Sandwich

PHP Code:
RegisterHamHam_Touch"weapon_hegrenade""OnHegreadeTouch" );

public 
OnHegrenadeTouchiTouchediToucher )
{
  static 
MaxClients; if( !MaxClients MaxClients get_maxplayers( );

  if( 
iTouched MaxClients )
  {
    
// iTouched is player and iToucher is hegrenade
  
}

  else if( 
iToucher MaxClients )
  {
    
// iTouched is hegrenade and iToucher is player
  
}

__________________

Last edited by claudiuhks; 05-05-2012 at 11:08.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Ang52
Member
Join Date: Jan 2012
Old 05-05-2012 , 11:37   Re: Question about register_touch()
Reply With Quote #4

Quote:
Originally Posted by claudiuhks View Post
I don't recommend to use Engine

Try hooking it with Ham Sandwich

PHP Code:
RegisterHamHam_Touch"weapon_hegrenade""OnHegreadeTouch" );

public 
OnHegrenadeTouchiTouchediToucher )
{
  static 
MaxClients; if( !MaxClients MaxClients get_maxplayers( );

  if( 
iTouched MaxClients )
  {
    
// iTouched is player and iToucher is hegrenade
  
}

  else if( 
iToucher MaxClients )
  {
    
// iTouched is hegrenade and iToucher is player
  
}

thanks for show me a second way.
but why you're not recommend to use Engine for this.
Ang52 is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-05-2012 , 11:41   Re: Question about register_touch()
Reply With Quote #5

Thrown grenade entity classname is "grenade", not "weapon_hegrenade".

Engine or hamsandwich - there isn't really a difference in this case, it's depending on what do you need it for and what do you want to use.
__________________
<VeCo> is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 05-05-2012 , 12:39   Re: Question about register_touch()
Reply With Quote #6

Quote:
Originally Posted by <VeCo> View Post
Thrown grenade entity classname is "grenade", not "weapon_hegrenade".

Engine or hamsandwich - there isn't really a difference in this case, it's depending on what do you need it for and what do you want to use.
Alright, if you are referring at thrown grenade, you should hook grenade classname.
How could you say there's no difference between Engine and Ham Sandwich?
Engine is doing many computations than Ham Sandwich
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 05-05-2012 , 11:46   Re: Question about register_touch()
Reply With Quote #7

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


public plugin_init() 
{
    
register_touch"player""grenade""TouchEntity" )
}

public 
TouchEntityplayerent )
{
    new 
Model20 ]
    
entity_get_stringentEV_SZ_modelModelcharsmaxModel ) )
    
    if( 
containiModel"flashbang" ) != -)
        
// touched flashbang

If you want to block the touch, you'll have to hook both player -> grenade and grenade -> player touches.

Also there's nothing wrong in using engine for this purpose.

Last edited by Backstabnoob; 05-05-2012 at 11:46.
Backstabnoob is offline
Ang52
Member
Join Date: Jan 2012
Old 05-05-2012 , 12:13   Re: Question about register_touch()
Reply With Quote #8

Thank you all for your help.
Ang52 is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 05-05-2012 , 15:14   Re: Question about register_touch()
Reply With Quote #9

No it doesn't matter here whether you use engine or ham sandwich as the difference is pretty much trivial, if any at all.
Backstabnoob is offline
Reply


Thread Tools
Display Modes

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 00:29.


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