Raised This Month: $ Target: $400
 0% 

Distance To Bomb Planted v1.1


Post New Thread Reply   
 
Thread Tools Display Modes
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-22-2014 , 10:44   Re: Distance To Bomb Planted v1.1
Reply With Quote #21

Also use fakemeta/engine, not fm util.
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-22-2014 , 10:52   Re: Distance To Bomb Planted v1.1
Reply With Quote #22

Creating task each 0.1 second, is really a bad idea.

What I would do is:

- Hooking grenade think when bomb is planted.
- Inside think, Making sure it's a C4 (m_bIsC4 grenade offset) and doing stuff.
- Remove hooking once exploded/defused/round end?
- I may lower the next think time (not the actual next think, just a cooldown for message), by default it will be 0.13, maybe changing to 0.5 or 1 sec should be enough.

Also what you're doing with float_to_str and loop is silly. Just use floatround(get_distance_f( directly in show_hudmessage.
Or better, you could cache the bomb origin from BombDrop event, then working with integer origin (so using get_user_origin, get_distance).

Well, basically there are rooms for improvements. So, try things.
__________________

Last edited by Arkshine; 05-23-2014 at 10:16.
Arkshine is offline
ezio_auditore
Senior Member
Join Date: May 2013
Old 05-23-2014 , 09:35   Re: Distance To Bomb Planted v1.1
Reply With Quote #23

Thanks... Will be implemented when i am free...
P.S You are awsome Arkshine
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 04-19-2016 , 07:14   Re: Distance To Bomb Planted v1.1
Reply With Quote #24

Finding entity by model is a poor way.
You could loop all grenade entities and check m_bIsC4 offset, then break the loop once you found it.
Or hook BombDrop event and use read_data to get CoordX, CoordY and CoordZ from the event. Just remember to use correct filters(4 th arg is 1 when planted and 0 when dropped), so register_event("BombDrop", "OnBombDrop", "a", "4=1").

Creating 32 task at 0.1 is not your best bet. Make only one at 1.0 seconds and loop players, or(as Arkshine told you) hook grenade think when bomb is planted(so on BombDrop event) and update the distance. Don't forget to remove the hook once it's no longer needed.

Unapproved until you make some changes.
__________________

Last edited by HamletEagle; 04-19-2016 at 07:14.
HamletEagle 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 12:02.


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