Server Help

Bot Questions - TimedGameOver

Doggeti - Tue Jul 27, 2004 8:57 am
Post subject: TimedGameOver
I want a function to be called when the game is over ('Soccer game over.' message appears).

I have tried two possibilities:

1.
Code: Show/Hide
case EVENT_TimedGameOver:
      {
         Player *p[5];
         for (int i = 0; i < 5; i++)
            p[i] = (Player*)event.p[i];

         doSomething();
      }
      break;


2.
Code: Show/Hide
switch (type)
         {
         case MSG_Arena:
            {
               sendPublic("_MSG_Arena_");
               if (strcmp(msg, "Soccer game over.") == 0)
               {
                  doSomething();
               }
            }
            break;


Note: I don't see '_MSG_Arena_'. Is 'Soccer game over' an arena message? I also check all other MSG types with sendPublic. Nothing gets displayed. it seems like it has no MSG type at all.

I know that doSomething() does not get called because the first line in doSomething() is sendPublic("_doSomething_"); and I never see that message.
k0zy - Tue Jul 27, 2004 9:24 am
Post subject:
talk to catid?
50% Packetloss - Tue Jul 27, 2004 8:32 pm
Post subject:
ok, the event_timedgameover is for KOTH. Your 2nd set of code is correct. Try this,

char test[100];
sprintf(test, "_MSG_Arena_ %i", GetTickCount() );
sendPublic(test);

the array doesnt need to be that big, i just didnt want to figure out the perfect length

ive noticed that sometimes i dont get messages from bots because they are sending the same thing multiple times. So i use the tickcount to randomize what is being sent.
Solo Ace - Tue Jul 27, 2004 8:43 pm
Post subject:
That is so ugly. icon_sad.gif
Bak - Tue Jul 27, 2004 9:13 pm
Post subject:
it's not that bad.

another solution is to do

sendPublic("*arena MSG_ARENA");

arena messages always get sent even if they are the same, i think

or just send 2 different messages:

sendPublic("-");
sendPublic("MSG_ARENA");
50% Packetloss - Tue Jul 27, 2004 10:44 pm
Post subject:
nothing is ugly, his code is fine and working with sprintf is better than using the string class. Do a char test[25]; it shouldnt get any larger than that.
Solo Ace - Tue Jul 27, 2004 10:50 pm
Post subject:
If you must use it that way, use snprintf then. icon_sad.gif
Doggeti - Thu Jul 29, 2004 2:58 am
Post subject:
Ok, it works now, thank you.

Catid, if you read this. Build in an EVENT_SoccerGameOver icon_smile.gif
CypherJF - Thu Jul 29, 2004 4:06 am
Post subject:
Just suggest it to him...
D1st0rt - Thu Jul 29, 2004 6:58 pm
Post subject:
Or just use twcore
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group