Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Tutorial] Random Process

Initiate Mage
Joined
Jul 30, 2017
Messages
4
Reaction score
9
RSUpdate
Search
Code:
void startGame(const char* param)

Add Below
Code:
static const char alphanum[] = "abcdefghijklmnopqrstuvwxyz"int stringLength0111 = sizeof(alphanum) - 1;char genRandom011(){   return alphanum[rand() % stringLength0111];}

Search
Code:
char GAME_START_PARAM[2048];

Add Below
Code:
srand(time(0));    std::string Str, lastname, newname;    const char * LASTNAME, * NEWNAME;    for(unsigned int i = 0; i < 10; ++i)    {    Str += genRandom011();    }    lastname = "[B][COLOR=#ff0000]MyGame.exe[/COLOR][/B]";    newname = Str + ".exe";    LASTNAME = lastname.c_str();    NEWNAME = newname.c_str();    rename(LASTNAME, NEWNAME);

Search
Code:
// we don't need to elevate permission here

Look
Code:
int err = (int)ShellExecute(NULL,
To put this over
int err = (int)ShellExecute(NULL, "open", NEWNAME, GAME_START_PARAM, NULL, SW_SHOW);
 
Junior Spellweaver
Joined
Jan 5, 2015
Messages
173
Reaction score
194
Honestly , not working much on warz these days but what is the point ?.

With findfindow and tons of other methods bypass that ( actually you can just put exes name when game is open )
 
Joined
Apr 12, 2013
Messages
544
Reaction score
272
Well well... as this was kinda helpfull for me, to not waste alot of time, here is a updated & working version.

Have Fun guys. :p

PHP:
Search for:

startGame(const CUpdater& updater)

Add above
 
void gen_random(char *s, const int len) {
	static const char alphanum[] =
		"0123456789"
		"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
		"abcdefghijklmnopqrstuvwxyz";
 
	for (int i = 0; i < len; ++i) {
		s[i] = alphanum[rand() % (sizeof(alphanum) - 1)];
	}
 
	s[len] = 0;
}
 
static const char alphanum[] = "abcdefghijklmnopqrstuvwxyz";
int stringLength = sizeof(alphanum) - 1; char gen_random() { return alphanum[rand() % stringLength]; }
 
Search for

char GAME_START_PARAM[2048];
 
add below

srand(time(0));    std::string Str, lastname, newname;    const char * LASTNAME, *NEWNAME;    for (unsigned int i = 0; i < 10; ++i)    { Str += gen_random(); }    lastname = "MiniA.exe";    newname = Str + ".exe";    LASTNAME = lastname.c_str();    NEWNAME = newname.c_str();    rename(LASTNAME, NEWNAME);
 
Search for

int err = (int)ShellExecute(NULL, "open", GAME_EXE_NAME, GAME_START_PARAM, NULL, SW_SHOW);
 
Replace with;
 
int err = (int)ShellExecute(NULL, "open", NEWNAME, GAME_START_PARAM, NULL, SW_SHOW);


@MentaL, serious, fix ur text editor. Everything is totaly fucked up after press "Edit"...
 
Last edited:
Joined
Nov 14, 2001
Messages
29,437
Reaction score
21,651
Well well... as this was kinda helpfull for me, to not waste alot of time, here is a updated & working version.

Have Fun guys. :p



@MentaL, serious, fix ur text editor. Everything is totaly fucked up after press "Edit"...

The joys of chrome, try editing your local editor on the control panel options.
 
Joined
Apr 12, 2013
Messages
544
Reaction score
272
Testing Standard Editor now.

Random Code for testing...
PHP:
// compile time assert
#ifdef __cplusplus
#define JOIN( X, Y ) JOIN2(X,Y)
#define JOIN2( X, Y ) X##Y
namespace assert_static
{
	template <bool> struct STATIC_ASSERT_FAILURE;
	template <> struct STATIC_ASSERT_FAILURE<true> { enum { value = 1 }; };

	template<int x> struct static_assert_test{};
}
#define COMPILE_ASSERT(x) \
    typedef ::assert_static::static_assert_test<\
    sizeof(::assert_static::STATIC_ASSERT_FAILURE< (bool)( x ) >)>\
    JOIN(_static_assert_typedef, __LINE__)
#else // __cplusplus
#define COMPILE_ASSERT(x) extern int __dummy[(int)x]
#endif // __cplusplus
#define VERIFY_EXPLICIT_CAST(from, to) COMPILE_ASSERT(sizeof(from) == sizeof(to))

Yep. That seems fine. Sorry for the harsh comment. :)
 
Back
Top