Hey there guys - Can someone help me out with this. In the below Plugin, which i just copied right from another thread, i can see what its doing, but dont really understand how it interacts with Server. Can anyone explain? Something ive wandered about for a while
Code:
#include "../MQ2Plugin.h"
#include "../Packet/Packetlib.h"
#define OP_ITEMSWAP 0x2641
// SwapItem Packet
typedef struct _ItemSwapPkt{
DWORD slot1;
DWORD slot2;
DWORD unkn;
} ItemSwapPkt;
PreSetup("MQ2NoDropTrade");
VOID NoDropTrade(PSPAWNINFO pChar, PCHAR szLine){
CHAR sz_Arg[MAX_STRING] = {0};
GetArg(sz_Arg,szLine,1);
ItemSwapPkt itemswap;
ZeroMemory(&itemswap,sizeof(itemswap));
if(!stricmp(sz_Arg,"1") || !stricmp(sz_Arg,"")){
itemswap.slot1 = 0x09EE;
itemswap.slot2 = 0x0106;
}
if(!stricmp(sz_Arg,"2")){
itemswap.slot1 = 0x09EF;
itemswap.slot2 = 0x0106;
}
if(!stricmp(sz_Arg,"3")){
itemswap.slot1 = 0x09F0;
itemswap.slot2 = 0x0106;
}
if(!stricmp(sz_Arg,"4")){
itemswap.slot1 = 0x09F1;
itemswap.slot2 = 0x0106;
}
if(!stricmp(sz_Arg,"5")){
itemswap.slot1 = 0x09F2;
itemswap.slot2 = 0x0106;
}
if(!stricmp(sz_Arg,"6")){
itemswap.slot1 = 0x09F3;
itemswap.slot2 = 0x0106;
}
if(!stricmp(sz_Arg,"7")){
itemswap.slot1 = 0x09F4;
itemswap.slot2 = 0x0106;
}
if(!stricmp(sz_Arg,"8")){
itemswap.slot1 = 0x09F5;
itemswap.slot2 = 0x0106;
}
SendEQPacket(OP_ITEMSWAP,&itemswap,sizeof(itemswap));
WriteChatColor("NoDrop Trade Successful! please camp out to the other toon.", CONCOLOR_YELLOW);
PopupText(NULL,"NoDrop Trade Successful! please camp out to the other toon.");
}
PLUGIN_API VOID InitializePlugin(VOID)
{
AddCommand("/nodrop", NoDropTrade);
}
// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID)
{
RemoveCommand("/nodrop");
}