Code: Show/Hide void botInfo::gotCommand(Player *p, Command *c) { if (!p) return; if (!c) return; switch (p->access) { case OP_Duke: case OP_Baron: case OP_King: case OP_Emperor: case OP_RockStar: case OP_Q: case OP_God: case OP_Owner: { // Owner-level commands } case OP_SysOp: { // SysOp-level commands } case OP_SuperModerator: { // SuperModerator-level commands } case OP_Moderator: { // Moderator-level commands } case OP_Limited: { // Limited-level commands } case OP_Player: { // Player-level commands } } } |
Code: Show/Hide if (c->check("announce")) //if command name is announce { countdown[0] = 5; // set countdown0 to 5 seconds sendPrivate(p, "message"); // Send in private something back to the player who triggered the command. } |
Code: Show/Hide void botInfo::gotCommand(Player *p, Command *c) { if (!p) return; if (!c) return; switch (p->access) { case OP_Duke: case OP_Baron: case OP_King: case OP_Emperor: case OP_RockStar: case OP_Q: case OP_God: case OP_Owner: { // Owner-level commands } case OP_SysOp: { // SysOp-level commands } case OP_SuperModerator: { // SuperModerator-level commands } case OP_Moderator: { // Moderator-level commands } case OP_Limited: { // Limited-level commands } case OP_Player: { // Player-level commands if (c->check("announce")) //if command name is announce { countdown[0] = 5; // set countdown0 to 5 seconds sendPrivate(p, "message"); // Send in private something back to the player who triggered the command. } } } } |
Code: Show/Hide if (c->check("announce")) //if command name is announce { countdown[0] = 5 * 60; // set countdown0 to 5 * 60 = 5 minutes sendPrivate(p, "message"); // Send in private something back to the player who triggered the command. } |
Code: Show/Hide case EVENT_Tick: { for (int i = 0; i < 4; ++i) --countdown[i]; } break; |
Code: Show/Hide case EVENT_Tick: { for (int i = 0; i < 4; ++i) --countdown[i]; if (countdown[0] == 300) // if countdown is 5 minutes { sendPublic("5 Minutes"); } else if (countdown[0] == 240) // if countdown is 4 minutes { sendPublic("4 Minutes"); } else if (countdown[0] == 180) // if countdown is 3 minutes { sendPublic("3 Minutes"); } else if (countdown[0] == 120) // if countdown is 2 minutes { sendPublic("2 Minutes"); } else if (countdown[0] == 60) // if countdown is 1 minute { sendPublic("1 Minutes"); } else if (countdown[0] == 0) //is countdown is over (0 seconds) { sendPublic("0 Minutes (Countdown over)"); } } break; |