当前位置: 首页>>代码示例>>C++>>正文


C++ CClientPlayer类代码示例

本文整理汇总了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;
}
开发者ID:ccw808,项目名称:mtasa-blue,代码行数:26,代码来源:CLuaPlayerDefs.cpp

示例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;
}
开发者ID:ccw808,项目名称:mtasa-blue,代码行数:25,代码来源:CLuaPlayerDefs.cpp

示例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;
            }
        }
    }
}
开发者ID:EagleShen,项目名称:MTA,代码行数:34,代码来源:CCameraRPCs.cpp

示例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);
        }
    }
}
开发者ID:ccw808,项目名称:mtasa-blue,代码行数:60,代码来源:CClientPacketRecorder.cpp

示例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;
}
开发者ID:Jusonex,项目名称:mtasa-blue,代码行数:32,代码来源:CLuaTeamDefs.cpp

示例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;
}
开发者ID:ccw808,项目名称:mtasa-blue,代码行数:25,代码来源:CLuaPlayerDefs.cpp

示例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;
            }
        }
    }
}
开发者ID:50p,项目名称:multitheftauto,代码行数:58,代码来源:CFoo.cpp

示例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);
    }
}
开发者ID:ccw808,项目名称:mtasa-blue,代码行数:10,代码来源:CPlayerRPCs.cpp

示例9: COMMAND_RadioPrevious

void COMMAND_RadioPrevious ( const char* szCmdLine )
{
    if ( g_pClientGame )
    {
        CClientPlayer* pPlayer = g_pClientGame->GetPlayerManager ()->GetLocalPlayer ();
        if ( pPlayer )
        {
            pPlayer->PreviousRadioChannel ();
        }
    }
}
开发者ID:qaisjp,项目名称:green-candy,代码行数:11,代码来源:ClientCommands.cpp

示例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 ) );
        }
    }
}
开发者ID:Jusonex,项目名称:mtasa-awesomium,代码行数:12,代码来源:CPlayerRPCs.cpp

示例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 ();
        }
    }
}
开发者ID:StarSoftwareBuilder,项目名称:mtasa-blue,代码行数:12,代码来源:CClientPlayerManager.cpp

示例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;
}
开发者ID:ntauthority,项目名称:openvice,代码行数:52,代码来源:CLuaFunctionDefs.Audio.cpp

示例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 );
        }
    }
}
开发者ID:Jusonex,项目名称:mtasa-awesomium,代码行数:13,代码来源:CPlayerRPCs.cpp

示例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 );
}
开发者ID:EagleShen,项目名称:MTA,代码行数:13,代码来源:CClientProjectileManager.cpp

示例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);
        }
    }
}
开发者ID:Audifire,项目名称:mtasa-blue,代码行数:14,代码来源:CClient.cpp


注:本文中的CClientPlayer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。