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


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

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


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

示例1: TakePlayerMoney

int CLuaPlayerDefs::TakePlayerMoney ( lua_State* luaVM )
{
    //  bool takePlayerMoney ( int amount )
    int lMoney;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadNumber ( lMoney );

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

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

示例2: GetPlayerPing

int CLuaPlayerDefs::GetPlayerPing ( lua_State* luaVM )
{
    //  int getPlayerPing ( player thePlayer )
    CClientPlayer* pPlayer;

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

    if ( !argStream.HasErrors () )
    {
        // Grab his ping
        unsigned int uiPing = pPlayer->GetPing ();
        lua_pushnumber ( luaVM, uiPing );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

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

示例3: GetResourceRootElement

int CLuaResourceDefs::GetResourceRootElement ( lua_State* luaVM )
{
    // Verify arguments
    CResource* pResource = NULL;
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pResource, NULL );

    // No resource given, get this resource's root
    if ( !argStream.HasErrors () )
    {
        if ( !pResource )
        {
            // Find our vm and get the root
            CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
            if ( pLuaMain )
            {
                pResource = pLuaMain->GetResource ();
            }
        }

        // Did we find a resource?
        if ( pResource )
        {
            // Grab the root element of it and return it if it existed
            CClientEntity* pEntity = pResource->GetResourceEntity ();
            if ( pEntity )
            {
                lua_pushelement ( luaVM, pEntity );
                return 1;
            }
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

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

示例4: SetWeaponClipAmmo

int CLuaFunctionDefs::SetWeaponClipAmmo ( lua_State* luaVM )
{
    CClientWeapon * pWeapon = NULL;
    int iAmmo = 0;
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pWeapon );
    argStream.ReadNumber ( iAmmo );

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

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

示例5: ExecuteCommandHandler

int CLuaFunctionDefs::ExecuteCommandHandler ( lua_State* luaVM )
{
    //  bool executeCommandHandler ( string commandName, player thePlayer, [ string args ] )
    SString strKey; CElement* pElement; SString strArgs;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( strKey );
    argStream.ReadUserData ( pElement );
    argStream.ReadString ( strArgs, "" );

    if ( !argStream.HasErrors () )
    {

        // Grab our VM
        CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
        if ( pLuaMain )
        {
            CClient* pClient = NULL;
            if ( pElement->GetType () == CElement::PLAYER )
                pClient = static_cast <CClient*> ( static_cast <CPlayer*> ( pElement ) );

            if ( pClient )
            {

                // Call it
                if ( m_pRegisteredCommands->ProcessCommand ( strKey, strArgs, pClient ) )
                {
                    lua_pushboolean ( luaVM, true );
                    return 1;
                }
            }
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

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

示例6: InjectBrowserMouseWheel

int CLuaFunctionDefs::InjectBrowserMouseWheel ( lua_State* luaVM )
{
//  bool injectMouseWheel ( browser webBrowser, int scrollVertical, int scrollHorizontal )
    CClientWebBrowser* pWebBrowser; int iScrollVert; int iScrollHorz;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pWebBrowser );
    argStream.ReadNumber ( iScrollVert );
    argStream.ReadNumber ( iScrollHorz );

    if ( !argStream.HasErrors() )
    {
        pWebBrowser->InjectMouseWheel ( iScrollVert, iScrollHorz );
        lua_pushboolean ( luaVM, true );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

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

示例7: SetWeaponState

int CLuaFunctionDefs::SetWeaponState ( lua_State* luaVM )
{
    CClientWeapon * pWeapon;
    eWeaponState weaponState;
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pWeapon );
    argStream.ReadEnumString ( weaponState );

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

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

示例8: setOcclusionsEnabled

int CLuaWorldDefs::setOcclusionsEnabled ( lua_State* luaVM )
{
//  bool setOcclusionsEnabled ( bool enabled )
    bool bEnabled;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadBool( bEnabled );

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

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

示例9: argStream

int CLuaVector4Defs::Destroy ( lua_State* luaVM )
{
    CLuaVector4D* pVector = NULL;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pVector );

    if ( !argStream.HasErrors () )
    {
        delete pVector;

        lua_pushboolean ( luaVM, true );
        return 1;
    }
    else
    {
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );
    }

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

示例10: setJetpackWeaponEnabled

int CLuaWorldDefs::setJetpackWeaponEnabled ( lua_State* luaVM )
{
    eWeaponType weaponType;
    bool bEnabled;
    CScriptArgReader argStream ( luaVM );
    argStream.ReadEnumStringOrNumber ( weaponType );
    argStream.ReadBool ( bEnabled );

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

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

示例11: fileRead

int CLuaFileDefs::fileRead ( lua_State* luaVM )
{
//  string fileRead ( file theFile, int count )
    CScriptFile* pFile; unsigned long ulCount = 0;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pFile );
    argStream.ReadNumber ( ulCount );

    if ( !argStream.HasErrors () )
    {
        // Reading zero bytes from a file results in an empty string
        if ( ulCount == 0 )
        {
            lua_pushstring ( luaVM, "" );
            return 1;
        }

        // Allocate a buffer to read the stuff into and read some :~ into it
        CBuffer buffer;

        long lBytesRead = pFile->Read ( ulCount, buffer );
        if ( lBytesRead != -1 )
        {
            // Push the string onto the Lua stack. Use pushlstring so we are binary
            // compatible. Normal push string takes zero terminated strings.
            lua_pushlstring ( luaVM, buffer.GetData(), lBytesRead );
            return 1;
        }

        m_pScriptDebugging->LogBadPointer ( luaVM, "file", 1 );        
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
    
    // Error
    lua_pushnil ( luaVM );
    return 1;
}
开发者ID:Jusonex,项目名称:mtasa-blue,代码行数:39,代码来源:CLuaFileDefs.cpp

示例12: RemoveRuleValue

int CLuaFunctionDefs::RemoveRuleValue ( lua_State* luaVM )
{
    //  bool removeRuleValue ( string key )
    SString strKey;

    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( strKey );

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

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

示例13: GetWeaponNameFromID

int CLuaFunctionDefs::GetWeaponNameFromID ( lua_State* luaVM )
{
    unsigned char ucID = 0;
    CScriptArgReader argStream ( luaVM );
    argStream.ReadNumber( ucID );

    if ( !argStream.HasErrors ( ) )
    {

        SString strBuffer;
        if ( CStaticFunctionDefinitions::GetWeaponNameFromID ( ucID, strBuffer ) )
        {
            lua_pushstring ( luaVM, strBuffer );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );

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

示例14: argStream

int CLuaCryptDefs::Md5 ( lua_State* luaVM )
{
    SString strMd5 = "";
    CScriptArgReader argStream ( luaVM );
    argStream.ReadString ( strMd5 );

    if ( !argStream.HasErrors () )
    {
        MD5 md5bytes;
        char szResult[33];
        CMD5Hasher hasher;
        hasher.Calculate ( strMd5, strMd5.length (), md5bytes );
        hasher.ConvertToHex ( md5bytes, szResult );
        lua_pushstring ( luaVM, szResult );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

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

示例15: textDisplayAddText

int CLuaTextDefs::textDisplayAddText ( lua_State* luaVM )
{
    CTextDisplay * pTextDisplay;
    CTextItem * pTextItem;  

    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pTextDisplay );
    argStream.ReadUserData ( pTextItem );

    if ( !argStream.HasErrors ( ) )
    {
        pTextDisplay->Add ( pTextItem );

        lua_pushboolean ( luaVM, true );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );

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


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