Oh, if you want the owner, you should try something like GetOwner() or GetOwnerEntity() on the NPC to get his owner ;)
On Tue, 03 Jun 2008 21:30:46 +0200, Matthew Dryden <[EMAIL PROTECTED]> wrote: > But the information I'm trying to pull is actually a player...it's just > the owner of this particular NPC...:S > > Emiel Regis wrote: >> You cannot type_cast from player to npc safely, because they differ >> considerably. You should think of other way of doing this, I guess ;) >> >> On Tue, 03 Jun 2008 21:15:40 +0200, Matthew Dryden <[EMAIL PROTECTED]> >> wrote: >> >> >>> Hey all, I'm not familiar with pointers...wondering if you can give me >>> a >>> push in the right direction: >>> >>> if ( pKiller->IsNPC() ) >>> { >>> // CAI_BaseNPC *pNPC = (CAI_BaseNPC*)pKiller; >>> CAI_BaseNPC *pNPC = dynamic_cast<CHL2MP_Player*>(pKiller); >>> if ( pNPC->LikesMaster() ) >>> pKiller = pNPC->GetMasterPlayer(); >>> } >>> >>> I'm getting these errors: >>> >>> hl2mp_gamerules.cpp >>> ..\shared\hl2mp\hl2mp_gamerules.cpp(452) : error C2440: 'initializing' >>> : >>> cannot convert from 'CHL2MP_Player *' to 'CAI_BaseNPC *' >>> Types pointed to are unrelated; conversion requires >>> reinterpret_cast, C-style cast or function-style cast >>> ..\shared\hl2mp\hl2mp_gamerules.cpp(454) : error C2440: '=' : cannot >>> convert from 'CBasePlayer *' to 'CHL2MP_Player *' >>> Cast from base to derived requires dynamic_cast or static_cast >>> >>> The idea is that if my monster likes me and kills another player or >>> monster...it will make the killer the owner of said monster...meaning I >>> killed the player. >>> >>> _______________________________________________ >>> 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 > -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders