I solved the problem (with a bit help), so I thought I'd post the
solution in case anyone has a similar problem.
You must point to GetLocalPlayer() every paint (or think, in health's
case), or else the pointer becomes invalid (I think it may be a scope
issue). So by adding
if(!local){
local = C_BasePlayer::GetLocalPlayer();
m_fNewSpeed = 0;
}
else{
local = C_BasePlayer::GetLocalPlayer();
m_fNewSpeed = VectorLength(local->GetAbsVelocity());
}
to my paint() function, I retain the pointer, and it doesn't crash out.
Hope this helps someone :)
On Wed, 12 Jan 2005 18:41:31 -0800, Nick Roth <[EMAIL PROTECTED]> wrote:
> Ok, I finally ended up commenting out everything in my code (a hud
> element) but the basic function frame, and it compiled and ran in
> multiplayer mod mode on Steam. Then I began to uncomment blocks of
> code until I could get it to crash. It turns out this is the line
> that is causing it to crash:
>
> m_fNewSpeed = VectorLength(local->GetAbsVelocity());
>
> At first I had it in the think function, and I thought it didn't like
> having to do the calculation that quickly :), so I dropped it into the
> paint function, and it still crashes. any ideas?
>
> Basically I need to update the velocity every time I draw the element.
>
>
> On Wed, 12 Jan 2005 12:06:02 -0700, Hasan Aljudy <[EMAIL PROTECTED]> wrote:
> > I got that once when I tried to add classes to the vgui library .. got
> > an error "SDKGameRuels not registered on the client" or something like
> > that.
> > I thought that's becuase I messed with the vgui (i.e. it's not in
> > synch with the engine's vgui). but I'm not so sure ..
> >
> > On Wed, 12 Jan 2005 09:45:40 -0800, Mike Dussault
> > <[EMAIL PROTECTED]> wrote:
> > > Can you run in the debugger and get a call stack? Also, are you building
> > > both the client and the server DLL or just one of them? (Try building
> > > both).
> > >
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED]
> > > [mailto:[EMAIL PROTECTED] On Behalf Of Nick Roth
> > > Sent: Wednesday, January 12, 2005 12:43 AM
> > > To: [email protected]
> > > Subject: [hlcoders] Singleplayer port to Multiplayer
> > >
> > > ok, so I made a few new classes (nothing that changes the existing cpp
> > > files), and it compiles and runs fine using the "Create Single Player
> > > Mod" package, but when I try placing the files in the Multiplayer mod
> > > package, it compiles fine, but crashes out when I try to load a map. I
> > > know others have had similar problems with this. Unfortunately, I
> > > haven't seen any solutions to the problem. I've tried loading single
> > > player maps, hl2mptest.bsp, and a CS map. All crash out.
> > >
> > > Any ideas or a thread I missed?
> > > --
> > > Nick Roth
> > >
> > > _______________________________________________
> > > 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
> > >
> > >
> >
> > _______________________________________________
> > To unsubscribe, edit your list preferences, or view the list archives,
> > please visit:
> > http://list.valvesoftware.com/mailman/listinfo/hlcoders
> >
> >
>
>
> --
> Nick Roth
> [EMAIL PROTECTED]
>
--
Nick Roth
[EMAIL PROTECTED]
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders