You made a few mistakes it should be
Code:
static bool HandleGameObjectKleinesHausCommand(ChatHandler* handler, char const* args)
{
uint32 objectId = 70000;
unit64 itemId = 1200;
Player* player = handler->GetSession()->GetPlayer();
if (!player->HasItem(itemID))
{
handler->PSendSysMessage("You do not have the right item!");
return false;
}
else
player->removeItem(itemID, 1);
const GameObjectTemplate* objectInfo = sObjectMgr->GetGameObjectTemplate(objectId);
float x = float(player->GetPositionX());
float y = float(player->GetPositionY());
float z = float(player->GetPositionZ());
float o = float(player->GetOrientation());
Map* map = player->GetMap();
GameObject* object = new GameObject;
uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT);
z = z-3;
if (!object->Create(guidLow, objectInfo->entry, map, player->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
{
delete object;
return false;
}
// fill the gameobject data and save to the db
object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), player->GetPhaseMaskForSpawn());
// this will generate a new guid if the object is in an instance
if (!object->LoadGameObjectFromDB(guidLow, map))
{
delete object;
return false;
}
// TODO: is it really necessary to add both the real and DB table guid here ?
sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGOData(guidLow));
handler->PSendSysMessage("You create a house!");
return true;
}