Server Help

Bot Questions - Two Questions

Anonymous - Tue Jul 13, 2004 2:20 pm
Post subject: Two Questions
I have two questions in creating a plugin:

1. How do I save a player name for later use (ex. !flag will display the person that is carrying the flag)

2. Is there a way to make someone's name red without any flags?
Bak - Tue Jul 13, 2004 2:45 pm
Post subject:
To store data, use variables. If you want a variable to survive longer than the scope of a function, put it outside the function. For MERVCORE an ideal place is in the botInfo class definition.

You can change font color using .lvz, although it would change a complete color... like you could make yellow red... but then team chat would be red.

With ASSS you can modify packets to it looks like people are carring flags when they really aren't.
Solo Ace - Tue Jul 13, 2004 3:03 pm
Post subject:
Bah, I was typing something like that, but you were faster than me Bak. icon_sad.gif

Guess VNC'ing to home and trying to post on forums isn't such a good idea. icon_razz.gif
Underlord - Tue Jul 13, 2004 3:04 pm
Post subject:
1. MervBot tracks who has flags internally with p->flagCount

So to have !flag display who has flags (command.cpp in gotCommand)

Code: Show/Hide

if (c->check("flag"))
         {
            _listnode <Player> *parse = playerlist->head;
   
            while (parse)
            {
               Player *t = parse->item;

               if (t->flagCount > 0)
               {
                  String s = t->name;
                  s += " flags: ";
                  s += t->flagCount;
                  sendPrivate(p,s);
               }
               parse = parse->next;

            }
         }


Assuming 1 flag in the arena, to store a global name of who has it....

(spawn.h)
class botInfo
{
char flagCarrier[20];

(spawn.cpp)
Code: Show/Hide

Code: Show/Hide

case EVENT_FlagGrab:
      {
         Player *p = (Player*)event.p[0];
         Flag *f = (Flag*)event.p[1];

          strcpy(flagCarrier,p->name);



You'd need to handle what to do if they drop the flag.


2. Not with subgame
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group