Raised This Month: $ Target: $400
 0% 

[Help] Adding Minimum Distance


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Agent3554
Junior Member
Join Date: Aug 2020
Old 05-26-2021 , 21:01   [Help] Adding Minimum Distance
Reply With Quote #1

How do I include minimum distance as well?
PHP Code:
amx_bulletwhizz_dis register_cvar("amx_bulletwhizz_maxdis""3000"
amx_bulletwhizz_dis register_cvar("amx_bulletwhizz_mindis""300"

//This is the part where it calculates the distance, I don't know where should I add minimum distance
if( flDistance 0.0 || flDistance get_pcvar_float(amx_bulletwhizz_maxdis) || !fm_is_ent_visible(idtarget)) 

Basically:
I could hear bullet whizz when someone shoots towards me even from 0 to 3000 meters, what I want to happen is to add minimum range, so I could only hear it from 300 or 500 to 3000 meters
Agent3554 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-26-2021 , 21:13   Re: [Help] Adding Minimum Distance
Reply With Quote #2

Try this
PHP Code:
if( flDistance 0.0 || ( get_pcvar_float(amx_bulletwhizz_mindis) <= flDistance <= get_pcvar_float(amx_bulletwhizz_maxdis) || !fm_is_ent_visible(idtarget)) 
__________________

Last edited by Bugsy; 05-26-2021 at 21:14.
Bugsy is offline
Agent3554
Junior Member
Join Date: Aug 2020
Old 05-26-2021 , 21:22   Re: [Help] Adding Minimum Distance
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
Try this
PHP Code:
if( flDistance 0.0 || ( get_pcvar_float(amx_bulletwhizz_mindis) <= flDistance <= get_pcvar_float(amx_bulletwhizz_maxdis) || !fm_is_ent_visible(idtarget)) 
It works, thank you very much!
Agent3554 is offline
Agent3554
Junior Member
Join Date: Aug 2020
Old 05-28-2021 , 09:09   Re: [Help] Adding Minimum Distance
Reply With Quote #4

I realized that this was also possible
PHP Code:
amx_bulletwhizz_dis register_cvar("amx_bulletwhizz_maxdis""3000"
amx_bulletwhizz_dis register_cvar("amx_bulletwhizz_mindis""300"

if( 
flDistance get_pcvar_float(amx_bulletwhizz_mindis) || flDistance get_pcvar_float(amx_bulletwhizz_maxdis) || !fm_is_ent_visible(idtarget)) 
Agent3554 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-28-2021 , 15:16   Re: [Help] Adding Minimum Distance
Reply With Quote #5

You can do things many different ways. My code checks both with a single condition.
__________________
Bugsy 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 16:26.


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