Raised This Month: $ Target: $400
 0% 

Clamp


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 07-31-2008 , 09:42   Clamp
Reply With Quote #1

Hi, could you explain a bit more and give an example ?
"Clamp ensures that a variable stays within 2 threshold values"

PHP Code:
clamp(110,0,100) == 100
clamp
(9,0,10) == 
__________________

anakin_cstrike is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-31-2008 , 09:49   Re: Clamp
Reply With Quote #2

with this exemple : clamp(MyValue,0,10)

If 'MyValue' < 0, it will return 0.

If 'MyValue' > 10, it will return 10

Otherwise, it will return 'MyValue'.
__________________
Arkshine is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-31-2008 , 10:42   Re: Clamp
Reply With Quote #3

Think of it as only allowing a number returned to be within the two values (min,max) entered. If the number entered exceeds the min or max, the relative min or max value is returned.

clamp( your number, min allowed , max allowed )

clamp( -55 , 0 , 10 ) = 0
clamp( 34 , 0 , 25 ) = 25
__________________
Bugsy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-31-2008 , 10:45   Re: Clamp
Reply With Quote #4

As additional infos , all is written here : clamp()

Also, for float, use : floatclamp()
__________________
Arkshine is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 07-31-2008 , 11:02   Re: Clamp
Reply With Quote #5

Thanks, i understand now
__________________

anakin_cstrike 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 05:37.


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