Hi,

why you use engine->execute ?

Test it so:

void CEmptyServerPlugin::FireGameEvent( IGameEvent * event )
{
const char * name = event->GetName();
   if (FStrEq(name, "player_changename"))
   {
       if(tester_cvar.GetInt()==1)
       {
           Msg("Kicking ya.\n");
           int userid = event->GetInt("userid");
           char szMessage[1024];
           sprintf(szMessage, "kickid %d Go away.\n", userid);
           engine->ServerCommand(szMessage);
       }
   }
}

Becouse engine->ServerCommand allready executed the command...

Or i understand it wrong ???

I hope i can help you

Sorry my main Language is German!

MFG

=]-RM-[=Ratman2000


----- Original Message ----- From: "Mattie Casper" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Saturday, March 26, 2005 3:25 PM Subject: [hlcoders] FireGameEvent, kickid, ServerExecute, crash


Hello,

I've found what seems, for me, to be a really annoying bug in CSS (and
probably
mods). The following problem happens regardless of whether you use
IGameEventListener or IGameEventListener2.

My Windows server crashes 98% of the time with the following code in a
listener/plugin:


void CEmptyServerPlugin::FireGameEvent( IGameEvent * event ) { const char * name = event->GetName(); if (FStrEq(name, "player_changename")) { if(tester_cvar.GetInt()==1) { Msg("Kicking ya.\n"); int userid = event->GetInt("userid"); char szMessage[1024]; sprintf(szMessage, "kickid %d Go away.\n", userid); engine->ServerCommand(szMessage); if (tester2_cvar.GetInt()==1) { // Crashes the server engine->ServerExecute(); } } } }

Basically, this silly code causes a player to get kicked immediately when
he
tries to change his name. He certainly does get kicked, but the server
crashes
immediately after.

This is just the sample reproduction code, but the problem shows itself at
a
much deeper point in my EventScripts plugin when users are kicked in the
middle
of an event. It can happen at times regardless of whether the event
handler is
doing the kicking (i.e. another plugin or user could be kicking the player
while
my event handlers are firing). I believe it is a timing or threading issue
because if I place a Windows Sleep(100) after the above ServerExecute
call, the
crash usually doesn't happen.

Avoiding ServerExecute() is not really an option for me because I truly
need the
command (not necessarily kick) executed immediately (typically an exec of
a cfg
file). Regardless, the documentation places no caveats on when
ServerExecute()
can be called, so I haven't been afraid to do so when needed.

Anyone have any recommendations or thoughts here?

Thanks for your help,
-Mattie



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders






_______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders



Reply via email to