You wrote: |
I'm sure this is considered simple, but I'm the sort of person who figures stuff out, doesn't just go with MERV or something.... |
Code: Show/Hide void botInfo::gotCommand(Player *p, Command *c)
{ // Skipping code to improve readability. switch (p->access) { // ... case OP_Moderator: { // Is the used command "[!|.|@]1hole"? if (c->check("1hole")) { // Did the operator use any parameters? if (*c->final) { // Iterate through the playerlist while comparing c->final (which contains the name of the player who needs to be warped) // If it's found, send the *warpto (and maybe another message like "Warp'd!") to the player. // Otherwise if the player wasn't found, you could send an error message if you want. } // Error message? } } // ... } } |
Code: Show/Hide void botInfo::gotCommand(Player *p, Command *c) { // Skipping code to improve readability. switch (p->access) { // ... case OP_Player: { // Is the used command "[!|.|@]1hole"? if (c->check("1hole")) { sendPrivate(p,"*warpto 512 512"); } else if (c->check("2hole")) { sendPrivate(p,"*warpto 600 600"); } } // ... } } |
He wrote: |
that could also be told to warp people with simple commands like :GolfBot:!1hole Freakman Bob. |
Code: Show/Hide void botInfo::gotCommand(Player *p, Command *c) { // Skipping code to improve readability. switch (p->access) { // ... case OP_Moderator: { // Is the used command "[!|.|@]1hole"? if (c->check("1hole")) { bool found = false; for (_listnode <Player> *parse = playerlist->head;parse;parse = parse->next) { if (strcasecmp(c->final,parse->item->name) == 0) { sendPrivate(parse->item,"*warpto 512 512"); found = true; break; } } if (!found) sendPrivate(p,"Player not found in arena."); else sendPrivate(p,"Player found and warped."); } } // ... } } |