View Full Version : Question royalhack ToBasePlayer
10-03-2009, 04:07 PM
C_BasePlayer *pBasePlayer = NULL;
IClientEntity* ClientEntity = HalFLife2.m_pEntList->GetClientEntity( index );
if ( ClientEntity == NULL
|| ClientEntity->IsDormant() )
CBaseEntity* pBaseEntity = ClientEntity->GetBaseEntity();
if ( pBaseEntity == NULL
|| pBaseEntity->IsDormant() )
pBasePlayer = ToBasePlayer(pBaseEntity);
if(pBasePlayer == NULL)
why is this allways pBasePlayer null/0 ?
10-03-2009, 04:09 PM
Hard to tell when A. you just told us "your code" is not yours, B. your using a base that is years old, and C. we don't know what the hell that function does. Post the code of it.
10-03-2009, 04:30 PM
the TITLE says royalhack you are jumping again xeno :) .
this function is in the sdk
inline C_BasePlayer *ToBasePlayer( C_BaseEntity *pEntity )
if ( !pEntity || !pEntity->IsPlayer() )
Assert( dynamic_cast<C_BasePlayer *>( pEntity ) != NULL );
return static_cast<C_BasePlayer *>( pEntity );
10-03-2009, 04:34 PM
FAAAAIL. Ok you're right. Hm, and you're sure the entity is valid. Interesting. (Sorry for jumping at you, I tend to do that :|).
10-04-2009, 06:55 AM
It's simple, the IsPlayer() always returns an odd value since the SDK is outdated. Why don't you just recreate the function and use static_cast to cast a BaseEntity to a BasePlayer?
10-04-2009, 10:57 AM
i will try that now badster
10-04-2009, 10:58 AM
C_BasePlayer* ToBasePlayer ( C_BaseEntity* pBaseEnt )
10-04-2009, 12:33 PM
the IsPlayer() always returns an odd value
C_BasePlayer* pBasePlayer = ((CBasePlayer*)pBaseEntity);
Powered by vBulletin® Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.