😠 Timer

Posts 1–15 of 20 · Page 1 of 2
😠 Timer
How would I make a timer that would Write an Integer for unlimited ammo every 1 second?

Sorry if im asking im still a little noobies at coding btw this is c# im talking about.
while(1)
{
Sleep(1000);
// Do shit..
}

jesus .. 1 sec? its consumes too much processing. For ammo, put every 1 minut (still too much but ok).
Quote Originally Posted by hmrneves View Post
jesus .. 1 sec? its consumes too much processing. For ammo, put every 1 minut (still too much but ok).
This is soon 2013. Not 1998 or so
If your PC have problems with that, well.
Don't play the game


(Use a Timer in the ToolBox, it won't make your program that "laggy")
Quote Originally Posted by Jorndel View Post


This is soon 2013. Not 1998 or so
If your PC have problems with that, well.
Don't play the game


(Use a Timer in the ToolBox, it won't make your program that "laggy")
Or use a background worker .
With a background worker everything in run in a separate thread, and can show progress.
Worse case, just manually run it on a separate thread. For this though, a timer is ok.
Quote Originally Posted by rileyjstrickland View Post
Or use a background worker .
With a background worker everything in run in a separate thread, and can show progress.
Worse case, just manually run it on a separate thread. For this though, a timer is ok.
Well, that is if you don't want to stop the current process and apply new values to it

Anywayz, I suppose it's a better way to do the timer tho
(I won't say to much but, I think there is a way to just nop the Ammo function, via Memory. NOT sure!!!)
Quote Originally Posted by Jorndel View Post
Well, that is if you don't want to stop the current process and apply new values to it

Anywayz, I suppose it's a better way to do the timer tho
(I won't say to much but, I think there is a way to just nop the Ammo function, via Memory. NOT sure!!!)
Ah, but that is where you are wrong my good sir! A Background worker supports canceling the current action (which would allow you to run it again with new values)
[MPGH]Jorndel hahaha, I know that the computers nowadays has MUCH processing power. But, things like that confuse me.

Why we wrote lines of code that will consumes unnecessary processing while we can spend that power in the game? everything counts to delivery a good performance.

In this case, 1 second is an absurd lol


But, keep in mind, its only a opinion from a mortal guy
Quote Originally Posted by hmrneves View Post
[MPGH]Jorndel hahaha, I know that the computers nowadays has MUCH processing power. But, things like that confuse me.

Why we wrote lines of code that will consumes unnecessary processing while we can spend that power in the game? everything counts to delivery a good performance.

In this case, 1 second is an absurd lol


But, keep in mind, its only a opinion from a mortal guy
My Dream Hack has 18 timers all with a delay of 100-200 ms.
Noone is complaining over here
But ontopic :
Toolbox
Drag timer to project
properties
enable it
double click the icon of the added timer
you should be brought to your Form1.cs
start adding things to the freshly added code
Quote Originally Posted by hmrneves View Post
its only a opinion from a mortal guy
We all are.
Well, for all I would say then.
Go C++, do ASM. and increase ammo or just ignore it
Quote Originally Posted by Horror View Post
My Dream Hack has 18 timers all with a delay of 100-200 ms.
Well, I can complain
Because 1-3 timers can most of the times do the job for 18 times without any problems at all.
Instead of taking all cores of the CPU with 18 Timers
Quote Originally Posted by Jorndel View Post
Well, I can complain
Because 1-3 timers can most of the times do the job for 18 times without any problems at all.
Instead of taking all cores of the CPU with 18 Timers
Blablabla
Quote Originally Posted by Jorndel View Post
(I won't say to much but, I think there is a way to just nop the Ammo function, via Memory. NOT sure!!!)
For beginners, just writing 9999999 to it once will do the trick
Quote Originally Posted by Horror View Post
For beginners, just writing 9999999 to it once will do the trick
I think that has been fixed in some of the values, Timers do not cause much of a problem because although there may be 18 in the program my guess is only about 4 are running at any one time.

I use a timer for force host, 1 for ammo, 1 for health. everybody has a different way of doing it and it depends how the foundation is set in the first place.

but getting the timer to check a value seems to be my prefered way i.e.
Code:
if p1ammo = 1 then
     do stuff
end if
very basic and long winded but it does save on timers.
C# pseudo code

Code:
volatile bool isRunning = true;
Thread t;

void StartWriting()
{
    isRunning = true;
    t = new Thread(() =>
        {
            while(isRunning)
            {
                // Write to memory here
                Thread.Sleep(1000); // Sleep thread for 1 second (1000 milliseconds)
            }
        });
    t.Start();
}

void StopWriting()
{
    isRunning = false;
    t.Join();
}
You should create a wrapper class for this
Posts 1–15 of 20 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us