Some codes that can be useful!

Posts 1–13 of 13 · Page 1 of 1
[UPDATED] lol Some codes that can be useful!
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!

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;
}
Here is another example off of a website that Music_King posted:
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: 41
Code:
RandomNumber = (int)(rand()%100);
Saying Random Number from 1 - 100.

Like For maybe chams
Code:
(A,R,G,B)
(rand()%255,rand()%255,rand()%255,rand()%255);
Something like that.

for SpeedHack... lol maybe
Code:
SpeedHackNumber = (int)(rand()%100);
Code:
if(speedhack)
{
    *(float*) Speed_Address  =  SpeedHackNumber * 5;
}
*SpeedHackNumber * 5 -> Means The random speedhacknumber multiplied by 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
Oh this code is so Pro Nubz
Quote Originally Posted by whit View Post
Oh this code is so Pro Nubz
I kno right? Proist in this whole section
hehe thanks

*Whit's Penis --> Huge
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()
Quote Originally Posted by MiNT View Post
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()
Hehe I added it for teh nubz
Quote Originally Posted by MiNT View Post
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()
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..
Quote Originally Posted by whit View Post


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
Quote Originally Posted by MiNT View Post
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ⓘ
Woe if you wanna Get cocky about it
Ya Know that Purple name dont make you Big and Bad

I know what srand is..A function that is hardly ever used, same with rand
Quote Originally Posted by whit View Post


Woe if you wanna Get cocky about it
Ya Know that Purple name dont make you Big and Bad

I know what srand is..A function that is hardly ever used, same with rand
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
Quote Originally Posted by Departure View Post
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
Oh i know he was right lol
I think he misunderstood me..
I was saying i didnt really care for a completely new set of number on start up for my spammer just as long as theres a different number for every line spammed
Actually this could be used for hook. Go search it.


D3D FPS


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;
}
to use:

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
Posts 1–13 of 13 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us