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


C++ CScriptArgReader::ReadBool方法代码示例

本文整理汇总了C++中CScriptArgReader::ReadBool方法的典型用法代码示例。如果您正苦于以下问题:C++ CScriptArgReader::ReadBool方法的具体用法?C++ CScriptArgReader::ReadBool怎么用?C++ CScriptArgReader::ReadBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CScriptArgReader的用法示例。


在下文中一共展示了CScriptArgReader::ReadBool方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddCommandHandler

int CLuaFunctionDefs::AddCommandHandler ( lua_State* luaVM )
{
    //  bool addCommandHandler ( string commandName, function handlerFunction, [bool restricted = false, bool caseSensitive = true] )
    SString strKey; CLuaFunctionRef iLuaFunction; bool bRestricted; bool bCaseSensitive;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( strKey );
    argStream.ReadFunction ( iLuaFunction );
    argStream.ReadBool ( bRestricted, false );
    argStream.ReadBool ( bCaseSensitive, true );
    argStream.ReadFunctionComplete ();

    if ( !argStream.HasErrors () )
    {
        // Grab our VM
        CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
        if ( pLuaMain )
        {
            // Add them to our list over command handlers
            if ( m_pRegisteredCommands->AddCommand ( pLuaMain, strKey, iLuaFunction, bRestricted, bCaseSensitive ) )
            {
                lua_pushboolean ( luaVM, true );
                return 1;
            }
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:Bargas,项目名称:mtasa-blue,代码行数:32,代码来源:CLuaFunctionDefs.Server.cpp

示例2: ShowCursor

int CLuaFunctionDefs::ShowCursor ( lua_State* luaVM )
{
    bool bShow = false, bToggleControls = true;
    CScriptArgReader argStream ( luaVM );
    argStream.ReadBool ( bShow );
    argStream.ReadBool ( bToggleControls, true );

    if ( !argStream.HasErrors ( ) )
    {
        // Get the VM
        CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
        if ( pLuaMain )
        {
            // Grab the resource belonging to this VM
            CResource* pResource = pLuaMain->GetResource ();
            if ( pResource )
            {
                // Show/hide it inside that resource
                pResource->ShowCursor ( bShow, bToggleControls );
                lua_pushboolean ( luaVM, true );
                return 1;
            }
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );

    // Fail
    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:31,代码来源:CLuaFunctionDefs.Input.cpp

示例3: SetSoundEffectEnabled

int CLuaFunctionDefs::SetSoundEffectEnabled ( lua_State* luaVM )
{
    CClientPlayer* pPlayer = NULL;
    CClientSound* pSound = NULL;
    SString strEffectName = "";
    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;
    }
    argStream.ReadString ( strEffectName );

    if ( !argStream.HasErrors() )
    {
        if ( pSound )
        {
            bool bEnable = false;
            if ( argStream.NextIsBool ( ) )
            {
                argStream.ReadBool ( bEnable );
            }
            if ( CStaticFunctionDefinitions::SetSoundEffectEnabled ( *pSound, strEffectName, bEnable ) )
            {
                lua_pushboolean ( luaVM, true );
                return 1;
            }
        }
        else if ( pPlayer )
        {
            bool bEnable = false;
            if ( argStream.NextIsBool ( ) )
            {
                argStream.ReadBool ( bEnable );
            }
            if ( CStaticFunctionDefinitions::SetSoundEffectEnabled ( *pPlayer, strEffectName, bEnable ) )
            {
                lua_pushboolean ( luaVM, true );
                return 1;
            }
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:ntauthority,项目名称:openvice,代码行数:57,代码来源:CLuaFunctionDefs.Audio.cpp

示例4: SetCameraClip

int CLuaFunctionDefs::SetCameraClip ( lua_State* luaVM )
{
    bool bObjects = true;
    bool bVehicles = true;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadBool ( bObjects, true );
    argStream.ReadBool ( bVehicles, true );

    m_pManager->GetCamera ()->SetCameraClip ( bObjects, bVehicles );

    lua_pushboolean ( luaVM, true );
    return 1;
}
开发者ID:Jusonex,项目名称:mtasa-awesomium,代码行数:14,代码来源:CLuaFunctionDefs.Camera.cpp

示例5: setHeatHaze

int CLuaWorldDefs::setHeatHaze ( lua_State* luaVM )
{
    CScriptArgReader argStream ( luaVM );

    // Set the new heat haze settings
    SHeatHazeSettings heatHaze;
    argStream.ReadNumber ( heatHaze.ucIntensity );
    argStream.ReadNumber ( heatHaze.ucRandomShift, 0 );
    argStream.ReadNumber ( heatHaze.usSpeedMin, 12 );
    argStream.ReadNumber ( heatHaze.usSpeedMax, 18 );
    argStream.ReadNumber ( heatHaze.sScanSizeX, 75 );
    argStream.ReadNumber ( heatHaze.sScanSizeY, 80 );
    argStream.ReadNumber ( heatHaze.usRenderSizeX, 80 );
    argStream.ReadNumber ( heatHaze.usRenderSizeY, 85 );
    argStream.ReadBool ( heatHaze.bInsideBuilding, false );

    if ( !argStream.HasErrors () )
    {
        if ( CStaticFunctionDefinitions::SetHeatHaze ( heatHaze ) )
        {
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    // Return false
    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:AdiBoy,项目名称:mtasa-blue,代码行数:31,代码来源:CLuaWorldDefs.cpp

示例6: PlaySFX

int CLuaFunctionDefs::PlaySFX ( lua_State* luaVM )
{
//  sound playSFX ( string audioContainer, int bankIndex, int audioIndex [, loop = false ] )
    eAudioLookupIndex containerIndex; int iBankIndex; int iAudioIndex; bool bLoop;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadEnumString ( containerIndex );
    argStream.ReadNumber ( iBankIndex );
    argStream.ReadNumber ( iAudioIndex );
    argStream.ReadBool ( bLoop, false );

    if ( !argStream.HasErrors () )
    {
        CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
        if ( pLuaMain )
        {
            CResource* pResource = pLuaMain->GetResource ();
            if ( pResource )
            {
                CClientSound* pSound;
                if ( CStaticFunctionDefinitions::PlaySFX ( pResource, containerIndex, iBankIndex, iAudioIndex, bLoop, pSound ) )
                {
                    lua_pushelement ( luaVM, pSound );
                    return 1;
                }
            }
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:ntauthority,项目名称:openvice,代码行数:34,代码来源:CLuaFunctionDefs.Audio.cpp

示例7: SetSoundProperties

int CLuaFunctionDefs::SetSoundProperties ( lua_State* luaVM )
{
    CClientSound* pSound = NULL;
    bool bReversed = false;
    float fSampleRate = 0.0f, fTempo = 0.0f, fPitch = 0.0f;
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pSound );
    argStream.ReadNumber ( fSampleRate );
    argStream.ReadNumber ( fTempo );
    argStream.ReadNumber ( fPitch );
    argStream.ReadBool ( bReversed, false );

    if ( !argStream.HasErrors () )
    {
        if ( pSound )
        {
            if ( CStaticFunctionDefinitions::SetSoundProperties ( *pSound, fSampleRate, fTempo, fPitch, bReversed ) )
            {
                lua_pushboolean ( luaVM, true );
                return 1;
            }
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:ntauthority,项目名称:openvice,代码行数:29,代码来源:CLuaFunctionDefs.Audio.cpp

示例8: AddEvent

int CLuaFunctionDefs::AddEvent ( lua_State* luaVM )
{
//  bool addEvent ( string eventName [, bool allowRemoteTrigger = false ] )
    SString strName; bool bAllowRemoteTrigger;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( strName );
    argStream.ReadBool ( bAllowRemoteTrigger, false );

    if ( !argStream.HasErrors () )
    {
        // Grab our virtual machine
        CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
        if ( pLuaMain )
        {
            // Do it
            if ( CStaticFunctionDefinitions::AddEvent ( *pLuaMain, strName, bAllowRemoteTrigger ) )
            {
                lua_pushboolean ( luaVM, true );
                return 1;
            }
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, SString ( "Bad argument @ '%s' [%s]", "addEvent", *argStream.GetErrorMessage () ) );

    // Failed
    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:EagleShen,项目名称:MTA,代码行数:30,代码来源:CLuaFunctionDefs.Event.cpp

示例9: SetWorldSoundEnabled

int CLuaFunctionDefs::SetWorldSoundEnabled ( lua_State* luaVM )
{
//  setWorldSoundEnabled ( int group, [int index, ], bool enable )
    int group; int index = -1; bool bEnabled;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadNumber ( group );
    if ( !argStream.NextIsBool () )
        argStream.ReadNumber ( index );
    argStream.ReadBool ( bEnabled );

    if ( !argStream.HasErrors () )
    {
        if ( CStaticFunctionDefinitions::SetWorldSoundEnabled ( group, index, bEnabled ) )
        {
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:ntauthority,项目名称:openvice,代码行数:25,代码来源:CLuaFunctionDefs.Audio.cpp

示例10: GiveWeapon

int CLuaPedDefs::GiveWeapon ( lua_State* luaVM )
{
    // bool giveWeapon ( ped thePlayer, int weapon [, int ammo=30, bool setAsCurrent=false ] )
    CElement* pElement; eWeaponType weaponType; ushort usAmmo; bool bSetAsCurrent;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pElement );
    argStream.ReadEnumStringOrNumber ( weaponType );
    argStream.ReadNumber ( usAmmo, 30 );
    argStream.ReadBool ( bSetAsCurrent, false );

    if ( !argStream.HasErrors () )
    {
        if ( CStaticFunctionDefinitions::GiveWeapon ( pElement, weaponType, usAmmo, bSetAsCurrent ) )
        {
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:GDog1985,项目名称:mtasa-blue,代码行数:25,代码来源:CLuaPedDefs.cpp

示例11: SetPlayerNametagShowing

int CLuaPlayerDefs::SetPlayerNametagShowing ( lua_State* luaVM )
{
    //  bool setPlayerNametagShowing ( player thePlayer, bool showing )
    CClientEntity* pPlayer; bool bShowing;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pPlayer );
    argStream.ReadBool ( bShowing );

    if ( !argStream.HasErrors () )
    {
        // Set the new rotation
        if ( CStaticFunctionDefinitions::SetPlayerNametagShowing ( *pPlayer, bShowing ) )
        {
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    // Failed
    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:Anubhav652,项目名称:mtasa-blue,代码行数:25,代码来源:CLuaPlayerDefs.cpp

示例12: EngineReplaceModel

int CLuaEngineDefs::EngineReplaceModel ( lua_State* luaVM )
{
    CClientDFF* pDFF;
    SString strModelName;
    bool bAlphaTransparency;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pDFF );
    argStream.ReadString ( strModelName );
    argStream.ReadBool ( bAlphaTransparency, false );

    if ( !argStream.HasErrors () )
    {
        ushort usModelID = CModelNames::ResolveModelID ( strModelName );
        if ( usModelID != INVALID_MODEL_ID )
        {
            if ( pDFF->ReplaceModel ( usModelID, bAlphaTransparency ) )
            {
                lua_pushboolean ( luaVM, true );
                return 1;
            }
            else
                argStream.SetCustomError( SString( "Model ID %d replace failed", usModelID ) );
        }
        else
            argStream.SetCustomError( "Expected valid model ID or name at argument 2" );
    }
    if ( argStream.HasErrors () )
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:Jusonex,项目名称:mtasa-blue,代码行数:33,代码来源:CLuaEngineDefs.cpp

示例13: SetPedRotation

int CLuaPedDefs::SetPedRotation ( lua_State* luaVM )
{
    //  setPedRotation ( element ped, float rotation [, bool fixPedRotation = false ] )
    CElement* pElement; float fRotation; bool bNewWay;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pElement );
    argStream.ReadNumber ( fRotation );
    argStream.ReadBool ( bNewWay, false );

    if ( !argStream.HasErrors () )
    {
        if ( CStaticFunctionDefinitions::SetPedRotation ( pElement, fRotation, bNewWay ) )
        {
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    // Failed
    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:GDog1985,项目名称:mtasa-blue,代码行数:25,代码来源:CLuaPedDefs.cpp

示例14: fxAddGunshot

int CLuaFxDefs::fxAddGunshot ( lua_State* luaVM )
{
    // bool fxAddGunshot ( float posX, float posY, float posZ, float dirX, float dirY, float dirZ, [bool includeSparks=true] )

    // Verify types
    CVector vecPosition, vecDirection;
    bool bIncludeSparks = true;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadVector3D ( vecPosition );
    argStream.ReadVector3D ( vecDirection );
    argStream.ReadBool ( bIncludeSparks, true );

    if ( !argStream.HasErrors ( ) )
    {
        if ( CStaticFunctionDefinitions::FxAddGunshot ( vecPosition, vecDirection, bIncludeSparks ) )
        {
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );

    // Failed
    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:Jusonex,项目名称:mtasa-awesomium,代码行数:28,代码来源:CLuaFxDefs.cpp

示例15: SetSoundPanEnabled

int CLuaFunctionDefs::SetSoundPanEnabled ( lua_State* luaVM )
{
    CClientSound* pSound = NULL;
    bool bEnabled = true;
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pSound );
    argStream.ReadBool ( bEnabled );

    if ( !argStream.HasErrors () )
    {
        if ( pSound )
        {
            if ( CStaticFunctionDefinitions::SetSoundPanEnabled ( *pSound, bEnabled ) )
            {
                lua_pushboolean ( luaVM, true );
                return 1;
            }
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:ntauthority,项目名称:openvice,代码行数:25,代码来源:CLuaFunctionDefs.Audio.cpp


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