本文整理汇总了C++中CClientPlayer类的典型用法代码示例。如果您正苦于以下问题:C++ CClientPlayer类的具体用法?C++ CClientPlayer怎么用?C++ CClientPlayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CClientPlayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPlayerNametagColor
int CLuaPlayerDefs::GetPlayerNametagColor(lua_State* luaVM)
{
// int, int, int getPlayerNametagColor ( player thePlayer )
CClientPlayer* pPlayer;
CScriptArgReader argStream(luaVM);
argStream.ReadUserData(pPlayer);
if (!argStream.HasErrors())
{
// Grab his nametag color and return it
unsigned char ucR, ucG, ucB;
pPlayer->GetNametagColor(ucR, ucG, ucB);
lua_pushnumber(luaVM, ucR);
lua_pushnumber(luaVM, ucG);
lua_pushnumber(luaVM, ucB);
return 3;
}
else
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
// Failed
lua_pushboolean(luaVM, false);
return 1;
}
示例2: GetPlayerNametagText
int CLuaPlayerDefs::GetPlayerNametagText(lua_State* luaVM)
{
// string getPlayerNametagText ( player thePlayer )
CClientPlayer* pPlayer;
CScriptArgReader argStream(luaVM);
argStream.ReadUserData(pPlayer);
if (!argStream.HasErrors())
{
// Grab his nametag text and return it
const char* szName = pPlayer->GetNametagText();
if (szName)
{
lua_pushstring(luaVM, szName);
return 1;
}
}
else
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
// Failed
lua_pushboolean(luaVM, false);
return 1;
}
示例3: switch
void CCameraRPCs::SetCameraTarget ( NetBitStreamInterface& bitStream )
{
ElementID targetID;
if ( bitStream.Read ( targetID ) )
{
CClientEntity * pEntity = CElementIDs::GetElement ( targetID );
if ( pEntity )
{
// Save our current target for later
CClientEntity * pPreviousTarget = m_pCamera->GetTargetEntity ();
switch ( pEntity->GetType () )
{
case CCLIENTPLAYER:
{
CClientPlayer* pPlayer = static_cast < CClientPlayer* > ( pEntity );
if ( pPlayer->IsLocalPlayer () )
{
// Return the focus to the local player
m_pCamera->SetFocusToLocalPlayer ();
}
else
{
// Put the focus on that player
m_pCamera->SetFocus ( pPlayer, MODE_BEHINDCAR, false );
}
break;
}
default:
return;
}
}
}
}
示例4: ReadLocalData
void CClientPacketRecorder::ReadLocalData(FILE* pFile)
{
// Grab the local player
CClientPlayer* pPlayer = m_pManager->GetPlayerManager()->GetLocalPlayer();
if (pPlayer)
{
// Grab the vehicle
CClientVehicle* pVehicle = pPlayer->GetOccupiedVehicle();
if (pVehicle)
{
// Temp vars
CMatrix matVehicle;
CVector vecMoveSpeed;
CVector vecTurnSpeed;
float fHealth;
// Read it out
fread(&matVehicle.vRight.fX, sizeof(float), 1, pFile);
fread(&matVehicle.vRight.fY, sizeof(float), 1, pFile);
fread(&matVehicle.vRight.fZ, sizeof(float), 1, pFile);
fread(&matVehicle.vFront.fX, sizeof(float), 1, pFile);
fread(&matVehicle.vFront.fY, sizeof(float), 1, pFile);
fread(&matVehicle.vFront.fZ, sizeof(float), 1, pFile);
fread(&matVehicle.vUp.fX, sizeof(float), 1, pFile);
fread(&matVehicle.vUp.fY, sizeof(float), 1, pFile);
fread(&matVehicle.vUp.fZ, sizeof(float), 1, pFile);
fread(&matVehicle.vPos.fX, sizeof(float), 1, pFile);
fread(&matVehicle.vPos.fY, sizeof(float), 1, pFile);
fread(&matVehicle.vPos.fZ, sizeof(float), 1, pFile);
fread(&vecMoveSpeed.fX, sizeof(float), 1, pFile);
fread(&vecMoveSpeed.fY, sizeof(float), 1, pFile);
fread(&vecMoveSpeed.fZ, sizeof(float), 1, pFile);
fread(&vecTurnSpeed.fX, sizeof(float), 1, pFile);
fread(&vecTurnSpeed.fY, sizeof(float), 1, pFile);
fread(&vecTurnSpeed.fZ, sizeof(float), 1, pFile);
fread(&fHealth, sizeof(float), 1, pFile);
CControllerState cs;
fread(&cs, sizeof(CControllerState), 1, pFile);
// Set the data
pVehicle->SetMatrix(matVehicle);
pVehicle->SetMoveSpeed(vecMoveSpeed);
pVehicle->SetTurnSpeed(vecTurnSpeed);
pVehicle->SetHealth(fHealth);
// Set the controller state
CControllerState csLast;
g_pGame->GetPad()->Disable(true);
g_pGame->GetPad()->GetCurrentControllerState(&csLast);
g_pGame->GetPad()->SetLastControllerState(&csLast);
g_pGame->GetPad()->SetCurrentControllerState(&cs);
}
}
}
示例5: argStream
int CLuaTeamDefs::GetPlayersInTeam ( lua_State* luaVM )
{
CClientTeam* pTeam = NULL;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pTeam );
if ( !argStream.HasErrors () )
{
lua_newtable ( luaVM );
unsigned int uiIndex = 0;
list < CClientPlayer* > ::const_iterator iter = pTeam->IterBegin ();
for ( ; iter != pTeam->IterEnd (); iter++ )
{
CClientPlayer* pPlayer = *iter;
if ( !pPlayer->IsBeingDeleted () )
{
lua_pushnumber ( luaVM, ++uiIndex );
lua_pushelement ( luaVM, pPlayer );
lua_settable ( luaVM, -3 );
}
}
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例6: GetPlayerTeam
int CLuaPlayerDefs::GetPlayerTeam(lua_State* luaVM)
{
// team getPlayerTeam ( player thePlayer )
CClientPlayer* pPlayer;
CScriptArgReader argStream(luaVM);
argStream.ReadUserData(pPlayer);
if (!argStream.HasErrors())
{
// Grab his team and return it
CClientTeam* pTeam = pPlayer->GetTeam();
if (pTeam)
{
lua_pushelement(luaVM, pTeam);
return 1;
}
}
else
m_pScriptDebugging->LogCustom(luaVM, argStream.GetFullErrorMessage());
// Failed
lua_pushboolean(luaVM, false);
return 1;
}
示例7: CClientPlayer
void CFoo::DoPulse ( void )
{
CClientManager* pManager = g_pClientGame->GetManager ();
if ( pManager->IsGameLoaded () )
{
CClientPlayerManager* pPlayerManager = pManager->GetPlayerManager ();
CClientPlayer* pLocal = pManager->GetPlayerManager ()->GetLocalPlayer ();
if ( !pLocal ) return;
CVector vecLocal;
pLocal->GetPosition ( vecLocal );
CClientCamera* pCamera = pManager->GetCamera ();
/*
CClientVehicle* pVehicle = pLocal->GetOccupiedVehicle ();
if ( pVehicle )
{
unsigned char ucGear = pVehicle->GetGameVehicle ()->GetCurrentGear ();
g_pCore->GetGraphics ()->DrawText ( 200, 200, 0xFFFFFFFF, 1.0f, "Gear = %u", ucGear );
}
*/
// ChrML: Reproduces issue #2741
if ( bFoo_PlayerLimitCrash )
{
static CClientPed* pPed = NULL;
if ( !pPed )
{
pPed = new CClientPlayer ( pManager, 50 );
CVector vecLocal;
pPlayerManager->GetLocalPlayer ()->GetPosition ( vecLocal );
vecLocal.fX += 10;
pPed->SetPosition ( vecLocal );
}
static unsigned long ulTestTime = 0;
if ( ulTestTime == 0 )
{
ulTestTime = CClientTime::GetTime () + 50;
}
if ( CClientTime::GetTime () > ulTestTime )
{
ulTestTime = CClientTime::GetTime () + 50;
static unsigned int uiIndex = 0;
++uiIndex;
pPed->SetModel ( uiIndex );
if ( uiIndex > 290 )
uiIndex = 0;
}
}
}
}
示例8: SetPlayerNametagColor
void CPlayerRPCs::SetPlayerNametagColor(CClientEntity* pSource, NetBitStreamInterface& bitStream)
{
unsigned char ucR, ucG, ucB;
if (bitStream.Read(ucR) && bitStream.Read(ucG) && bitStream.Read(ucB))
{
CClientPlayer* pPlayer = m_pPlayerManager->Get(pSource->GetID());
if (pPlayer)
pPlayer->SetNametagOverrideColor(ucR, ucG, ucB);
}
}
示例9: COMMAND_RadioPrevious
void COMMAND_RadioPrevious ( const char* szCmdLine )
{
if ( g_pClientGame )
{
CClientPlayer* pPlayer = g_pClientGame->GetPlayerManager ()->GetLocalPlayer ();
if ( pPlayer )
{
pPlayer->PreviousRadioChannel ();
}
}
}
示例10: SetPlayerNametagShowing
void CPlayerRPCs::SetPlayerNametagShowing ( CClientEntity* pSource, NetBitStreamInterface& bitStream )
{
unsigned char ucShowing;
if ( bitStream.Read ( ucShowing ) )
{
CClientPlayer* pPlayer = m_pPlayerManager->Get ( pSource->GetID () );
if ( pPlayer )
{
pPlayer->SetNametagShowing ( ( ucShowing == 1 ) );
}
}
}
示例11: ResetAll
void CClientPlayerManager::ResetAll ( void )
{
vector < CClientPlayer* > ::const_iterator iter = m_Players.begin ();
for ( ; iter != m_Players.end (); iter++ )
{
CClientPlayer * pPlayer = *iter;
if ( pPlayer )
{
pPlayer->Reset ();
}
}
}
示例12: argStream
int CLuaFunctionDefs::GetSoundEffects ( lua_State* luaVM )
{
CClientPlayer* pPlayer = NULL;
CClientSound* pSound = NULL;
CScriptArgReader argStream ( luaVM );
if ( argStream.NextIsUserDataOfType < CClientSound > ( ) )
{
argStream.ReadUserData ( pSound );
}
else if ( argStream.NextIsUserDataOfType < CClientPlayer > ( ) )
{
argStream.ReadUserData ( pPlayer );
}
else
{
m_pScriptDebugging->LogBadPointer ( luaVM, "sound/player", 1 );
lua_pushboolean ( luaVM, false );
return false;
}
if ( !argStream.HasErrors() )
{
if ( pSound )
{
std::map < std::string, int > iFxEffects = m_pManager->GetSoundManager()->GetFxEffects();
lua_newtable ( luaVM );
for ( std::map < std::string, int >::const_iterator iter = iFxEffects.begin(); iter != iFxEffects.end(); ++iter )
{
lua_pushboolean ( luaVM, pSound->IsFxEffectEnabled ( (*iter).second ) );
lua_setfield ( luaVM, -2, (*iter).first.c_str () );
}
return 1;
}
else if ( pPlayer )
{
CClientPlayerVoice * pPlayerVoice = pPlayer->GetVoice ( );
std::map < std::string, int > iFxEffects = m_pManager->GetSoundManager()->GetFxEffects();
lua_newtable ( luaVM );
for ( std::map < std::string, int >::const_iterator iter = iFxEffects.begin(); iter != iFxEffects.end(); ++iter )
{
lua_pushboolean ( luaVM, pPlayerVoice->IsFxEffectEnabled ( (*iter).second ) );
lua_setfield ( luaVM, -2, (*iter).first.c_str () );
}
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );
lua_pushboolean ( luaVM, false );
return 1;
}
示例13: SetPlayerTeam
void CPlayerRPCs::SetPlayerTeam ( CClientEntity* pSource, NetBitStreamInterface& bitStream )
{
ElementID TeamID;
if ( bitStream.Read ( TeamID ) )
{
CClientTeam* pTeam = m_pTeamManager->GetTeam ( TeamID );
CClientPlayer* pPlayer = m_pPlayerManager->Get ( pSource->GetID () );
if ( pPlayer )
{
pPlayer->SetTeam ( pTeam, true );
}
}
}
示例14: Hook_ProjectileAllow
bool CClientProjectileManager::Hook_ProjectileAllow ( CEntity * pGameCreator, eWeaponType weaponType, CVector * origin, float fForce, CVector * target, CEntity * targetEntity )
{
// Called before projectile creation, we need to decide to allow or cancel it here
// Is this a local projectile?
CClientPlayer * pLocalPlayer = m_pManager->GetPlayerManager ()->GetLocalPlayer ();
// Store the creator/local variables for the next stage
m_pCreator = m_pManager->FindEntity ( pGameCreator, true );
m_bIsLocal = ( m_pCreator == pLocalPlayer || ( pLocalPlayer->GetOccupiedVehicleSeat () == 0 && m_pCreator == pLocalPlayer->GetOccupiedVehicle () ) );
return ( m_bCreating || m_bIsLocal );
}
示例15: GetPlayerNames
void CClient::GetPlayerNames(std::vector<SString>& vPlayerNames)
{
if (g_pClientGame)
{
vPlayerNames.clear();
for (std::vector<CClientPlayer*>::const_iterator iter = g_pClientGame->GetPlayerManager()->IterBegin();
iter != g_pClientGame->GetPlayerManager()->IterEnd(); ++iter)
{
CClientPlayer* pClient = *iter;
SString strPlayerName = pClient->GetNametagText();
vPlayerNames.push_back(strPlayerName);
}
}
}