Results 1 to 7 of 7
  1. #1
    LightzOut's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Posts
    185
    Reputation
    11
    Thanks
    25

    [Release] Wait Class

    I originally coded this in Java, but i recoded it in C++ to use on gellin's base to recreate the font without causing lag.

    So basically what this code does is it cause's the execution of certain code to be delayed, like the Sleep() function, but it doesn't cause the whole thread to pause, therefore there is no lag. It just takes the current system times, waits the ammount specified, and then lets execution of the method continue.

    This code IS c/p friendly.


    If your using this more generally (like not in gellin's base) then use this example.
    EXAMPLE 1
    Wait.h
    Code:
    #include <time.h>
    
    class cWait{
    	public:
    
    	void wait(int waittime);
    	void startWait();
    	bool isWait();
    };
    
    extern class cWait Wait;
    Wait.cpp
    Code:
    #include "Wait.h"
    
    long waitin;
    long t0, t1;
    
    void cWait::wait(int waittime){
    	waitin = waittime;
    }
    
    void cWait::startWait(){
    	t0 = time(NULL) * 1000;
    }
    
    bool cWait::isWait(){
    	t1 = time(NULL) * 1000;
    	return (t1 - t0) < waitin;
    }

    If your using this class with gellin's base, then use this example.
    EXAMPLE 2
    Wait.h
    Code:
    #include <time.h>
    
    class cWait{
    	public:
    
    	void startWait();
    	bool isWait();
    };
    
    extern class cWait Wait;
    Wait.cpp
    Code:
    #include "Wait.h"
    
    long waitin = 20000;
    long t0, t1;
    
    void cWait::startWait(){
    	t0 = time(NULL) * 1000;
    }
    
    bool cWait::isWait(){
    	t1 = time(NULL) * 1000;
    	return (t1 - t0) < waitin;
    }

    Then to add this to your RenderFrame.
    Use (In Gellin's base)
    Code:
    if(!Wait.isWait()){
    	this->UpdateFont(pDevice);
    	Wait.startWait();
    }

    If you don't understand this code, or think it's worthless, let me know. Just trying to help lol.

  2. The Following 2 Users Say Thank You to LightzOut For This Useful Post:

    speedforyou (08-20-2010),xxxPROFINITYxxx (08-17-2010)

  3. #2
    ipwnuuaal5's Avatar
    Join Date
    Mar 2010
    Gender
    male
    Posts
    275
    Reputation
    16
    Thanks
    33
    So this will activate the code even if I have sleep functions in the same thread?

  4. #3
    Mr.Magicman's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Sitting in my cave full of thoughts learning Asembly
    Posts
    2,102
    Reputation
    16
    Thanks
    649
    My Mood
    Cold
    Why would you need a sleep class??

  5. #4
    mmbob's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    ja
    Posts
    653
    Reputation
    70
    Thanks
    1,157
    My Mood
    Bitchy
    Do you know what the point of a class is? So that you can have multiple instances of the same thing. You should make waitin, t0, and t1 members of the class.

  6. #5
    Mr.Magicman's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Sitting in my cave full of thoughts learning Asembly
    Posts
    2,102
    Reputation
    16
    Thanks
    649
    My Mood
    Cold
    Quote Originally Posted by mmbob View Post
    Do you know what the point of a class is? So that you can have multiple instances of the same thing. You should make waitin, t0, and t1 members of the class.
    Oh thanks i was to sleepy at my time of post

  7. #6
    Finish's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Posts
    126
    Reputation
    11
    Thanks
    6
    My Mood
    Happy
    Quote Originally Posted by mmbob View Post
    Do you know what the point of a class is? So that you can have multiple instances of the same thing. You should make waitin, t0, and t1 members of the class.
    yea i was thinkin the same thing.

    if u have t0 and t1 outside like that. no matter how much u classes u make it will always be the same.

    same thing for waittime
    You may add me as
    finish101@hotmail.com

  8. #7
    LightzOut's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Posts
    185
    Reputation
    11
    Thanks
    25
    Quote Originally Posted by Finish View Post
    yea i was thinkin the same thing.

    if u have t0 and t1 outside like that. no matter how much u classes u make it will always be the same.

    same thing for waittime
    Ya I realized that after I posted it. To lazy to update. It works fine if your using only one instance of it like in gellin's base. If you want to recode it go for it, that is the point of sharing. Java's classes are a bit different than C++'s so I wasn't exactly sure how to do it.

Similar Threads

  1. [RELEASE] No class change!
    By master131 in forum Call of Duty Modern Warfare 2 Server / GSC Modding
    Replies: 3
    Last Post: 09-19-2010, 10:42 AM
  2. [Release]Rainbow Crosshair Class
    By falzarex in forum C++/C Programming
    Replies: 0
    Last Post: 12-14-2009, 05:47 PM
  3. Replies: 12
    Last Post: 12-10-2009, 02:35 PM
  4. [Request] LIVE UPDATE WAITING FOR NEW CROSSFIRE HACK[Release] Crossfire Hack working at 07/12/2
    By [MPG]aRrAiZe in forum CrossFire Hacks & Cheats
    Replies: 15
    Last Post: 12-07-2009, 03:07 PM
  5. i release the hack! waiting cubezen so long!
    By spectre1991 in forum Blackshot Hacks & Cheats
    Replies: 31
    Last Post: 07-30-2009, 06:50 AM