Results 1 to 7 of 7
  1. #1
    Adsvunu's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    search on google
    Posts
    78
    Reputation
    10
    Thanks
    33
    My Mood
    Cheerful

    Help with GetTickCount

    i know thats c# but it uses a api from c++ which is GetTickCount
    Code:
    class AW
        {
            [DllImport("kernel32.dll")]
            static extern int GetTickCount();
            static void Main()
            {
                int timer;
    
                int interval = 20;
    
                int start = GetTickCount();
            
                for (timer = 0; timer < 5000; timer += interval)
                 {
                     Console.WriteLine("sum1337text");
                     Thread.Sleep(interval);
    
                 }
                
                int end = GetTickCount();
                
                
    
            }
    so i didnt got it how this gettickcount works can someone show me how i can replace the sleep with it?

  2. #2
    Hell_Demon's Avatar
    Join Date
    Mar 2008
    Gender
    male
    Location
    I love causing havoc
    Posts
    3,976
    Reputation
    343
    Thanks
    4,320
    My Mood
    Cheeky
    GetTickCount

    "Retrieves the number of milliseconds that have elapsed since the system was started, up to 49.7 days"

    So it's quite simple;
    Code:
    int tickStart = GetTickCount(); // Right now.
    int tickEnd = tickStart + 5000; // 5 seconds into the future
    
    while(GetTickCount() < tickEnd)
    {
        // Do nothing, although it's better to Sleep(0) in here to not waste CPU time.
    }
    
    MessageBox.Show("Hurraiiii, 5 seconds have passed.");
    Ah we-a blaze the fyah, make it bun dem!

  3. #3
    Gill Bates's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Location
    /online
    Posts
    1,135
    Reputation
    188
    Thanks
    247
    Quote Originally Posted by Adsvunu View Post
    i know thats c# but it uses a api from c++ which is GetTickCount
    Code:
    class AW
        {
            [DllImport("kernel32.dll")]
            static extern int GetTickCount();
            static void Main()
            {
                int timer;
    
                int interval = 20;
    
                int start = GetTickCount();
            
                for (timer = 0; timer < 5000; timer += interval)
                 {
                     Console.WriteLine("sum1337text");
                     Thread.Sleep(interval);
    
                 }
                
                int end = GetTickCount();
                
                
    
            }
    so i didnt got it how this gettickcount works can someone show me how i can replace the sleep with it?
    Overall, GetTickCount is used to count how many milliseconds have passed since the system was started. What Hell_Demon did for you is clean up your code.

    First , he declared 2 variables: tickStart and tickEnd.
    -Basically, a point where the timer starts and ends.
    -He set the timer to 5 seconds (5000 milliseconds).

    Second, he made a very simple statement: "Do the following if it has been less than 5 seconds." 'while(GetTickCount() < tickEnd)'
    -Once the 5 seconds are reached, end the timer (tickEnd) and display a message (MessageBox.Show("Hurraiiii, 5 seconds have passed."))

    Your code was a bit messy because you added an unnecessary timer (GetTickCount already calculates the time for you) and had an overall logical error.
    Also (I am not 100% sure), 'int end = GetTickCount();' will cause an unintended (I am assuming you did not want this to happen) loop/error, since you are telling the computer to calculate the time once again.

  4. #4
    Adsvunu's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    search on google
    Posts
    78
    Reputation
    10
    Thanks
    33
    My Mood
    Cheerful
    Quote Originally Posted by Gill Bates View Post
    Overall, GetTickCount is used to count how many milliseconds have passed since the system was started. What Hell_Demon did for you is clean up your code.

    First , he declared 2 variables: tickStart and tickEnd.
    -Basically, a point where the timer starts and ends.
    -He set the timer to 5 seconds (5000 milliseconds).

    Second, he made a very simple statement: "Do the following if it has been less than 5 seconds." 'while(GetTickCount() < tickEnd)'
    -Once the 5 seconds are reached, end the timer (tickEnd) and display a message (MessageBox.Show("Hurraiiii, 5 seconds have passed."))

    Your code was a bit messy because you added an unnecessary timer (GetTickCount already calculates the time for you) and had an overall logical error.
    Also (I am not 100% sure), 'int end = GetTickCount();' will cause an unintended (I am assuming you did not want this to happen) loop/error, since you are telling the computer to calculate the time once again.
    I got it but seems that doesnt worth using it in c# since its slower than sleep, but in c++ its fine

  5. The Following User Says Thank You to Adsvunu For This Useful Post:

    Gill Bates (05-19-2017)

  6. #5
    Zaczero's Avatar
    Join Date
    Oct 2013
    Gender
    male
    Location
    localhost
    Posts
    3,288
    Reputation
    1517
    Thanks
    14,262
    My Mood
    Angelic
    Or simply use Environment.TickCount
    . . . malsignature.com . . .



    [ global rules ] [ scam report ] [ image title ] [ name change ] [ anime force ]
    [ league of legends marketplace rules ] [ battlefield marketplace rules ]

    "because everytime you post a picture of anime in here
    your virginity's time increases by 1 month"
    ~Smoke 2/18/2018


    Former Staff 09-29-2018
    Battlefield Minion 07-21-2018
    Premium Seller 03-04-2018
    Publicist 12-10-2017
    League of Legends Minion 05-31-2017
    Premium 02-05-2017
    Member 10-13-2013

  7. The Following User Says Thank You to Zaczero For This Useful Post:

    Gill Bates (05-19-2017)

  8. #6
    Silent's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    5,070
    Reputation
    2172
    Thanks
    8,474
    My Mood
    Bitchy
    Quote Originally Posted by Zaczero View Post
    Or simply use Environment.TickCount
    which is pretty much the same as

    Code:
    static int TickCount
    {
        get
        {
            return GetTickCount();
        }
    }
    Click Here to visit the official MPGH wiki! Keep up with the latest news and information on games and MPGH! To check out pages dedicated to games, see the links below!











    dd/mm/yyyy
    Member - 31/01/2015
    Premium - 12/09/2016
    Call of Duty minion - 05/11/2016 - 05/11/2019
    BattleOn minion - 28/02/2017 - 05/11/2019
    Battlefield minion - 30/05/2017 - 05/11/2019
    Other Semi-Popular First Person Shooter Hacks minion - 21/09/2017 - 17/09/2019
    Publicist - 07/11/2017 - 02/08/2018
    Cock Sucker - 01/12/2017 - Unknown
    Minion+ - 06/03/2018 - 05/11/2019
    Fortnite minion - 08/05/2018 - 05/11/2019
    Head Publicist - 08/10/2018 - 10/01/2020
    Developer Team - 26/10/2019 - 10/01/2020
    Former Staff - 10/01/2020



  9. The Following User Says Thank You to Silent For This Useful Post:

    Gill Bates (05-19-2017)

  10. #7
    Zaczero's Avatar
    Join Date
    Oct 2013
    Gender
    male
    Location
    localhost
    Posts
    3,288
    Reputation
    1517
    Thanks
    14,262
    My Mood
    Angelic
    Quote Originally Posted by Rob's Baby View Post


    which is pretty much the same as

    Code:
    static int TickCount
    {
        get
        {
            return GetTickCount();
        }
    }
    "simply use"
    . . . malsignature.com . . .



    [ global rules ] [ scam report ] [ image title ] [ name change ] [ anime force ]
    [ league of legends marketplace rules ] [ battlefield marketplace rules ]

    "because everytime you post a picture of anime in here
    your virginity's time increases by 1 month"
    ~Smoke 2/18/2018


    Former Staff 09-29-2018
    Battlefield Minion 07-21-2018
    Premium Seller 03-04-2018
    Publicist 12-10-2017
    League of Legends Minion 05-31-2017
    Premium 02-05-2017
    Member 10-13-2013

Similar Threads

  1. [Help Request] Need help with numpad while recording macro !
    By JonathanTBM in forum Vindictus Help
    Replies: 2
    Last Post: 05-10-2011, 07:37 PM
  2. [Help Request] help with ca hacks
    By moises8 in forum Combat Arms Help
    Replies: 4
    Last Post: 05-10-2011, 05:55 PM
  3. [Help Request] Anyone can help with this ?
    By devileyebg in forum Vindictus Help
    Replies: 1
    Last Post: 05-01-2011, 03:57 PM
  4. [Help Request] need help with mod
    By .:MUS1CFR34K:. in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 4
    Last Post: 05-01-2011, 12:40 PM
  5. [Help Request] need help with modding
    By BayBee Alyn in forum Combat Arms Help
    Replies: 0
    Last Post: 04-27-2011, 09:06 PM