unknown405
Active member
- Joined
- Nov 17, 2006
- RedCents
- 100¢
Rich (BB code):
// MQ2SayTarget
// Commands: /saytarget <text here> or /saytarget hail to do a hail on your target.
// Created by UnKnoWn405 for EQ Emulator (Titanium)
#include "../MQ2Plugin.h"
PreSetup("MQ2SayTarget");
#define MOVE 0x14CB
// Movement packet
typedef 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;
} MovePkt;
// Movement function
VOID MoveTo(float x, float y, float z){
PSPAWNINFO pMe = GetCharInfo()->pSpawn;
MovePkt mp;
ZeroMemory(&mp,sizeof(mp));
mp.SpawnID = pMe->SpawnID;
mp.Heading = pMe->Heading;
mp.X = x;
mp.Y = y;
mp.Z = z;
SendEQMessage(MOVE,&mp,sizeof(mp));
}
VOID Target_Say(PCHAR szLine){
PSPAWNINFO pMyTarget = (PSPAWNINFO)pTarget;
PSPAWNINFO pMe = GetCharInfo()->pSpawn;
CHAR SendMsg[MAX_STRING]={0};
if (!pTarget || !ppTarget) return;
MoveTo(pMyTarget->X,pMyTarget->Y,pMyTarget->Z);
sprintf(SendMsg,"/say %s",szLine);
DoCommand(pMe,SendMsg);
MoveTo(pMyTarget->X,pMyTarget->Y,pMyTarget->Z);
}
VOID Target_Say(PCHAR);
VOID SayTarget(PSPAWNINFO pChar, PCHAR szLine){
PSPAWNINFO pMyTarget = (PSPAWNINFO)pTarget;
if (!pTarget || !ppTarget) return;
Target_Say(szLine);
}
PLUGIN_API VOID InitializePlugin(VOID)
{
AddCommand("/saytarget",SayTarget);
}
PLUGIN_API VOID ShutdownPlugin(VOID)
{
RemoveCommand("/saytarget");
}
-UnKnoWn

