I use a C++\CLR project in visual studio 2017. At the time i try to manipulate the memory so i create a hack for a no name game and try to manipulate the game. In advance i want to apologize for my bad englisch.
My Problem is that i try to create a random integer and for that i use the function rand() in combination with firstSetRand srand().
using namespace System;
int * randomName()
{
srand((unsigned)time(0));
int i = 1;
static int name[5];
for (int i = 1; i < 5; i++)
{
name[i] = 97 + rand() % 122;
}
std::cout << name << std::endl;
return name;
}
this is my function for the random counts and here i call it:
int main(array<System::String ^> ^args)
{
while (true)
{
switch (inputCheat) //check which case match with the user input
{
case 4:
Console::WriteLine("test: ");
random:: randomName(firstSetRand);
//WriteProcessMemory(handle, (LPVOID)localName, &inputNumber, sizeof(), NULL); //Write to the local adress memory and change the value
Console::WriteLine("\nWhat did you want to cheat up: ");
break;
}
}
Sleep(200);
}
The Problem is because that´s a while(true) loop and i call the function mutipel times. And i dont know how to make that srand() function is only callt once time i get alwys the same random number.
I am new to C++ so pls apologizes ignorance. I am coming from java. In java i would do the whole code in a class and than i would write the variable in the constructor but i think thats not possibel in C++. Because when i do the whole code in a class i get the error:
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ) AssaultCubeHack C:\Users\schup\source\repos\AssaultCubeHack\AssaultCubeHack\MSVCRTD.lib(exe_main.obj) 1
So i´am helpless i hope somebody can help me. And i want to say thanks in advance.
Aucun commentaire:
Enregistrer un commentaire