Quick Question..

Posts 115 of 20 · Page 1 of 2
Quick Question..
Why is it, from most of the released bases I've looked at, you use C++... but you don't use C++s features?

Most of the bases looked like hacked up C that got ran over by a mack truck =/

For instance, this base... this guy didn't even use booleans:

Code:
	if( f1 == 1 ){
		pRunConsoleCommand("SkelModelStencil 1" );
	}
	if( f1 == 0 ){
		pRunConsoleCommand("SkelModelStencil 0" );
	}
	if( f2 == 1 ){
		pRunConsoleCommand("ScreenGlowEnable 1" );
	}
	if( f2 == 0 ){
		pRunConsoleCommand("ScreenGlowEnable 0" );
	}
Which, yea, I know in C++ a bool is pretty much the same thing as a short type, but still.. Them using DWORDs for booleans caused nasty checks like this:

Code:
			switch(MenuSelection){
			case 0:
				f1--;
				if(f1 < 0){
					f1 = 0;
				}
				break;
			case 1:
				f2--;
				if(f2 < 0){
					f2 = 0;
				}
				break;
When obviously, it would've been much easier (Hell, even much cleaner) to do it like this:

Code:
bool menu_array[MAX_NUM_MENUS]; // Too tired to come up with a nice name for it

if(Menu && ((GetAsyncKeyState(VK_LEFT)&1))){
        menu_array[MenuSelection] = !menu_array[MenuSelection];
}
Not only that, but also if you look in the above you'll notice how they're using the short-circuit operator (&& it's called this because if the first condition isn't true, it will just leave the if statement completely)

Anyway, this user does MULTIPLE checks for Menu for no reason at all...

Stripped down dirty example of the source:

Code:
if(menu && ...) {}
if(menu && ...) {}
if(menu && ...) {}
if(menu && ...) {}
Actually, some of it even has a check DIRECTLY AFTER that if statement, checking if the menu is opened AGAIN.

To make that look a lot nicer, you could just do:

Code:
if(menu)
{
    if(...) {}
    if(...) {}
}
Also note, I saw this a lot as well:

Code:
if(f1 == 1) { }
if(f1 == 0) { }
Since it's not possible for f1 to be 1 AND 0, that's using useless instructions for no reason whatsoever... Just do this:

Code:
if(f1) {}
else {}
(Since actually, even in C, doing == 1 is redundant; in C and C++ 0 is false and anything that's not 0 is true.)

Another thing in this source is this:

Code:
//Hack Variables
int f1 = 0;
int f2 = 0;
int f3 = 0;
int f4 = 0;
int f5 = 0;
int f6 = 0;
int f7 = 0;
int f8 = 0;
int f9 = 0;
int f10 = 0;
int f11 = 0;
int f12 = 0;
int f13 = 0;
int f14 = 0;
That's global variables... and it looks REALLY messy if I may say so myself. Do you not agree this is much nicer?

Code:
bool menu_array[14];
Maybe I'm just super picky...

Sorry about this, I guess you say rant? But it just kinda irritates me when I look around the forums and I see people asking questions such as "How can I find the LTClient" or something of the sort and I see a reply of "GO LEARN C++!" (Which may I add won't even help them in that journey any at all aside from when they make their first base; a better suggestion would be to tell them how to learn ASM and to use Olly/IDA which is a completely different different subject) when it seems like you don't know C++ yourself =/


NOTE: I'm not saying no one here knows C++, I'm sure many of you do and I'm sure many of you know it far better than me. I'm just giving a lesson-in-disguise I guess, showing people the light.

NOTE 2: Some of you may know which source this is mainly pointing out (This is _ONLY_ because I have it opened at this moment looking through it, not because it's any worse than the others), anyway, if you do know who's it is please don't mention their names.
Thats more than a question
Quote Originally Posted by whit+ View Post
Thats more than a question
Yea, I got really carried away.

Also:

If this is in the wrong category, please move it; and if this is too insulting or w/e you can delete it.
people really get used to public bases...they forget about basic stuff
Quote Originally Posted by GodHack2 View Post
people really get used to public bases...they forget about basic stuff
Haha, I guess. I made the base I'm using myself, granted a lot of the hacking-related stuff I've learned (towards CA anyway) I've learned from this site. So, props to you guys for that =)

One thing I can also say, is unlike a lot of the people posting around here that I've seen I actually try to find stuff before I ask. I'm not the type to just come out and start yelling "HALP HAO I FIND LT CLIENT!?!?!"... I actually used google to discover how to find it, a long with several other addresses.
Quote Originally Posted by Apoc91 View Post
Haha, I guess. I made the base I'm using myself, granted a lot of the hacking-related stuff I've learned (towards CA anyway) I've learned from this site. So, props to you guys for that =)

One thing I can also say, is unlike a lot of the people posting around here that I've seen I actually try to find stuff before I ask. I'm not the type to just come out and start yelling "HALP HAO I FIND LT CLIENT!?!?!"... I actually used google to discover how to find it, a long with several other addresses.
updating addresses isn't that hard
the real challenge is to get new features to add to your hack
Quote Originally Posted by GodHack2 View Post
updating addresses isn't that hard
the real challenge is to get new features to add to your hack
Haha agreed, but we all have to start somewhere, right? And updating addresses is DEFINATELY the basis of it all. =)
You make a really good point Apoc91, I was thinking similar when I started to download and look through some of the bases here, I dont even write in C++ language but I can some times translate whats going on into Delphi.. And what surprises me the most is people say they made a hook but yet ask questions about about Hotkeys and yes I found it strange they are using C type style instead of a using boolean. I have a feeling maybe alot of people have learnt C++ in this forum and thus picked up some bad coding style from others...

But saying that there have been some very helpful people here that has helped me to convert some C++ code to Delphi by explaining how it works, So I can say they atleast know what they are talking about, Just some topics clearly shows when someone is copying and pasting.. Once again nothing wrong with that, I guess thats there method to learning the language hopefully they ween them self of the milk bottle and use the C++ language how it was meant to be used.

I thnk some one needs to explain the case stament (switch statement in C++) because alot of if then... is being used and from what I understand is alot slower than switch statment(I could be wrong, but this is the case(pun intended) with Delphi)
Quote Originally Posted by Departure View Post
You make a really good point Apoc91, I was thinking similar when I started to download and look through some of the bases here, I dont even write in C++ language but I can some times translate whats going on into Delphi.. And what surprises me the most is people say they made a hook but yet ask questions about about Hotkeys and yes I found it strange they are using C type style instead of a using boolean. I have a feeling maybe alot of people have learnt C++ in this forum and thus picked up some bad coding style from others...

But saying that there have been some very helpful people here that has helped me to convert some C++ code to Delphi by explaining how it works, So I can say they atleast know what they are talking about, Just some topics clearly shows when someone is copying and pasting.. Once again nothing wrong with that, I guess thats there method to learning the language hopefully they ween them self of the milk bottle and use the C++ language how it was meant to be used.

I thnk some one needs to explain the case stament (switch statement in C++) because alot of if then... is being used and from what I understand is alot slower than switch statment(I could be wrong, but this is the case(pun intended) with Delphi)
Yea I have to agree with you. I'd kinda like to pickup on Delphi, it looks interesting. Also, if I remember right, switch statements are just unrolled into if/then statements, but I may be thinking of another language.
That's because the people releasing these bases don't know the language. Let's take the most commonly used base that pretty much all bases have been based on and "improved" - Hans' base and Gellin's base. It was amazing! You could tell that these people were pros only by looking at their naming conventions.

Whereas now, you will see these random additions to it. 200 if statements, 200 int variables where booleans would be fine. Things that have been hacked in from copy-pastes from all over the internet (congrats to people who went out of MPGH onto a Search Engine).

It's degraded because the people programming these hacks (or, "updating" it) don't know the language - many have learnt it only by looking at existing hack source codes and bases, and don't bother with other aspects of the language.

Quote Originally Posted by Apoc91 View Post
Yea I have to agree with you. I'd kinda like to pickup on Delphi, it looks interesting. Also, if I remember right, switch statements are just unrolled into if/then statements, but I may be thinking of another language.
switch statements are very similar to if/elseif statements in the sense they they check each label for a met condition.

Differences are:
- switch statements must be constant. It must equal something. (for example, you can't have more than(>) or less than (<) unlike .NET counterparts.
- if statements will terminate at the end of the if statement brace (or line). switch statements will continue executing code, paste other labels (case x until it meets a statement that will terminate execution. This is usually a break;, but can also include things like return;.
Quote Originally Posted by freedompeace View Post
That's because the people releasing these bases don't know the language. Let's take the most commonly used base that pretty much all bases have been based on and "improved" - Hans' base and Gellin's base. It was amazing! You could tell that these people were pros only by looking at their naming conventions.

Whereas now, you will see these random additions to it. 200 if statements, 200 int variables where booleans would be fine. Things that have been hacked in from copy-pastes from all over the internet (congrats to people who went out of MPGH onto a Search Engine).

It's degraded because the people programming these hacks (or, "updating" it) don't know the language - many have learnt it only by looking at existing hack source codes and bases, and don't bother with other aspects of the language.
Those people make me sad lol.

I have too much eager to learn how/why something happens to be like that... I guess that's not a bad thing though.
Quote Originally Posted by Apoc91 View Post
Those people make me sad :( lol.

I have too much eager to learn how/why something happens to be like that... I guess that's not a bad thing though.
Yeahs. There's a reason why my releases' source code is only available to people who meet my criteria x]

There's so much you can learn, don't you feel good when you gain a bit more knowledge? :)

People are missing out. Missing out badly.
Quote Originally Posted by freedompeace View Post
Yeahs. There's a reason why my releases' source code is only available to people who meet my criteria x]

There's so much you can learn, don't you feel good when you gain a bit more knowledge?

People are missing out. Missing out badly.
Hell yea, I love it when I'm boggling over something for a while and then out of nowhere it clicks and I'm like "omfg that was too easy" lol.

One downside is that where there's so many leechers when someone actually eager to learn needs some pointers on something no one wants to help them.
Quote Originally Posted by Apoc91 View Post
Hell yea, I love it when I'm boggling over something for a while and then out of nowhere it clicks and I'm like "omfg that was too easy" lol.

One downside is that where there's so many leechers when someone actually eager to learn needs some pointers on something no one wants to help them.
If they don't beg for it like a leecher, then i'm always happy to help :)

But they've got to show that they've tried to solve their problems before somehow.
Quote Originally Posted by freedompeace View Post
If they don't beg for it like a leecher, then i'm always happy to help

But they've got to show that they've tried to solve their problems before somehow.
I get what you guys are saying, and I want to learn new stuff once you do learn new stuff you feel good.
So that is why I try to be less of a leecher, and try to learn more about C++ language.

Your past hack releases are great and have the look of a good coder. Even though I have only seen screenshots

so people could be doing:
Code:
int hacks [] = {f1, f2, f3, f4, f5};
sorry if i am typing random shit.
Posts 115 of 20 · Page 1 of 2

Post a Reply

Tags for this Thread

None

Need help?