Quote:
Originally Posted by Natsheh
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
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" , AlmostTheSame( 100 , 95 , 90.0 ) ? "Yes" : "No" ); }
bool:AlmostTheSame( const iCompareToValue , const iValueToCheck , Float:fVariance ) { return bool:( ( float( iValueToCheck ) / float( iCompareToValue ) * 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.
__________________