void __stdcall command_help(vector params)
{
if (params.size() == 0 || (params.size() > 0 && _strcmpi(params[0].s, "help") == 0))
{
PrintMessage("Usage: help ");
return;
}
if (params.size() > 0)
{
size_t len = strlen(params[0].s);
char cmdstr[200];
wsprintf(cmdstr, "%s help", params[0].s);
ExecuteCommand(cmdstr);
}
}
void __stdcall command_test(vector params)
{
if (params.size() > 0 && _strcmpi(params[0].s, "help") == 0)
{
PrintMessage("Not much to do here... yet");
return;
}
for(vector::iterator i = params.begin();i < params.end(); i++ )
PrintMessage(i->s);
}
void __stdcall command_repeat(vector params)
{
if (params.size() > 0 && _strcmpi(params[0].s, "help") == 0)
{
PrintMessage("Usage: repeat \n Repeats times.");
return;
}
if (params.size() < 2 || params[0].type != PARAM_UL)
{
PrintMessage("Incorrect format, use the help command.");
return;
}
unsigned long count = params[0].l;
for (unsigned long i = 0; i < count; i++)
ExecuteCommand(params[1].sp);
}
void CommandInit()
{
AddCommand("help", command_help);
AddCommand("repeat", command_repeat);
AddCommand("test", command_test);
}