[help] spawning a creature

Hello guys,

I am having a problem, I am trying to spawn a creature through C++ to also get the pointer to that creature without having to calling a function for it, so I looked up the .npc add command and let that guide me, though my worldserver is still crashing when I call the function I made that spawns a creature, this is what I have :



Creature * me = new Creature; 

if(!me)

{

Map* map= sMapMgr->FindMap(1,0);

me->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, 1, 60000, 0, 35, -3774.096924f, 1096.924805f, 131.969269f, 6.176457f);

map->AddToMap(me);

me->SaveToDB(map->GetId(), map->GetSpawnMode(), 1);

}

Any suggestions to fix this or another way to spawn a creature?

https://github.com/TrinityCore/TrinityCore/blob/master/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp#L208

aha, the summoncreature method works as a spawn?