while(1)
{
Sleep(1000);
// Do shit..
}
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.
Last edited by gayguy911; 12-30-2012 at 02:02 PM.
while(1)
{
Sleep(1000);
// Do shit..
}
Jorndel (12-30-2012)
jesus .. 1 sec? its consumes too much processing. For ammo, put every 1 minut (still too much but ok).
[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
Last edited by Horror; 12-31-2012 at 01:55 AM.
If You Like My Releases, Hit The Thanks button!
Follow the rules.
Successful Purchases: 2
Successful Sales: 1@The403
@sundy42
Scammed: 1@wZ. Gali
Favorite Quotes:
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.
very basic and long winded but it does save on timers.Code:if p1ammo = 1 then do stuff end if
Last edited by gteuk; 01-01-2013 at 06:45 AM.
C# pseudo code
You should create a wrapper class for thisCode: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(); }
Last edited by MaxSvett; 01-01-2013 at 11:46 AM.
If You Like My Releases, Hit The Thanks button!
Follow the rules.
Successful Purchases: 2
Successful Sales: 1@The403
@sundy42
Scammed: 1@wZ. Gali
Favorite Quotes: