Dr. Fallen
13-03-10, 08:29 AM
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
#include "StdAfx.h"
#include "Setup.h"
#ifdef WIN32
#pragma warning(disable:4305)
#endif
class SCRIPT_DECL Disconnect : public GossipScript
{
public:
void GossipHello(Object * pObject, Player* Plr, bool AutoSend);
void GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code);
void GossipEnd(Object * pObject, Player* Plr);
void Destroy()
{
delete this;
}
};
void Disconnect::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
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 * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NUL L;
if(pCreature==NULL)
return;
GossipMenu * Menu;
switch(IntId)
{
case 0:
GossipHello(pObject, Plr, true);
break;
case 1:
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
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 * pObject, Player* Plr)
{
GossipScript::GossipEnd(pObject, Plr);
}
void SetupDisconnect(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new Disconnect();
mgr->register_gossip_script("NPCID", gs);
}Credits: QQrofl
This is an C++ script that alows you to instant disconnect from game.
Save it as NAMEOFSCRIPT.cpp
And rebuild your core
DisconnectNPC.cpp
#include "StdAfx.h"
#include "Setup.h"
#ifdef WIN32
#pragma warning(disable:4305)
#endif
class SCRIPT_DECL Disconnect : public GossipScript
{
public:
void GossipHello(Object * pObject, Player* Plr, bool AutoSend);
void GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code);
void GossipEnd(Object * pObject, Player* Plr);
void Destroy()
{
delete this;
}
};
void Disconnect::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
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 * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
{
Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NUL L;
if(pCreature==NULL)
return;
GossipMenu * Menu;
switch(IntId)
{
case 0:
GossipHello(pObject, Plr, true);
break;
case 1:
{
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
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 * pObject, Player* Plr)
{
GossipScript::GossipEnd(pObject, Plr);
}
void SetupDisconnect(ScriptMgr * mgr)
{
GossipScript * gs = (GossipScript*) new Disconnect();
mgr->register_gossip_script("NPCID", gs);
}Credits: QQrofl