Author |
Message |
Doggeti Server Help Squatter

Age:40 Gender: Joined: Jan 12 2003 Posts: 297 Location: Germany Offline
|
Posted: 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. case EVENT_TimedGameOver:
{
Player *p[5];
for (int i = 0; i < 5; i++)
p[i] = (Player*)event.p[i];
doSomething();
}
break; |
2. 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. _________________ Expect the worst but hope for the best. |
|
Back to top |
|
 |
k0zy Server Help Squatter

Gender: Joined: Jan 11 2003 Posts: 571 Location: Germany Offline
|
Posted: Tue Jul 27, 2004 9:24 am Post subject: |
 |
|
|
|
talk to catid? _________________ It's a shark! Oh my god! Unbelievable! |
|
Back to top |
|
 |
50% Packetloss Server Help Squatter

Age:40 Gender: Joined: Sep 09 2003 Posts: 561 Location: Santa Clarita, California Offline
|
Posted: 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. |
|
Back to top |
|
 |
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.

Age:37 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Tue Jul 27, 2004 8:43 pm Post subject: |
 |
|
|
|
That is so ugly.  |
|
Back to top |
|
 |
Bak ?ls -s 0 in

Age:26 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
Posted: 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"); |
|
Back to top |
|
 |
50% Packetloss Server Help Squatter

Age:40 Gender: Joined: Sep 09 2003 Posts: 561 Location: Santa Clarita, California Offline
|
Posted: 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. |
|
Back to top |
|
 |
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.

Age:37 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Tue Jul 27, 2004 10:50 pm Post subject: |
 |
|
|
|
If you must use it that way, use snprintf then.  |
|
Back to top |
|
 |
Doggeti Server Help Squatter

Age:40 Gender: Joined: Jan 12 2003 Posts: 297 Location: Germany Offline
|
Posted: 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  |
|
Back to top |
|
 |
CypherJF I gargle nitroglycerin

Gender: Joined: Aug 14 2003 Posts: 2582 Location: USA Offline
|
Posted: Thu Jul 29, 2004 4:06 am Post subject: |
 |
|
|
|
Just suggest it to him... _________________ Performance is often the art of cheating carefully. - James Gosling |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Thu Jul 29, 2004 6:58 pm Post subject: |
 |
|
|
|
Or just use twcore _________________
 |
|
Back to top |
|
 |
|