Raised This Month: $12 Target: $400
 3% 

Functions min/max for numbers


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
stas3
Junior Member
Join Date: Jul 2011
Location: ukraine
Old 07-25-2011 , 11:37   Functions min/max for numbers
Reply With Quote #1

If I have 5 numbers: 1, 3, 5, 7, 9. How can I find the largest and smallest number?
Features min/max, as I understand, there is no.

-------------
Ok, I've found SortIntegers
__________________
My English is bad

Last edited by stas3; 07-25-2011 at 12:21.
stas3 is offline
ProdigySim
SourceMod Plugin Approver
Join Date: Feb 2010
Old 07-25-2011 , 12:17   Re: Functions min/max for numbers
Reply With Quote #2

The same way you do it normally. You remember the "smallest value," and then look through the array for smaller values. When you find a smaller value you remember it and continue comparing.
PHP Code:
stock min(const arr[], len)
{
    new 
min=arr[0];
    for(new 
i=1;i<len;i++)
        if(
arr[i] < minmin=arr[i];
    return 
min;

ProdigySim is offline
stas3
Junior Member
Join Date: Jul 2011
Location: ukraine
Old 07-25-2011 , 17:59   Re: Functions min/max for numbers
Reply With Quote #3

Ok, thank, but i have next question. If I want to give the object a name, need to do so:

PHP Code:
DispatchKeyValue(index"targetname""x_name"); 
But in developer.valvesoftware.com/wiki/ it's not "targetname", it's "Name"

I found something here:
http://wiki.alliedmods.net/CBreakabl...Counter-Strike)

Render FX (renderfx), Render Mode (rendermode) etc. But how do you know about other values? Just the names do not correspond to the fact that there developer.valvesoftware.com/wiki/, It is therefore impossible to create any effect due to the fact that different keyvalues.
__________________
My English is bad

Last edited by stas3; 07-25-2011 at 18:17.
stas3 is offline
Reply


Thread Tools
Display Modes

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 02:17.


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