17/09/2021
else if (str.substr(0, 5) == "/nha ")
{
string name = static_cast(peer->data)->displayName;
GamePacket p = packetEnd(appendString(appendString(createPacket(), "OnConsoleMessage"), "`c[Owner-ZurentTopia-GSM]`4Global System Message: `o" + str.substr(4, cch.length() - 4 - 1)));
string text = "action|play_sfx\nfile|audio/sungate.wav\ndelayMS|0\n";
BYTE* data = new BYTE[5 + text.length()];
BYTE zero = 0;
int type = 3;
memcpy(data, &type, 4);
memcpy(data + 4, text.c_str(), text.length());
memcpy(data + 4 + text.length(), &zero, 1);
ENetPeer* currentPeer;
for (currentPeer = server->peers;
currentPeer < &server->peers[server->peerCount];
++currentPeer)
{
if (currentPeer->state != ENET_PEER_STATE_CONNECTED || currentPeer->data == NULL)
continue;
if (!static_cast(currentPeer->data)->radio)
continue;
ENetPacket* packet = enet_packet_create(p.data,
p.len,
ENET_PACKET_FLAG_RELIABLE);
enet_peer_send(currentPeer, 0, packet);
ENetPacket* packet2 = enet_packet_create(data,
5 + text.length(),
ENET_PACKET_FLAG_RELIABLE);
enet_peer_send(currentPeer, 0, packet2);
//enet_host_flush(server);
}
delete[] data;
delete p.data;
}
Free Code Custom [gsm]