Code:
means if the SpammerThread (which is the code we skipped earlier) is not already running then it will execute the code in between the corresponding "{" "}".Quote:
if (hSpammerThread)
Code:
This is is saying that hSpammerThread(which again is the code we skipped earlier) is going to start executing. We could have put that code here, but instead to make the code more readable and understandable, we made a new function for it.Quote:
hSpammerThread = NewThread((void*)Spammer, 0);
* * * * * * delete pParse;
* * * * * * return TRUE;
This might be a bit hard to understand and comprehend at the moment, but once you make a few modules of your own it will become more clear. The delete pParse will always be at the end of the code of each command along with return true; These are telling the program to end this command.
Code:
Again, after every command you will have an else statement, telling the program what to do if the program is already running. It is telling the program to Print to the console the text in the parentheses. Then it is deleting pParse and returning TRUE (which is any number above 1 in this case) which tells the compiler that that command is done. Again, a bit hard to comprehend, but after making a few modules of your own you will be able to understand this with ease.Quote:
* * } else {
* * * * * * ConsolePrint (3, "Spamming thread is already running");
* * * * * * delete pParse;
* * * * * * return TRUE;
* * * * }
Code:
This bit of code is excactly what I just explained except telling the program what to do when the command ".realmgx stop" or ".*your module here* *your command here*. The "KillThread" function you see in teh code tells that program to killQuote:
if (!strcmpi(pParse[1], "stop")
* * * {
* * * * if (hSpammerThread)
* * * * {
* * * * * * KillThread(hSpammerThread);
* * * * * * delete pParse;
* * * * * * return TRUE;
* * * * } else {
* * * * * * ConsolePrint (3, "No spamming thread is running!");
* * * * * * delete pParse;
* * * * * * return TRUE;
* * * * }*
that thread when the module is stopped! As you can see both delete pParse and return TRUE; are there, along with the else statement.
Code:
This is ending the module. Will always be the same besides it mite only contain 2 "}" There will always be a closing bracket after the return TRUE; though.Quote:
* * * }
* }
* return TRUE;
}
Now before I end this tutorial I have to explain what the code we skipped did. So let's go back up to it shall we?
Code:
Lets go through this a few lines at a time since it is a bit overwhelming at the first glance.Quote:
void Spammer(void*)
{
* while(1)
* {
* * * ConsoleCommand("script SendChatMessage(\"Visit www.RealmGX.com\");");
* * * Sleep(1000);
* * * ConsoleCommand("script SendChatMessage(\"Home of WoWHackit!\");");
* * * Sleep(1000);
* * * ConsoleCommand("script SendChatMessage(\"Come Get Hacks, Tips, Strategies, Items, and
More!!!\");");
* * * Sleep(1000);
* }
}*
Code:
This is saying that it will return "void" which means nothing. It will not return an integer nor a string or a character, it is only doing what is inside the curly braces. The name of the function is Spammerand as you can see in the parenthesesQuote:
void Spammer(void*)
{
it shows that it is returning void.
Code:
This just means that while (1) which means never ending since the default value of a program is (1) unless otherwise specified. This also means that what ever is inside the curly braces it will repeat and repeat until the module is stopped.Quote:
while(1)
* {
Code:
This is what is repeated over and over again. First the ConsoleCommand is telling it to SendChatMessage and sending what ever is in the parentheses. The Sleep() function is telling the module to sleep for 1000 milliseconds, or 1 second.Quote:
ConsoleCommand("script SendChatMessage(\"Visit www.RealmGX.com\");");
* * * Sleep(1000);
* * * ConsoleCommand("script SendChatMessage(\"Home of WoWHackit!\");");
* * * Sleep(1000);
* * * ConsoleCommand("script SendChatMessage(\"Come Get Hacks, Tips, Strategies, Items, and
More!!!\");");
* * * Sleep(1000);
As you can see there are semi-colons after each command, as in most functions and commands in WowHackit, and C++ in general.
Finally we end this function by ending the while loop with a curly brace and ending the entire function with yet another curly brace.






