Clone the gobject add command (C++) Doesnt work! menu

User Tag List

Results 1 to 7 of 7
  1. #1
    Nic03's Avatar Corporal
    Reputation
    1
    Join Date
    Feb 2010
    Posts
    20
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Clone the gobject add command (C++) Doesnt work!

    Problem solved.
    Last edited by Nic03; 12-02-2012 at 01:53 PM.

    Clone the gobject add command (C++) Doesnt work!
  2. #2
    Terrorblade's Avatar Contributor I spent 5k CC and all I got was this user title
    CoreCoins Purchaser
    Reputation
    153
    Join Date
    Oct 2010
    Posts
    312
    Thanks G/R
    6/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well you left in the choice of adding an object id and spawn time here is the code for forced spawning of that id Click Me For Le Codes
    Stuff & Things

  3. #3
    Nic03's Avatar Corporal
    Reputation
    1
    Join Date
    Feb 2010
    Posts
    20
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Problem solved.
    Last edited by Nic03; 12-02-2012 at 01:53 PM.

  4. #4
    Terrorblade's Avatar Contributor I spent 5k CC and all I got was this user title
    CoreCoins Purchaser
    Reputation
    153
    Join Date
    Oct 2010
    Posts
    312
    Thanks G/R
    6/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Nic03 View Post
    Thank you! It works... but one question. Is it possible that the player must pay with items for every use the command?

    For example:
    The player has 5 Item A and 2 Item B in the inventory. If the user write the command, the server take 5 Item A and 1 Item B from his inventory and execute the command. If the user has not enough items, he get a error message and the server do not execute the command.
    Yes, if you have a player pointer look for a function like HasItem and remove item, if player doesn't have item-> send message and return false.
    Stuff & Things

  5. #5
    Nic03's Avatar Corporal
    Reputation
    1
    Join Date
    Feb 2010
    Posts
    20
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Problem solved.
    Last edited by Nic03; 12-02-2012 at 01:53 PM.

  6. #6
    Terrorblade's Avatar Contributor I spent 5k CC and all I got was this user title
    CoreCoins Purchaser
    Reputation
    153
    Join Date
    Oct 2010
    Posts
    312
    Thanks G/R
    6/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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;
        }
    Stuff & Things

  7. #7
    Nic03's Avatar Corporal
    Reputation
    1
    Join Date
    Feb 2010
    Posts
    20
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Problem solved.
    Last edited by Nic03; 12-02-2012 at 01:53 PM.

Similar Threads

  1. [Mangos] Gobject add dosen't work anymore
    By ramble in forum WoW EMU Questions & Requests
    Replies: 1
    Last Post: 08-03-2010, 02:16 PM
  2. .recall add (name) Doesnt work.
    By brunno159 in forum World of Warcraft Emulator Servers
    Replies: 25
    Last Post: 11-24-2007, 05:39 PM
  3. Why aren't any of the model changing mpqs I dl working?
    By Korey16 in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 12-25-2006, 07:18 AM
All times are GMT -5. The time now is 02:41 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search