View Single Post
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 06-20-2019 , 21:39   Re: How can I check that?
Reply With Quote #8

Quote:
Originally Posted by Natsheh View Post
What do you mean with the same ? Closer to each other?

Are you using floats ?

Then use floatround..


Can you explain what are you doing this for?

Also pick out a better title for your thing.


Edit : best thing is to use your first thing no need to overcomplicate a simple thing
I was trying to make a compass format which makes the directions in a 2D format "rotates" in the hud message, so I was calculing the direction I'm looking at and then add + 15 to the next ones, with that, I would show the hud like this:

v
76
15 30 NE 60 75 E 105 120 SE


So, I asked that because if i'm looking at the direction 76, the next ones will be 91, 106, 121, etc... so with the approximate value, I could change the 91 or 106 to 90 and 105, y'know?


Quote:
Originally Posted by Bugsy View Post
How about this?

This will check if iValueToCheck is >= fVariance percent of iCompareToValue.

PHP Code:
public plugin_init() 
{
    
server_print"Is 95 >= 90%% of 100? = %s" AlmostTheSame100 95 90.0 ) ? "Yes" "No" );
}

bool:AlmostTheSame( const iCompareToValue , const iValueToCheck Float:fVariance )
{
    return 
bool:( ( floatiValueToCheck ) / floatiCompareToValue ) * 100.0 ) >= fVariance );

Code:
Is 95 >= 90% of 100? = Yes

Is 88 >= 90% of 100? = No
I will roger that.


Edit:


Worked, thank you guys, specially Bugsy.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 06-21-2019 at 00:49.
EFFx is offline