Raised This Month: $ Target: $400
 0% 

Touch - yes again


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dr.G
Senior Member
Join Date: Nov 2008
Old 01-28-2009 , 10:11   Touch - yes again
Reply With Quote #1

I am about to make a plugin that block some grenade exploits in dod_avalanche. I can easyly create some small solid boxes that makes the grenades bounch off when ppl try to toss a nade into one of those spots, but since its solids it makes some odd "bumps" in the map that i dont like.

So is it possible catch when a grenade touches that entity i have created, and send the grenade eg. outside the map? And would it be possible catch the owner of the grenade and give him a warning and/or even add admin immunity?

Thanks in advance!
__________________
Dr.G is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-28-2009 , 11:45   Re: Touch - yes again
Reply With Quote #2

yes it is

PHP Code:
RegisterHam(Ham_Touch"grenade""fwd_Ham_Touch");

// ...

public fwd_Ham_Touch(ident)
{
    
// ...

__________________
xPaw is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 01-28-2009 , 12:00   Re: Touch - yes again
Reply With Quote #3

Iam pretty sure HAM cant catch it since the entity i made to block those exploits isnt default entitys...

I did tryed like this but nothing happend...

PHP Code:
register_forward(FM_Touch,"hook_touch"
PHP Code:
public hook_touch(ptr,ptd)
{
 if(
get_pcvar_num(p_enable))
 {
  static 
szClassName[32]
  
pev(ptrpev_classnameszClassNamesizeof szClassName 1)
  
  if(
equali(szClassName,"weapon_handgrenade") || (equali(szClassName,"weapon_stickgreande")))
  {
   new 
obj_classname[32]
   
pev(ptdpev_classnameobj_classnamesizeof obj_classname 1)
   if(!
equali(obj_classname"nade_fix"))
    return 
FMRES_IGNORED
    
   
new Float:origin[3]
   
origin[0] = 200.0
   origin
[1] = 720.0
   origin
[2] = 440.0
   set_pev
(ptr,pev_origin,origin)
  }
 }
 return 
FMRES_IGNORED

And how bout the admin immunity...
__________________
Dr.G is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-28-2009 , 14:19   Re: Touch - yes again
Reply With Quote #4

Quote:
Originally Posted by Dr.G
Iam pretty sure HAM cant catch it since the entity i made to block those exploits isnt default entitys...
RegisterHamFromEntity()
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-28-2009 , 14:23   Re: Touch - yes again
Reply With Quote #5

You didn't made the grenade but the touched entity, to, RegisterHam will work with classname "grenade".
If you want to hook the touch with your custom entity, then you need to hook it with the initial classname (in most cases : "info_target"), but that's not what you want to do.
It's better to use ham for this touch ;)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-28-2009 , 14:28   Re: Touch - yes again
Reply With Quote #6

Also
PHP Code:
   new Float:origin[3]
   
origin[0] = 200.0
   origin
[1] = 720.0
   origin
[2] = 440.0
   set_pev
(ptr,pev_origin,origin
Why are you creating a new variable instead of using the values you want?
PHP Code:
   set_pev(ptr,pev_origin,Float:{200.0,720.0,440.0}) 
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 01-28-2009 , 15:08   Re: Touch - yes again
Reply With Quote #7

So i need to register both entitys to the same forward?? Shiiit my brain is boiling....

ups that variable was a copy paste thing...

PHP Code:
RegisterHam(Ham_Touch"grenade""fwd_Ham_Touch"); 
RegisterHamFromEntity(Ham_Touch"nade_fix""fwd_Ham_Touch");
 
 
public 
fwd_Ham_Touch(ident); 

    
// ... 

__________________
Dr.G is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-28-2009 , 16:00   Re: Touch - yes again
Reply With Quote #8

No, only RegisterHam with "grenade" classname, or weapon_handgrenade or whatever is this entity classname.
If it's the same as cs, as soon as you have launched the nade, classname is "grenade" (in fact the launched nade is a new entity and the nade that you were holding doesn't exist anymore).

So, something like this :

PHP Code:
RegisterHam(Ham_Touch"grenade""Grenade_Touch")

public 
Grenade_TouchiNade iEnt )
{
    if( !
pev_validiEnt ) )
        return 
HAM_IGNORED
    
static szClassName[9]
    
pev(iEntpev_classnameszClassNamecharsmax(szClassName))
    if( !
equalszClassName"nade_fix") )
        return 
HAM_IGNORED
    engfunc
(Engfunc_RemoveEntityiNade)
    return 
HAM_SUPERCEDE

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-29-2009 , 06:29   Re: Touch - yes again
Reply With Quote #9

ye Dr.G can you give me origins/ or already created entitys code, for block that bug pls
__________________
xPaw is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 01-29-2009 , 19:19   Re: Touch - yes again
Reply With Quote #10

yea ofcource u can... i still cant catch that damn touch tho lol. Ill send the code tomorrow or so...
__________________
Dr.G 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 01:53.


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