rendered paste bodyif (packetId == 0x5a) // Player relation.
{
char buffer[128];
char KillerName[16];
char VictimName[16];
for (short n=0;n<16;n++)
{
KillerName[n] = bytes[n+24];
VictimName[n] = bytes[n+8];
}
for (short n=0;n<128;n++){buffer[n]='\0';}
unsigned int KillerID = ((int)bytes[3])+(((int)bytes[4])*256)+(((int)bytes[5])*65536)+(((int)bytes[6])*16777216);
if ((bytes[1] == 0x06) && (bytes[2] == 0x04) && (bytes[7] == 0x00)) // someone was slain by someone
{
const char* path = BuildSettingsPath("OnKill_Messaging.ini");
//char buffer[16];
GetPrivateProfileString("Messages", "Kill_lines", "0", buffer, sizeof(buffer), path);
short Death_Lines;
short Kill_Lines;
Kill_Lines = atoi(buffer);
GetPrivateProfileString("Messages", "Death_Lines", "0", buffer, sizeof(buffer), path);
Death_Lines = atoi(buffer);
char SendMSGReaded[256];
if (_stricmp(KillerName,My_Character.Name_) == 0)
{
for (short n=0;n<Kill_Lines;n++)
{
GetLine(SendMSGReaded,n+1,"KillMessage.txt");
SendMessage_("LOL",false,SendMSGReaded,VictimName);
}
}
else if (_stricmp(VictimName,My_Character.Name_) == 0)
{
for (short n=0;n<Death_Lines;n++)
{
GetLine(SendMSGReaded,n+1,"DeathMessage.txt");
SendMessage_("LOL",false,SendMSGReaded,KillerName);
}
}
LogWrite_("Kills_PK.log",true,"%s was slain by %s. \n",VictimName,KillerName);
for (short n=0;n<128;n++){buffer[n]='\0';}
const char* pathB = BuildSettingsPath("_Database//PlayerPK.ini");
GetPrivateProfileString("Kills", KillerName, "0", buffer, sizeof(buffer), pathB);
WritePrivateProfileString("Kills", KillerName, CombineString_("%d",(atoi(buffer) + 1)), pathB);
}
else if ((bytes[1] == 0x06) && (bytes[2] == 0x04) && (bytes[7] == 0x01)) // someone was slain by monster
{
const char* path = BuildSettingsPath("_Database//MonsterNames.ini");
char buffer[128];
GetPrivateProfileString("Monsters", CombineString_("%u",KillerID), "0", buffer, sizeof(buffer), path);
LogWrite_("Kills_PK.log",true,"%s was slain by %s (Monster). \n",VictimName,buffer);
for (short n=0;n<128;n++){buffer[n]='\0';}
const char* pathB = BuildSettingsPath("_Database//MonsterPK.ini");
GetPrivateProfileString("Kills", CombineString_("%d",KillerID), "0", buffer, sizeof(buffer), pathB);
char buffer___ [33];
_itoa_s ((atoi(buffer) + 1),buffer___,10);
WritePrivateProfileString("Kills", CombineString_("%d",KillerID), buffer___, pathB);
}
else if ((bytes[1] == 0x06) && (bytes[2] == 0x04) && (bytes[7] == 0x02)) // someone was slain by Object
{
const char* path = BuildSettingsPath("_Database//ObjectNames.ini");
char buffer[128];
GetPrivateProfileString("Objects", CombineString_("%u",KillerID), "0", buffer, sizeof(buffer), path);
LogWrite_("Kills_PK.log",true,"%s was slain by %s (Object). \n",VictimName,buffer);
for (short n=0;n<128;n++){buffer[n]='\0';}
const char* pathB = BuildSettingsPath("_Database//ObjectPK.ini");
GetPrivateProfileString("Kills", CombineString_("%d",KillerID), "0", buffer, sizeof(buffer), pathB);
char buffer___ [33];
_itoa_s ((atoi(buffer) + 1),buffer___,10);
WritePrivateProfileString("Kills", CombineString_("%d",KillerID), buffer___, pathB);
}
}