plugin version of the language macro... because i was bored...
C++:
#include "../MQ2Plugin.h"
#include <ctime>
PreSetup("MQ2LanguageTrainer");
bool TrainingEnabled;
clock_t WaitTime;
CHAR pBuffer[256];
std::vector <std::string> colour;
void ToggleTraining(PSPAWNINFO pChar, PCHAR szLine)
{
TrainingEnabled = !TrainingEnabled;
}
PLUGIN_API VOID InitializePlugin(VOID)
{
colour.push_back("Blue");
colour.push_back("Red");
colour.push_back("Orange");
colour.push_back("Yellow");
WaitTime = clock();
TrainingEnabled = false;
AddCommand("/LanguageTrain",ToggleTraining);
}
PLUGIN_API VOID ShutdownPlugin(VOID)
{
RemoveCommand("/LanguageTrain");
}
PLUGIN_API VOID OnPulse(VOID)
{
if (TrainingEnabled && WaitTime <= clock()) {
auto i = rand() % colour.size();
sprintf(pBuffer, "/g %s", colour[i].c_str());
DoCommandCmd((PSPAWNINFO)pLocalPlayer, pBuffer);
WaitTime = clock() + 150;
}
}