I'd been working on coding out a money system for a while now, and recently
began work on having monsters give you money everytime you kill them. This
is where I'm having troubles. Botman suggested the following in
CBaseMonster::Killed in combat.cpp
CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pevAttacker);
// is it a player (and not a grenade, hornet, rocket, etc.)?
if (pPlayer->IsPlayer())
{
pPlayer->m_Money += m_MosterMoneyValue;
}
In my mind, I thought this would work, I've tried it though and I find that
pPlayer isn't referencing the player properly, and therefore m_Money (which
exists in player.h under class CBasePlayer : public CBaseMonster), stays at
zero (I've used alert (at_console) in my code to check this). Any ideas anyone?
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders