Func:
void GetMarkStr(char* nameMark, char prefix, int value1, int value2, int guildID, size_t bufferSize)
{
if (nameMark == NULL) {
return;
}
snprintf(nameMark, bufferSize, "%c%02d%02d%04d.bmp", prefix, value1, value2, guildID);
}
Exemplo de envio:
MSG_ExemploPacket packet;
memset(&packet, 0, sizeof MSG_ExemploPacket);
packet.Type = 0xCF1;
packet.Size = sizeof MSG_ExemploPacket;
sprintf_s(packet.Matou, sizeof packet.Matou, "%s", pMob[Matou].MOB.MobName);
sprintf_s(packet.Morreu, sizeof packet.Morreu, "%s", pMob[Morreu].MOB.MobName);
GetMarkStr(packet.strMarkMatou, 'b', 1, 0, pMob[Matou].MOB.Guild,12);
GetMarkStr(packet.strMarkMorreu, 'b', 1, 0, pMob[Morreu].MOB.Guild,12);
std::size_t Size = packet.Size;
if (Size > sizeof(MSG_ExemploPacket))
{
packet.Size = 0;
return;
}
if (!pUser[Morreu].cSock.AddMessage((char*)&packet, sizeof(MSG_ExemploPacket)))
CloseUser(Morreu);
if (!pUser[Matou].cSock.AddMessage((char*)&packet, sizeof(MSG_ExemploPacket)))
CloseUser(Matou);