Results 1 to 5 of 5
  1. #1
    Xray Hunter's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    37
    Reputation
    10
    Thanks
    0
    My Mood
    Angelic

    How to find the highest value

    How can I find the highest value of 3 items?
    Like:

    WeaponVote1 = 2;
    WeaponVote2 = 0;
    WeaponVote3 = 1;
    How can I find who is the highest easiest?

  2. #2
    master131's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    8,802
    Reputation
    3165
    Thanks
    73,325
    My Mood
    Breezy
    Use an array like this:
    Code:
    something()
    {
        weaponVote = [];
        weaponVote[0] = 2;
        weaponVote[1] = 0;
        weaponVote[2] = 1;
        highest = getHighest(weaponVote); //This will make highest equal to 2
    }
    
    getHighest(array)
    {
        highest = array[0];
        for(i = 0; i < array.size; i++)
            if(array[i] > highest)
                highest = array[i];
        return highest;
    }
    Donate:
    BTC: 1GEny3y5tsYfw8E8A45upK6PKVAEcUDNv9


    Handy Tools/Hacks:
    Extreme Injector v3.6.1 *NEW* Windows 10 compatible!
    A powerful and advanced injector in a simple GUI.
    Can scramble DLLs on injection making them harder to detect and even make detected hacks work again!

    Minion Since: 13th January 2011
    Moderator Since: 6th May 2011
    Global Moderator Since: 29th April 2012
    Super User/Unknown Since: 23rd July 2013
    'Game Hacking' Team Since: 30th July 2013

    --My Art--
    [Roxas - Pixel Art, WIP]
    [Natsu - Drawn]
    [Natsu - Coloured]


    All drawings are coloured using Photoshop.

    --Gifts--
    [Kyle]

  3. The Following User Says Thank You to master131 For This Useful Post:

    Xray Hunter (09-27-2011)

  4. #3
    dsds1's Avatar
    Join Date
    Aug 2011
    Gender
    male
    Posts
    63
    Reputation
    10
    Thanks
    2
    My Mood
    Fine
    Quote Originally Posted by master131 View Post
    Use an array like this:
    Code:
    something()
    {
        weaponVote = [];
        weaponVote[0] = 2;
        weaponVote[1] = 0;
        weaponVote[2] = 1;
        highest = getHighest(weaponVote); //This will make highest equal to 2
    }
    
    getHighest(array)
    {
        highest = array[0];
        for(i = 0; i < array.size; i++)
            if(array[i] > highest)
                highest = array[i];
        return highest;
    }
    I don't think that this will work for all three, try the calling function
    Code:
    getHighest(array)
    { 
      highest = array[0]; 
      highest2 = array[2];
        for(i = 0; i < array.size; i++)
            if(array[i] > highest)
                highest = array[i]; 
             else if(array[i] > highest2) 
            array[i] = highest; 
           else  
         array[i] = highest;
        return highest;
    }
    Last edited by dsds1; 09-29-2011 at 01:02 PM.
    Press thanks if I helped you
    my English grammar not good

  5. #4
    Xray Hunter's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Posts
    37
    Reputation
    10
    Thanks
    0
    My Mood
    Angelic
    Quote Originally Posted by dsds1 View Post
    I don't think that this will work for all three, try the calling function
    Code:
    getHighest(array)
    {
        for(i = 0; i < array.size; i++)
            if(array[i] > highest)
                highest = array[i];
        return highest;
    }
    lol you just have to delete highest = array[0]
    But I understand what he means

  6. #5
    master131's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    8,802
    Reputation
    3165
    Thanks
    73,325
    My Mood
    Breezy
    It WILL work, trust me. It would still work even if the 0th item was not the highest.
    Donate:
    BTC: 1GEny3y5tsYfw8E8A45upK6PKVAEcUDNv9


    Handy Tools/Hacks:
    Extreme Injector v3.6.1 *NEW* Windows 10 compatible!
    A powerful and advanced injector in a simple GUI.
    Can scramble DLLs on injection making them harder to detect and even make detected hacks work again!

    Minion Since: 13th January 2011
    Moderator Since: 6th May 2011
    Global Moderator Since: 29th April 2012
    Super User/Unknown Since: 23rd July 2013
    'Game Hacking' Team Since: 30th July 2013

    --My Art--
    [Roxas - Pixel Art, WIP]
    [Natsu - Drawn]
    [Natsu - Coloured]


    All drawings are coloured using Photoshop.

    --Gifts--
    [Kyle]

Similar Threads

  1. How to find the push to console addy
    By boboben1 in forum Combat Arms Help
    Replies: 5
    Last Post: 07-28-2010, 03:04 PM
  2. how to find the focal point
    By EpicSigMaker in forum Art & Graphic Design
    Replies: 1
    Last Post: 11-17-2009, 09:03 AM
  3. How to find the NA copy of mcapubhack.asi
    By m1aa in forum Hardware & Software Support
    Replies: 0
    Last Post: 02-22-2009, 09:34 AM
  4. Can someone explain how I find the spread address with MHS?
    By Starecase in forum Combat Arms Hacks & Cheats
    Replies: 11
    Last Post: 10-06-2008, 11:56 PM
  5. How to finding the new adresses?
    By mojo007 in forum Visual Basic Programming
    Replies: 2
    Last Post: 04-10-2008, 12:34 PM