randomguy_01
Well-known member
- Joined
- Jul 13, 2005
- RedCents
- 54¢
Not sure what this can be used for, I was bored.
/placeitem y x z to throw the item on your cursor to a location you specify. For those who get excited, this does NOT work on NOTRADE items.

/placeitem y x z to throw the item on your cursor to a location you specify. For those who get excited, this does NOT work on NOTRADE items.

Rich (BB code):
// MQ2PlaceItem
// allows you to drop an item on a certain Y,X,Z location
// syntax: /placeitem y x z
// randomguy_01
#include "../MQ2Plugin.h"
#ifdef PKT_UPDATE_POSITION
#undef PKT_UPDATE_POSITION
#endif
#define PKT_UPDATE_POSITION 0x14CB
#define PKT_DROP_ITEM 0x3BC2
PreSetup("MQ2PlaceItem");
VOID PlaceCmd(PSPAWNINFO pChar, PCHAR szLine)
{
float y, x, z;
char szBuf[MAX_STRING] = {0};
char szMsg[MAX_STRING] = {0};
GetArg(szBuf, szLine, 1);
y = (float)atof(szBuf);
GetArg(szBuf, szLine, 2);
x = (float)atof(szBuf);
GetArg(szBuf, szLine, 3);
z = (float)atof(szBuf);
// check for item on cursor
PCONTENTS pCursor = GetCharInfo2()->Cursor;
if (!pCursor) {
WriteChatf("You must have an item on your cursor.");
return;
}
if (szBuf[0] == 0) {
WriteChatf("You must specify a location");
return;
}
struct _MOVEPKT {
/*0000*/ unsigned short SpawnID;
/*0002*/ unsigned short TimeStamp;
/*0004*/ float Y;
/*0008*/ float DeltaZ;
/*0012*/ float DeltaY;
/*0016*/ float DeltaX;
/*0020*/ int Animation:10;
/*0020*/ int DeltaHeading:10;
/*0020*/ int padding0020:12;
/*0024*/ float X;
/*0028*/ float Z;
/*0032*/ int Heading:12;
/*0032*/ int padding1_0032:10;
/*0032*/ int padding2_0032:10;
} P;
ZeroMemory(&P, sizeof(P));
P.SpawnID = (unsigned short)pChar->SpawnID;
P.Heading = (unsigned int)(pChar->Heading * 4);
// jump to
P.Z = z;
P.Y = y;
P.X = x;
SendEQMessage(PKT_UPDATE_POSITION, &P, sizeof(P));
// drop
SendEQMessage(PKT_DROP_ITEM, "", 0);
DoCommand(pChar->pSpawn,"/drop");
// jump back
P.Z = pChar->Z;
P.Y = pChar->Y;
P.X = pChar->X;
SendEQMessage(PKT_UPDATE_POSITION, &P, sizeof(P));
sprintf(szMsg,"Attempting to drop %s at location %3.2f, %3.2f, %3.2f",pCursor->Item->Name, y, x, z);
WriteChatColor(szMsg);
}
PLUGIN_API VOID InitializePlugin(VOID)
{
AddCommand("/placeitem", PlaceCmd);
}
PLUGIN_API VOID ShutdownPlugin(VOID)
{
RemoveCommand("/placeitem");
}

Last edited:

