Oh this code is so Pro Nubz
These are some codes that you "might" find useful to use in your hacks!
Random Number Picking:
This can be used to pick random speeds for speedhacks / rgb colors for chams /or almost anything!
Here is another example off of a website that Music_King posted:Code:#include <windows.h> #include <stdio.h> #include <iostream> #include "time.h" using namespace std; int RandomNumber,Hotkey; int main() { srand(time(NULL)); RandomNumber = (int)(rand()%100); cout << "RandomNumber: " << RandomNumber << endl; }
Code:/* srand example */ #include <stdio.h> #include <stdlib.h> #include <time.h> int main () { printf ("First number: %d\n", rand() % 100); srand ( time(NULL) ); printf ("Random number: %d\n", rand() % 100); srand ( 1 ); printf ("Again the first number: %d\n", rand() %100); return 0; }Code:Output: First number: 41 Random number: 13 Again the first number: 41Saying Random Number from 1 - 100.Code:RandomNumber = (int)(rand()%100);
Like For maybe chams
Something like that.Code:(A,R,G,B) (rand()%255,rand()%255,rand()%255,rand()%255);
for SpeedHack... lol maybe
Code:SpeedHackNumber = (int)(rand()%100);*SpeedHackNumber * 5 -> Means The random speedhacknumber multiplied by 5.Code:if(speedhack) { *(float*) Speed_Address = SpeedHackNumber * 5; }
*Just an example
May have errors, Fix them and have fun.
Besides if this is going to be used in your hack you don't need the random project that i just wrote up
All for now.. I had more in my mind but I forgot! ok haha bye!
I'm bored and having fun Thanks and comment with your snippets hehe
Last edited by Nubzgetkillz; 03-10-2011 at 09:29 PM.
Member since September 25, 2010
Current Objectives:
- Graduate college with a degree in Computer Science
- Find a decent job in the Computer Science Field
- Learn more programming languages
Looking for Elo Boosting Job - League of Legends
Looking for Bronze -> Gold Jobs
Skype: whatthedream
Oh this code is so Pro Nubz
the numbers in ur example will not give u true random numbers,
each time u run ur program u will get the same set of numbers.
do this to fix the problem
Code://top #include "time.h" //in code srand(time(NULL)); .. .. // all of ur calls to rand()
Member since September 25, 2010
Current Objectives:
- Graduate college with a degree in Computer Science
- Find a decent job in the Computer Science Field
- Learn more programming languages
Looking for Elo Boosting Job - League of Legends
Looking for Bronze -> Gold Jobs
Skype: whatthedream
Member since September 25, 2010
Current Objectives:
- Graduate college with a degree in Computer Science
- Find a decent job in the Computer Science Field
- Learn more programming languages
Looking for Elo Boosting Job - League of Legends
Looking for Bronze -> Gold Jobs
Skype: whatthedream
Depends Really what you want the Random number for..
I would use srand() for random cham color as nubz said but i use about the same code he post for my spammer to add a ramdon number to the end of the text ingame so it dont block it out..So it dont really matter in that situation as i just need any number even if it is the same every time you run..
please dont act like you know more than me :P
cuz u dont .
srand() is for seeding the values that rand() uses to collect
srand - C++ Reference
D3D FPS
to use:Code:#include "time.h" float fFps = NULL; float fLastTickCount = NULL; float fCurrentTickCount; char cFrameRate[50] = {NULL}; char *GetFrameRate() { fCurrentTickCount = clock() * 0.001f; ++fFps; if((fCurrentTickCount - fLastTickCount) > 1.0f) { fLastTickCount = fCurrentTickCount; sprintf( cFrameRate, "[ Your FPS = %d ]", int( fFps ) ); fFps = 0; } return cFrameRate; }
Code:Directx.DrawString(10, 2, D3DCOLOR_XRGB( 255, 255, 0 ), Directx.pFont, GetFrameRate());
EDIT: Credits to someone.. i think ac1d_burn?
another note,
only seed rand() 1 time or u will start getting the same numbers u got again
Actually he's right, but its only needed to be called on initialization, Its same as "Randomize" in delphi.. its creates the seed which is then used by "Random" functions. And its always used with random(should be always used anyway) otherwise as he said, random will not be so random if you don't use it.
//Edit
didn't see post above, but yeah call it only once on initialization
Last edited by Departure; 03-10-2011 at 07:04 PM.