#include "module.h" #define AUTHOR "DukePyrolator" #define VERSION "0.0alpha" class CommandOSExample : public Command { public: // 1. param: The name of the new comand // 2. param: The minimum number of parameters the parser will require to execute this command // 3. param: The maximum number of parameters the parser will create, after max_params, all will be combined into the last argument. // 4. param: The required permission to access this command (you can invent new permissions if you wish) CommandOSExample() : Command("Example", 2, 3, "operserv/example") { } CommandReturn Execute(User *u, std::vector ¶ms) { ci::string cmd = params[0]; if (cmd == "CRASH") { // do something // then return MOD_CONT } else if (cmd == "DONTCRASH") { // do something // then return MOD_CONT or MOD_STOP } return MOD_CONT; } bool OnHelp(User *u, const ci::string &subcommand) { u->SendMessage(s_OperServ, "this is a help message"); return true; } void OnSyntaxError(User *u) { u->SendMessage(s_OperServ, "syntax error, please do /operserv help Example"); } }; class OSExample : public Module { public: OSExample(const std::string &modname, const std::string &creator) : Module(modname, creator) { this->SetAuthor(AUTHOR); this->SetVersion(AUTHOR); this->SetType(THIRD); this->AddCommand(OPERSERV, new CommandOSExample()); } }; MODULE_INIT(OSExample)