Have you run it through a debugger to check the stack when it crashes?

----- Original Message -----
From: "Adam "amckern" Mckern" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, March 26, 2005 5:13 PM
Subject: Re: [hlcoders] Re: FireGameEvent, kickid, ServerExecute, crash


> are your runing the lattest build of ded server, and
> have you thought of adding a break point?
>
>
> --- Mattie Casper <[EMAIL PROTECTED]> wrote:
>
> > Events are caused within events all the time---
> > people use events to do all
> > sorts of things: kick players, make people swap
> > teams, teamkill punishment, etc.
> > Even if server event reentrance is a problem, we
> > need some Valve documentation
> > saying this is forbidden or dangerous.
> >
> > To clarify three points:
> > 1. I'm not interested in specifically kicking a
> > player. I'm interested in doing
> > X during an event where X is anything the
> > administrator wants. So if he wants to
> > kick a player that's his thing. I, personally, am
> > not trying to kick anyone
> > during an event. I'm letting people run semi-special
> > config files during an
> > event.
> > 2. The crash doesn't just happen when plugin code
> > specifically kicks someone. It
> > can happen when a player is kicked via some
> > administrative plugin, by the
> > console, etc. It just needs to happen at the around
> > the time an event calls
> > ServerExecute.
> > 3. The example below is the smallest example I made
> > to reproduce the problem.
> > I'm no newbie to coding-- I've considered all sorts
> > of workarounds. Like
> > scheduling things independently via GameFrame,
> > avoiding the ServerExecute, etc.
> > Unfortunately, these alternatives are
> > substandard/messy and, really, I just need
> > someone at Valve to say "this is a bug, we'll fix
> > it" or "ServerExecute during
> > an event is unsupported because of X and we'll
> > document it as such going
> > forward". If I've missed existing documentation to
> > this effect, I'm hoping
> > someone on the list can point me to it. (Educated
> > guesses stated as if they were
> > fact won't help me, though.)
> >
> > Thanks,
> > -Mattie
> >
> >
> > cheeseh wrote:
> >
> -------------------------------------------------------------------------
> >
> > I am guessing that when you kick a player another
> > event is triggered
> > that tells that the player was kicked/left the
> > server. You cannot have
> > two events fire inside each other, I am taking this
> > from the old "net
> > message" code that was from HL1, you could not have
> > two messages start
> > before they end.
> >
> > Instead of kicking the player there, try raising a
> > flag (try storing a
> > global boolean variable and the player id) and check
> > it on startframe
> > (or GameFrame () as it is now in HL2 I think) when
> > the flag is true,
> > kick the stored player id, then set the flag to
> > false. In the event code
> > replace it with setting the boolean to true and
> > setting the playerid to
> > the userid.----- Original Message -----
> > From: "Mattie Casper" <[EMAIL PROTECTED]>
> > To: <[email protected]>
> > Sent: Saturday, March 26, 2005 9:25 AM
> > Subject: 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
> >
> >
>
>
> http://ammahls.com
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Make Yahoo! your home page
> http://www.yahoo.com/r/hs
>
> _______________________________________________
> 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