[SD2] Lock Doors with items [DB Support & GM Commands] menu

Shout-Out

User Tag List

Results 1 to 13 of 13
  1. #1
    MegaBigBoss's Avatar Member
    Reputation
    18
    Join Date
    Aug 2008
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [SD2/Arcemu] Lock Doors with items [DB Support & GM Commands]

    I made a script that make GameObjects locked, with the item you want.
    You can add infinite keys.

    MANGOS

    GM Commands :

    Code:
    .gobject addkey <guid> <keyid>
    .gobject delkey <guid> <keyid>

    Code :

    Code:
    bool ChatHandler::HandleGameObjectAddKeyCommand(const char* args)
    {
        if (!*args)
            return false;
    
        // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
        char* cId = extractKeyFromLink((char*)args,"Hgameobject_entry");
        if(!cId)
            return false;
    
        uint32 lowguid = atol(cId);
        if(!lowguid)
            return false;
    
        char* lockid = strtok(NULL, " ");
     if(!lockid)
      return false;
    
     uint32 keyid = atoi((char*)lockid);
     
     ItemPrototype const *it = objmgr.GetItemPrototype(keyid);
     if(!it)
      return false;
    
        GameObject* obj = NULL;
    
        // by DB guid
        if (GameObjectData const* go_data = objmgr.GetGOData(lowguid))
            obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id);
    
        if(!obj)
        {
            PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
            SetSentErrorMessage(true);
            return false;
        }
     m_session->SendNotification("Key %s added to the object %s.", it->Name1, obj->GetName());
    
     WorldDatabase.PExecute("REPLACE INTO `portelocked` VALUES('%u', '%u');", lowguid, keyid);
     
        return true;
    }
    
    bool ChatHandler::HandleGameObjectDelKeyCommand(const char *args)
    {
        if (!*args)
            return false;
    
        // number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
        char* cId = extractKeyFromLink((char*)args,"Hgameobject_entry");
        if(!cId)
            return false;
    
        uint32 lowguid = atol(cId);
        if(!lowguid)
            return false;
    
        char* lockid = strtok(NULL, " ");
     if(!lockid)
      return false;
    
     uint32 keyid = atoi((char*)lockid);
     
     ItemPrototype const *it = objmgr.GetItemPrototype(keyid);
     if(!it)
      return false;
    
        GameObject* obj = NULL;
    
        // by DB guid
        if (GameObjectData const* go_data = objmgr.GetGOData(lowguid))
            obj = GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid,go_data->id);
    
        if(!obj)
        {
            PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
            SetSentErrorMessage(true);
            return false;
        }
     
     WorldDatabase.PExecute("DELETE FROM `portelocked` WHERE keyid = '%u' AND guid = '%u';", keyid, lowguid);
     m_session->SendNotification("Key %s deleted from the object %s.", it->Name1, obj->GetName());
     return true;
    }

    ScriptDev2 Code :

    Code:
    ScriptLoader.cpp
    Line 7
    //Custom
    extern void AddSC_Porte(); // Add this line
    //examples etc ...
    
    
    Line 360
    void AddScripts()
    {
         //Custom
         AddSC_Porte(); And this one.
         
         //Examples etc ...
    Code:
    Custom/Porte.cpp
    
    #include "precompiled.h"
    #include "Database/DatabaseEnv.h"
    #include "../../system/system.h"
    #include "ObjectMgr.h" // Comment it on Windows.
    
    bool GOHello_Porte(Player *player, GameObject* _GO)
    {	
    	QueryResult * pResult = SD2Database.PQuery("SELECT keyid FROM mangos.portelocked WHERE guid = '%u'", _GO->GetGUIDLow());
    
    	if (pResult)
        {
    		do
    		{
    			Field * pFields = pResult->Fetch();
    			if(!player->HasItemCount(pFields[0].GetUInt32(), 1))
    			{
    				ItemPrototype const *pProto = objmgr.GetItemPrototype(pFields[0].GetUInt32()); // Comment it on Windows.
    				player->GetSession()->SendNotification("You must have the item %s", pProto->Name1); // Comment it on Windows.
    				delete pResult;
    				return true;
    			}
    		} while(pResult->NextRow());
    
    		_GO->UseDoorOrButton();
    		delete pResult;
    		return true;
    	}
    
    	else return false;
    
    }
    
    void AddSC_Porte()
    {
        Script *newscript;
    
        newscript = new Script;
        newscript->Name = "PorteLocked";
        newscript->pGOHello =           &GOHello_Porte;
        newscript->RegisterSelf();
    }
    You must change "mangos" to your world database name

    I haven't tested yet the gm commands, but I'll do this as soon as I can.

    Other :
    • On Windows,lines in green won't compile. There will be some links error. If someone has a solution, he's welcome !
    • Actually, it works fine on door. I don't test with other GOs.


    ARCEMU

    Code:
    // In misc scripts /GameObjectLockTable.cpp
    
    #include "StdAfx.h"
    #include "Setup.h"
    
    class CustomLock: public GameObjectAIScript // Custom Door Locking
    {
    public:
        CustomLock(GameObject* goinstance) : GameObjectAIScript(goinstance)
    	{
    	}
        ~CustomLock()
    	{
    	}
    	
    	void OnActivate(Player * pPlayer)
        {
            QueryResult *result = NULL;
            result = WorldDatabase.Query("SELECT * FROM gameobject_locks WHERE guid = %ld", this->_gameobject->GetGUID());
    		
    		if(result)
            {	
    			do
    			{
    				Field * pFields = result->Fetch();
    				if(!pPlayer->HasItemCount(pFields[1].GetUInt32(), 1))
    				{
    					ItemPrototype const *pProto = ItemPrototypeStorage.LookupEntry(pFields[1].GetUInt32());
    					pPlayer->GetSession()->SendNotification("You must have the item %s", pProto->Name1);
    					delete result;
    					return;
    				}
    			} while(result->NextRow());
    			
    			this->_gameobject->Activate(pPlayer->GetMapMgr());
    			delete result;
    			return;
            }
    		else return;
        }
        static GameObjectAIScript *Create(GameObject * GO) { return new CustomLock(GO); }
    };
    
    
    void InitializeGameObjectLockTable(ScriptMgr * mgr)
    {
    	QueryResult *result = NULL;
        result = WorldDatabase.Query("SELECT * FROM gameobject_locks");
        if(result != NULL)
        {
    		// Check if the SQL table is setup correctly
    		if (result->GetFieldCount() < 2)
    		{
    			sLog.outColor(TRED,"\nError: Custom door locking disabled, invalid 'gameobject_locks' table.");
    			delete result;
    			return;
    		}
            do
            {
                uint32 id = result->Fetch()[0].GetUInt32();
    			uint32 keyid = result->Fetch()[1].GetUInt32();
    			mgr->register_gameobject_script(id, &CustomLock::Create);
    
            } while (result->NextRow());
            delete result;
        }
    }
    Code:
    Setup.h
    
    #ifndef MISC_SCRIPTS_SETUP_H
    #define MISC_SCRIPTS_SETUP_H
    
    void SetupGoHandlers(ScriptMgr * mgr);
    void SetupRandomScripts(ScriptMgr * mgr);
    void SetupMiscCreatures(ScriptMgr * mgr);
    void SetupEbonHold(ScriptMgr * mgr);
    void SetupWyrmrestTemple(ScriptMgr * mgr);
    void SetupGrizzlyHills(ScriptMgr * mgr);
    void InitializeGameObjectTeleportTable(ScriptMgr * mgr);
    void InitializeGameObjectLockTable(ScriptMgr * mgr); // <-- Add this line 
    
    #endif
    And the last file :

    Code:
    Setup.cpp
    
    extern "C" SCRIPT_DECL void _exp_script_register(ScriptMgr* mgr)	// Comment any script to disable it
    {
    	SetupGoHandlers(mgr);
    	SetupRandomScripts(mgr);
    	SetupMiscCreatures(mgr);
    	SetupEbonHold(mgr);
    	SetupWyrmrestTemple(mgr);
    	SetupGrizzlyHills(mgr);
    
    	// Sets up gossip scripts for gameobjects in the (optional)
    	// gameobject_teleports table. If the table doesn't exist the
    	// initialization will quietly fail.
    	InitializeGameObjectTeleportTable(mgr);
    	InitializeGameObjectLockTable(mgr); <-- Add this line.
    }
    Arcemu Command ( Same usage as Mangos one) :

    Code:
    bool ChatHandler::HandleGOAddKey(const char* args, WorldSession *m_session)
    {
    	GameObject *GObj = m_session->GetPlayer()->GetSelectedGo();
    	if( !GObj )
    	{
    		RedSystemMessage(m_session, "No selected GameObject...");
    		return true;
    	}
    	if(!args)
    	{
    		RedSystemMessage(m_session, "Invalid syntax. Should be .gobject addkey <keyid>");
    		return false;
    	}
    
    	uint32 keyid = atol(args);
    
    	if(!keyid)
    	{
    		RedSystemMessage(m_session, "Invalid syntax. Should be .gobject addkey <keyid>");
    		return false;
    	}
    
    	ItemPrototype *it = ItemPrototypeStorage.LookupEntry(keyid);
    
    	if(!it)
    	{
    		RedSystemMessage(m_session, "Item %u doesn't exist.", keyid);
    		return true;
    	}
    
    	std::stringstream qry;
    	qry << "REPLACE INTO `gameobject_locks` VALUES('" << GObj->m_spawn->id << "', '" << keyid << "')";
    	WorldDatabase.Execute( qry.str().c_str( ) );
    	RedSystemMessage(m_session, "Key %s (%u) added to object %s ( GUID : %u | ID : %u )", it->Name1, it->ItemId, GameObjectNameStorage.LookupEntry( GObj->GetEntry() )->Name, GObj->m_spawn->id, GObj->GetEntry());
    	return true;
    }
    
    bool ChatHandler::HandleGODelKey(const char* args, WorldSession *m_session)
    {
    	GameObject *GObj = m_session->GetPlayer()->GetSelectedGo();
    	if( !GObj )
    	{
    		RedSystemMessage(m_session, "No selected GameObject...");
    		return true;
    	}
    	if(!args)
    	{
    		RedSystemMessage(m_session, "Invalid syntax. Should be .gobject addkey <keyid>");
    		return false;
    	}
    
    	uint32 keyid = atol(args);
    
    	if(!keyid)
    	{
    		RedSystemMessage(m_session, "Invalid syntax. Should be .gobject addkey <keyid>");
    		return false;
    	}
    
    	ItemPrototype *it = ItemPrototypeStorage.LookupEntry(keyid);
    
    	if(!it)
    	{
    		RedSystemMessage(m_session, "Item %u doesn't exist.", keyid);
    		return true;
    	}
    
    	std::stringstream qry;
    	qry << "DELETE FROM `gameobject_locks` WHERE guid = '" << GObj->m_spawn->id << "' AND keyid = '" << keyid << "')";
    	WorldDatabase.Execute( qry.str().c_str( ) );
    	RedSystemMessage(m_session, "Key %s (%u) deleted from the object %s ( GUID : %u | ID : %u )", it->Name1, it->ItemId, GameObjectNameStorage.LookupEntry( GObj->GetEntry() )->Name, GObj->m_spawn->id, GObj->GetEntry());
    	return true;
    }
    Last edited by MegaBigBoss; 11-15-2009 at 05:12 PM. Reason: Corrected some typo and Arcemu's GM Command.

    [SD2] Lock Doors with items [DB Support &amp; GM Commands]
  2. #2
    Apple Pi's Avatar Active Member
    Reputation
    50
    Join Date
    Feb 2009
    Posts
    108
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can some one please make this for arc, would very helpful or my housing project.
    What once was Moonblade rose from the ashes as Apple Pi!

  3. #3
    Exacute's Avatar Active Member
    Reputation
    67
    Join Date
    Mar 2008
    Posts
    337
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sweat concept..
    +Rep
    Would love the person that make it for arcemu !
    It will improve a lot of servers, and make it running way smoot
    Short; Gj
    [/COLOR]

  4. #4
    Ground Zero's Avatar ★ Elder ★
    Reputation
    1132
    Join Date
    Aug 2008
    Posts
    3,503
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks alot for this! This is really useful for a project im working on, saved me alot of time. +Rep

  5. #5
    stoneharry's Avatar Moderator Harry


    Reputation
    1618
    Join Date
    Sep 2007
    Posts
    4,564
    Thanks G/R
    151/150
    Trade Feedback
    0 (0%)
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Very nice, I've wondered how you would do this for a while since previously I've been announceing that the gameobject won't open when you click on it if you don't have the key - with this it actually says in the interface. +Rep

    Edit: You missed a space in one of the comments:

    Code:
    ("You must have the item %s", pProto->Name1);// Comment
    Last edited by stoneharry; 11-03-2009 at 11:25 AM.

  6. #6
    hitman47's Avatar Member
    Reputation
    1
    Join Date
    Aug 2008
    Posts
    6
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nice! can somon Make The Same for ArcEMu?

  7. #7
    MegaBigBoss's Avatar Member
    Reputation
    18
    Join Date
    Aug 2008
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks =), I'll try to do it for Arcemu ( It won't be very difficult )

    I did it, but i didn't test =>

    Code:
    // In misc scripts /GameObjectLockTable.cpp
    
    #include "StdAfx.h"
    #include "Setup.h"
    
    class CustomLock: public GameObjectAIScript // Custom Door Locking
    {
    public:
        CustomLock(GameObject* goinstance) : GameObjectAIScript(goinstance)
    	{
    	}
        ~CustomLock()
    	{
    	}
    	
    	void OnActivate(Player * pPlayer)
        {
            QueryResult *result = NULL;
            result = WorldDatabase.Query("SELECT * FROM gameobject_locks WHERE guid = %ld", this->_gameobject->GetGUID());
    		
    		if(result)
            {	
    			do
    			{
    				Field * pFields = result->Fetch();
    				if(!pPlayer->HasItemCount(pFields[1].GetUInt32(), 1))
    				{
    					ItemPrototype const *pProto = ItemPrototypeStorage.LookupEntry(pFields[1].GetUInt32());
    					pPlayer->GetSession()->SendNotification("You must have the item %s", pProto->Name1);
    					delete result;
    					return;
    				}
    			} while(result->NextRow());
    			
    			this->_gameobject->Activate(pPlayer->GetMapMgr());
    			delete result;
    			return;
            }
    		else return;
        }
        static GameObjectAIScript *Create(GameObject * GO) { return new CustomLock(GO); }
    };
    
    
    void InitializeGameObjectLockTable(ScriptMgr * mgr)
    {
    	QueryResult *result = NULL;
        result = WorldDatabase.Query("SELECT * FROM gameobject_locks");
        if(result != NULL)
        {
    		// Check if the SQL table is setup correctly
    		if (result->GetFieldCount() < 2)
    		{
    			sLog.outColor(TRED,"\nError: Custom door locking disabled, invalid 'gameobject_locks' table.");
    			delete result;
    			return;
    		}
            do
            {
                uint32 id = result->Fetch()[0].GetUInt32();
    			uint32 keyid = result->Fetch()[1].GetUInt32();
    			mgr->register_gameobject_script(id, &CustomLock::Create);
    
            } while (result->NextRow());
            delete result;
        }
    }
    Code:
    Setup.h
    
    #ifndef MISC_SCRIPTS_SETUP_H
    #define MISC_SCRIPTS_SETUP_H
    
    void SetupGoHandlers(ScriptMgr * mgr);
    void SetupRandomScripts(ScriptMgr * mgr);
    void SetupMiscCreatures(ScriptMgr * mgr);
    void SetupEbonHold(ScriptMgr * mgr);
    void SetupWyrmrestTemple(ScriptMgr * mgr);
    void SetupGrizzlyHills(ScriptMgr * mgr);
    void InitializeGameObjectTeleportTable(ScriptMgr * mgr);
    void InitializeGameObjectLockTable(ScriptMgr * mgr); // <-- Add this line 
    
    #endif
    And the last file :

    Code:
    Setup.cpp
    
    extern "C" SCRIPT_DECL void _exp_script_register(ScriptMgr* mgr)	// Comment any script to disable it
    {
    	SetupGoHandlers(mgr);
    	SetupRandomScripts(mgr);
    	SetupMiscCreatures(mgr);
    	SetupEbonHold(mgr);
    	SetupWyrmrestTemple(mgr);
    	SetupGrizzlyHills(mgr);
    
    	// Sets up gossip scripts for gameobjects in the (optional)
    	// gameobject_teleports table. If the table doesn't exist the
    	// initialization will quietly fail.
    	InitializeGameObjectTeleportTable(mgr);
    	InitializeGameObjectLockTable(mgr); <-- Add this line.
    }
    I didn't test yet, so if it doesn't work and there is no errors, look at the line.

    Code:
    this->_gameobject->Activate(pPlayer->GetMapMgr());
    Last edited by MegaBigBoss; 11-12-2009 at 07:33 AM.

  8. #8
    sasoritail's Avatar Contributor
    Reputation
    161
    Join Date
    Sep 2008
    Posts
    655
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by MegaBigBoss View Post
    Thanks =), I'll try to do it for Arcemu ( It won't be very difficult )

    I did it, but i didn't test =>

    Code:
    // In misc scripts /GameObjectLockTable.cpp
    
    #include "StdAfx.h"
    #include "Setup.h"
    
    class CustomLock: public GameObjectAIScript // Custom Door Locking
    {
    public:
        CustomLock(GameObject* goinstance) : GameObjectAIScript(goinstance)
    	{
    	}
        ~CustomLock()
    	{
    	}
    	
    	void OnActivate(Player * pPlayer)
        {
            QueryResult *result = NULL;
            result = WorldDatabase.Query("SELECT * FROM gameobject_locks WHERE guid = %ld", this->_gameobject->GetGUID());
    		
    		if(result)
            {	
    			do
    			{
    				Field * pFields = result->Fetch();
    				if(!pPlayer->HasItemCount(pFields[1].GetUInt32(), 1))
    				{
    					ItemPrototype const *pProto = ItemPrototypeStorage.LookupEntry(pFields[1].GetUInt32());
    					pPlayer->GetSession()->SendNotification("You must have the item %s", pProto->Name1);
    					delete result;
    					return;
    				}
    			} while(result->NextRow());
    			
    			this->_gameobject->Activate(pPlayer->GetMapMgr());
    			delete result;
    			return;
            }
    		else return;
        }
        static GameObjectAIScript *Create(GameObject * GO) { return new CustomLock(GO); }
    };
    
    
    void InitializeGameObjectLockTable(ScriptMgr * mgr)
    {
    	QueryResult *result = NULL;
        result = WorldDatabase.Query("SELECT * FROM gameobject_locks");
        if(result != NULL)
        {
    		// Check if the SQL table is setup correctly
    		if (result->GetFieldCount() < 2)
    		{
    			sLog.outColor(TRED,"\nError: Custom door locking disabled, invalid 'gameobject_locks' table.");
    			delete result;
    			return;
    		}
            do
            {
                uint32 id = result->Fetch()[0].GetUInt32();
    			uint32 keyid = result->Fetch()[1].GetUInt32();
    			mgr->register_gameobject_script(id, &CustomLock::Create);
    
            } while (result->NextRow());
            delete result;
        }
    }
    Code:
    Setup.h
    
    #ifndef MISC_SCRIPTS_SETUP_H
    #define MISC_SCRIPTS_SETUP_H
    
    void SetupGoHandlers(ScriptMgr * mgr);
    void SetupRandomScripts(ScriptMgr * mgr);
    void SetupMiscCreatures(ScriptMgr * mgr);
    void SetupEbonHold(ScriptMgr * mgr);
    void SetupWyrmrestTemple(ScriptMgr * mgr);
    void SetupGrizzlyHills(ScriptMgr * mgr);
    void InitializeGameObjectTeleportTable(ScriptMgr * mgr);
    void InitializeGameObjectLockTable(ScriptMgr * mgr); // <-- Add this line 
    
    #endif
    And the last file :

    Code:
    Setup.cpp
    
    extern "C" SCRIPT_DECL void _exp_script_register(ScriptMgr* mgr)	// Comment any script to disable it
    {
    	SetupGoHandlers(mgr);
    	SetupRandomScripts(mgr);
    	SetupMiscCreatures(mgr);
    	SetupEbonHold(mgr);
    	SetupWyrmrestTemple(mgr);
    	SetupGrizzlyHills(mgr);
    
    	// Sets up gossip scripts for gameobjects in the (optional)
    	// gameobject_teleports table. If the table doesn't exist the
    	// initialization will quietly fail.
    	InitializeGameObjectTeleportTable(mgr);
    	InitializeGameObjectLockTable(mgr); <-- Add this line.
    }
    I didn't test yet, so if it doesn't work and there is no errors, look at the line.

    Code:
    this->_gameobject->Activate(pPlayer->GetMapMgr());


    Awesomme works for me !
    +Rep x2
    It's been a while

  9. #9
    MegaBigBoss's Avatar Member
    Reputation
    18
    Join Date
    Aug 2008
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do it works with multiple keys ? ( Thanks )

  10. #10
    MegaBigBoss's Avatar Member
    Reputation
    18
    Join Date
    Aug 2008
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ADDED : Arcemu Command

    Code:
    bool ChatHandler::HandleGOAddKey(const char* args, WorldSession *m_session)
    {
    	GameObject *GObj = m_session->GetPlayer()->GetSelectedGo();
    	if( !GObj )
    	{
    		RedSystemMessage(m_session, "No selected GameObject...");
    		return true;
    	}
    	if(!args)
    	{
    		RedSystemMessage(m_session, "Invalid syntax. Should be .gobject addkey <keyid>");
    		return false;
    	}
    
    	uint32 keyid = atol(args);
    
    	if(!keyid)
    	{
    		RedSystemMessage(m_session, "Invalid syntax. Should be .gobject addkey <keyid>");
    		return false;
    	}
    
    	ItemPrototype *it = ItemPrototypeStorage.LookupEntry(keyid);
    
    	if(!it)
    	{
    		RedSystemMessage(m_session, "Item %u doesn't exist.", keyid);
    		return false;
    	}
    
    	std::stringstream qry;
    	qry << "REPLACE INTO `gameobject_locks` VALUES('" << GObj->GetGUID() << "', '" << keyid << "')";
    	WorldDatabase.Execute( qry.str().c_str( ) );
    	RedSystemMessage(m_session, "Key %s (%u) added to object %s ( GUID : %u | ID : %u )", it->Name1, it->ItemId, GameObjectNameStorage.LookupEntry( GObj->GetEntry() )->Name, GObj->GetGUID(), GObj->GetEntry());
    	return true;
    }
    
    bool ChatHandler::HandleGODelKey(const char* args, WorldSession *m_session)
    {
    	GameObject *GObj = m_session->GetPlayer()->GetSelectedGo();
    	if( !GObj )
    	{
    		RedSystemMessage(m_session, "No selected GameObject...");
    		return true;
    	}
    	if(!args)
    	{
    		RedSystemMessage(m_session, "Invalid syntax. Should be .gobject addkey <keyid>");
    		return false;
    	}
    
    	uint32 keyid = atol(args);
    
    	if(!keyid)
    	{
    		RedSystemMessage(m_session, "Invalid syntax. Should be .gobject addkey <keyid>");
    		return false;
    	}
    
    	ItemPrototype *it = ItemPrototypeStorage.LookupEntry(keyid);
    
    	if(!it)
    	{
    		RedSystemMessage(m_session, "Item %u doesn't exist.", keyid);
    		return false;
    	}
    
    	std::stringstream qry;
    	qry << "DELETE FROM `gameobject_locks` WHERE guid = '" << GObj->GetGUID() << " AND keyid = '" << keyid << "')";
    	WorldDatabase.Execute( qry.str().c_str( ) );
    	RedSystemMessage(m_session, "Key %s (%u) deleted from the object %s ( GUID : %u | ID : %u )", it->Name1, it->ItemId, GameObjectNameStorage.LookupEntry( GObj->GetEntry() )->Name, GObj->GetGUID(), GObj->GetEntry());
    	return true;
    }
    EDIT => I'd be happy if a moderator could change the title of the post to "[SD2/Arcemu] Lock Doors with items [DB Support & GM Commands]"
    Last edited by MegaBigBoss; 11-15-2009 at 05:14 PM.

  11. #11
    TheFrostLord's Avatar Corporal
    Reputation
    1
    Join Date
    Sep 2010
    Posts
    15
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol noobs : would you make it for arcemu omfg there is version for acremu if u mean in lua say it ... +rep for u buddie (megabigboss) good job in cpp gz

  12. #12
    MegaBigBoss's Avatar Member
    Reputation
    18
    Join Date
    Aug 2008
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks !
    But, i don't know if it's working now. It's quite old !

  13. #13
    TheFrostLord's Avatar Corporal
    Reputation
    1
    Join Date
    Sep 2010
    Posts
    15
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    its working ... +Rep

Similar Threads

  1. Making doors with locks/keys
    By IMASECRET in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 11-09-2007, 03:24 PM
  2. WTT 57 UD lock PVP with BC
    By Glynbeard in forum Members Only Accounts And CD Keys Buy Sell
    Replies: 0
    Last Post: 02-25-2007, 09:31 AM
  3. Bypass 'Locked' Doors
    By spacecowboy in forum World of Warcraft Exploits
    Replies: 4
    Last Post: 02-20-2007, 03:26 PM
  4. Help with Item.spc
    By a7x Taylor in forum World of Warcraft General
    Replies: 0
    Last Post: 12-07-2006, 07:34 PM
  5. Walking through locked doors in SM
    By MaiN in forum World of Warcraft Exploits
    Replies: 7
    Last Post: 11-10-2006, 08:16 AM
All times are GMT -5. The time now is 05:56 AM. 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