本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}