コード例 #1
0
ファイル: CPedManager.cpp プロジェクト: AdiBoy/mtasa-blue
CPed* CPedManager::CreateFromXML ( CElement* pParent, CXMLNode& Node, CLuaMain* pLuaMain, CEvents* pEvents )
{
    // Create the Ped
    CPed* pPed = new CPed ( this, pParent, &Node, 400 );

    // Verify the Ped id and load the data from xml
    if ( pPed->GetID () == INVALID_ELEMENT_ID ||
         !pPed->LoadFromCustomData ( pLuaMain, pEvents ) )
    {
        delete pPed;
        return NULL;
    }

    // Make sure hes alive (leave to scripts?)
    pPed->SetIsDead ( false );
    pPed->SetSpawned ( true );
    pPed->SetHealth ( 100.0f );

    // Return the created Ped
    return pPed;
}