Raised This Month: $32 Target: $400
 8% 

HEs destroy grenades 1.1.1


Post New Thread Reply   
 
Thread Tools Display Modes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-02-2013 , 17:48   Re: HEs destroy grenades 1.0.1
Reply With Quote #21

  • This:
    Code:
    ~get_pdata_int(he, m_usEvent, XO_WEAPON) & HEGRENADE)
    get_pdata_int(nearbyNade, m_usEvent, XO_WEAPON) & SMOKENADE
    Even if it could give wanted results, it still a wrong way.
    m_usEvent doesn't return some bits. It's an index incremented when precache_event is called.
    As it has been said, you are just lucky it somehow works this way and hardcoding such "flag" is not appropriate since that's something which could be changed/altered.
    The proper way has been stated above, checking if not c4, and then checking if m_usEvent is same as precache_event(1, "events/createexplo.sc"). This would be more reliable.

  • Not sure to see the point about FL_EXPLODED. Using a random engine flag doesn't seem a good idea as there is no meaning behind. At best, I would have used available custom _iuser* field. You could also check if pev_model or pev_solid is null, since set when a grenade is going to explode.

  • As get_pdata_bool and others have been added in 1.8.3, you should make sure your stocks are available only for AMXX version < 1.8.3, avoiding compilation problem.

  • I would strongly recommend the use of Orpheu as you could hook directly a grenade explosion, resulting an efficient, reliable and custom mod-friendly plugin.

Some idea : Adding a customizable delay before a grenade explosion. It would be appear probably more realistic if there is some slight [random or not] delay.
__________________

Last edited by Arkshine; 12-02-2013 at 17:49.
Arkshine is offline
BeasT
Senior Member
Join Date: Apr 2007
Location: Lithuania
Old 12-03-2013 , 19:06   Re: HEs destroy grenades 1.0.1
Reply With Quote #22

Thanks for the suggestions, once again. I guess I wont't escape orpheu, ha Will post an update soon.
BeasT is offline
Send a message via Skype™ to BeasT
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-04-2013 , 00:56   Re: HEs destroy grenades 1.0.1
Reply With Quote #23

There is no requirement to use orpheu, if you don't feel to use it, just stick with Think hook, but as it was suggested, hook Ham_Think as POST and check owner or effects, when owner has been set to 0 it means nade has just exploded.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-04-2013 , 04:02   Re: HEs destroy grenades 1.0.1
Reply With Quote #24

This is not a matter to feel or not, but what is the appropriate method to use considering the existing tool, generated code (efficiency, reliability, readability, etc.) and keeping custom mod in mind. Using orpheu is just the best way.
__________________
Arkshine is offline
BeasT
Senior Member
Join Date: Apr 2007
Location: Lithuania
Old 12-04-2013 , 11:18   Re: HEs destroy grenades 1.1
Reply With Quote #25

Check the update. What's new:
remade the plugin with Orpheu; added a slight, distance based, explosion delay for nearby grenades.
BeasT is offline
Send a message via Skype™ to BeasT
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-04-2013 , 15:08   Re: HEs destroy grenades 1.1
Reply With Quote #26

Hm, why don't you use pev_dmgtime for smokegrenade ?
__________________
Arkshine is offline
BeasT
Senior Member
Join Date: Apr 2007
Location: Lithuania
Old 12-05-2013 , 11:34   Re: HEs destroy grenades 1.1
Reply With Quote #27

So I could know which sgs are affected by exploding HE and then detonate them on SG_TumbleThink.
BeasT is offline
Send a message via Skype™ to BeasT
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-05-2013 , 11:55   Re: HEs destroy grenades 1.1
Reply With Quote #28

I mean, you could have used pev_dmgtime. I'm not sure to understand the use of a custom field here.
__________________
Arkshine is offline
BeasT
Senior Member
Join Date: Apr 2007
Location: Lithuania
Old 12-05-2013 , 12:45   Re: HEs destroy grenades 1.1
Reply With Quote #29

I could, but then the sg only explodes when it reaches the ground.
BeasT is offline
Send a message via Skype™ to BeasT
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-05-2013 , 13:13   Re: HEs destroy grenades 1.1
Reply With Quote #30

That's the purpose of hooking as post. You let all the checks be done, if time is up but grenade is not on the ground, it's fine, you will catch up in your hook as post.
__________________
Arkshine 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 01:28.


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