randomguy_01
Well-known member
- Joined
- Jul 13, 2005
- RedCents
- 54¢
here ya go. Open a "give" window to hand in shit from where ever in a zone.
Usage: /give - opens a 'give' window with a targeted npc.
Usage: /give - opens a 'give' window with a targeted npc.
Rich (BB code):
// MQ2GiveNPC.cpp : Defines the entry point for the DLL application.
// Author: randomguy_01
#include "../MQ2Plugin.h"
PreSetup("MQ2GiveNPC");
#define Address 0x5DF28A // for 6/08/2007 eqgame
#define Size 0x01
#define OP_GiveNPC 0x0000 // need to find this
DWORD address0 = Address;
DWORD length0 = Size;
DWORD oldperm=0, tmp;
// this packet structure may be outdated
typedef struct _GiveNPC {
/*00*/ DWORD TargetID;
/*04*/ DWORD MyID;
} GiveNPCPacket, *PGiveNPCPacket;
VOID GiveNPC(PSPAWNINFO pChar, PCHAR szLine)
{
FlushInstructionCache(GetCurrentProcess(), (LPCVOID)address0, length0);
VirtualProtectEx(GetCurrentProcess(), (LPVOID)address0, length0, PAGE_EXECUTE_READWRITE, &oldperm);
WriteProcessMemory(GetCurrentProcess(), (LPVOID)address0, "\xEB", length0, NULL);
VirtualProtectEx(GetCurrentProcess(), (LPVOID)address0, length0, oldperm, &tmp);
PSPAWNINFO Target = (PSPAWNINFO)pTarget;
// check for target
if (!pTarget || !ppTarget) return;
if (Target->Type != SPAWN_NPC) {
MacroError("You must target an NPC to /give");
return;
}
GiveNPCPacket Packet;
Packet.TargetID = Target->SpawnID;
Packet.MyID = pChar->SpawnID;
SendEQMessage(OP_GiveNPC,&Packet,sizeof(Packet));
//WriteChatf("Opening give window with \ay%s\ax", Target->DisplayedName);
}
VOID RemoveCrack(VOID)
{
FlushInstructionCache(GetCurrentProcess(), (LPCVOID)address0, length0);
VirtualProtectEx(GetCurrentProcess(), (LPVOID)address0, length0, PAGE_EXECUTE_READWRITE, &oldperm);
WriteProcessMemory(GetCurrentProcess(), (LPVOID)address0, "\x7A", length0, NULL);
VirtualProtectEx(GetCurrentProcess(), (LPVOID)address0, length0, oldperm, &tmp);
}
// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID)
{
AddCommand("/give",GiveNPC);
}
// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID)
{
RemoveCommand("/give");
RemoveCrack();
}
Last edited:




