|
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
|
06-30-2020
, 20:29
Re: Native: get_user_rank
|
#28
|
Supermache, clamp is good when the input value can fall below or above a desired range.
So suppose you want to only allow values between 0 and 100, but the input value can range from -100 to 1000. Doing clamp( value , 0 , 100 ) will ensure the floor value is 0, ceiling value is 100, and if the value falls between those values, clamp returns that value.
clamp( -100 , 0 , 100 ) = 0
clamp( 0 , 0 , 100 ) = 0
clamp( 55 , 0 , 100 ) = 55
clamp( 100 , 0 , 100 ) = 100
clamp( 1000 , 0 , 100 ) = 100
__________________
Last edited by Bugsy; 06-30-2020 at 20:30.
|
|
|
|