Hello MMOPro



This is an C++ script that alows you to instant disconnect from game.
Save it as NAMEOFSCRIPT.cpp
And rebuild your core


DisconnectNPC.cpp
PHP Code:
#include "StdAfx.h"
#include "Setup.h"
 
#ifdef WIN32
#pragma warning(disable:4305)
#endif
 
 
class SCRIPT_DECL Disconnect : public GossipScript
{
public:
    
void GossipHello(Object pObjectPlayerPlrbool AutoSend);
    
void GossipSelectOption(Object pObjectPlayerPlruint32 Id,  uint32 IntId, const char Code);
    
void GossipEnd(Object pObjectPlayerPlr);
        
void Destroy()
        {
                
delete this;
        }
};
void Disconnect::GossipHello(Object pObjectPlayerPlrbool  AutoSend)
    {
        
GossipMenu *Menu;
        
objmgr.CreateGossipMenuForPlayer(&Menu,  pObject->GetGUID(), 1Plr);
                if(
Plr->getLevel() < 25)
                {
                        
Menu->AddItem(2"You must be a level 25!");
                }
                else{
                if(
Plr->getRace()== 10||Plr->getRace()==  2||Plr->getRace()== 6||Plr->getRace()== 8||Plr->getRace()== 5)
                {
Menu->AddItem(0"|cffff0000 -=Logout!=- ",  1);}else{Menu->AddItem(1"|cFF0000FF -=Logout!=- "1);}                         
                

                }
                if(
AutoSend)
            
Menu->SendTo(Plr);
    }
 
void Disconnect::GossipSelectOption(Object pObjectPlayerPlr,  uint32 Iduint32 IntId, const char Code)
    {
        
Creature pCreature =  (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NULL;
        if(
pCreature==NULL)
                return;
 
        
GossipMenu Menu;
        switch(
IntId)
        {
        case 
0:
                
GossipHello(pObjectPlrtrue);
        break;
                        
        case 
1:   
                {
                
objmgr.CreateGossipMenuForPlayer(&Menu,  pObject->GetGUID(), 1Plr);
                
Menu->AddItem(7"|cffff0000!-=Instant logout instead  of waiting 30 seconds!=-|r"0);
                
Menu->AddItem(5"-=Disconnect Me Now!=-"2);

 
                
Menu->SendTo(Plr);
                                }
                break;
 
        case 
2
            {
                
Plr->GetGUID();
                
Plr->SaveToDB(1);    
                
Plr->SoftDisconnect();   
            }
                        break;
        }
};

void Disconnect::GossipEnd(Object pObjectPlayerPlr)
{
    
GossipScript::GossipEnd(pObjectPlr);
}
void SetupDisconnect(ScriptMgr mgr)
{
        
GossipScript gs = (GossipScript*) new Disconnect();
    
mgr->register_gossip_script("NPCID"gs);

Credits: QQrofl