help fixing this code Created 11 years ago2012-04-17 06:49:10 UTC by gian20 gian20

Created 11 years ago2012-04-17 06:49:10 UTC by gian20 gian20

Posted 11 years ago2012-04-17 06:49:10 UTC Post #305449
I added this code in combat.cpp
#include "player.h"

in the CBaseMonster::Killed

if( pPlayer && pPlayer->IsPlayer() ) //pPlayer undefined...
{
pPlayer->AddPoints( 1, false );
}
Posted 11 years ago2012-04-17 07:07:55 UTC Post #305450
ok, so you're adding frag points on kill.

what's the context?
what are you trying to achieve?
what's the error you're getting?
Is it compiling but not doing what you want, or failing to compile?
Posted 11 years ago2012-04-17 07:36:25 UTC Post #305451
I have used the 'WayBack Machine' to browse the planethalflife archive and I have found that there is that ' Frag Points when you kill a monster in mp' but I cannot get that code to work it says that:
'pPlayer' : undeclared identifier
this is the link to the planethalflife
http://web.archive.org/web/20050310084202/http://www.planethalflife.com/hlprogramming/tutorial.asp?i=143

I am using MS Visual C++ Express 2010
Posted 11 years ago2012-04-17 07:49:45 UTC Post #305452
is this error in hud_level.cpp?
Posted 11 years ago2012-04-17 08:05:43 UTC Post #305453
this error is in combat.cpp
Posted 11 years ago2012-04-18 08:26:12 UTC Post #305481
That code snippet you found is missing ONE important line of code.

CBaseMonster :: Killed() passes in an entvars pointer to the entity
that killed the monster, you need to convert that entvars pointer to
a CBasePlayer pointer first, then run the player validity checks.
You must be logged in to post a response.