code
- - - Updated - - -Code:IMPL_PACKET_FUNC(ServerGameLogic, PKT_S2C_SendGroupInvite) { char find[128]; r3dscpy(find, n.intogamertag); obj_ServerPlayer* tplr = FindPlayer(find); char find1[128]; r3dscpy(find1, n.fromgamertag); obj_ServerPlayer* plr = FindPlayer(find1); if (!tplr || !plr) { return; } if (plr == tplr) { return; } const float curTime = r3dGetTime(); const float CHAT_DELAY_BETWEEN_MSG = 1.0f; // expected delay between message const int CHAT_NUMBER_TO_SPAM = 5; // default 4 -number of messages below delay time to be considered spam float diff = curTime - plr->lastChatTime_; if (plr) { if(diff > CHAT_DELAY_BETWEEN_MSG) { plr->numChatMessages_ = 0; plr->lastChatTime_ = curTime; } else { plr->numChatMessages_++; if(plr->numChatMessages_ >= CHAT_NUMBER_TO_SPAM) { char message[128] = {0}; PKT_S2C_CheatMsg_s n2; sprintf(message, "Kicked from server : invalid PKT_C2C_SendGroupinvite - spam"); // fix group r3dscpy(n2.cheatreason,message); //gServerLogic.p2pSendToPeer(peerId_, NULL, &n2, sizeof(n2)); gServerLogic.p2pSendRawToPeer(plr->peerId_, &n2, sizeof(n2)); DisconnectPeer(plr->peerId_, true, "invalid PKT_C2C_SendGroupinvite - spam"); return; } } } if(tplr && plr) { if (!tplr->loadout_->isInvite) { char message1[128] = {0}; char message2[128] = {0}; PKT_S2C_ReceivedGroupInvite_s n2; n2.status = 2; n2.peerId = plr->peerId_; sprintf(message1, "Received group from %s",n.fromgamertag); r3dscpy(n2.text,message1); //gServerLogic.p2pSendToPeer(peerId_, NULL, &n2, sizeof(n2)); gServerLogic.p2pSendToPeer(tplr->peerId_, tplr, &n2, sizeof(n2)); PKT_S2C_ReceivedGroupInvite_s n3; n3.status = 2; sprintf(message2, "Group invite send successfully",n.fromgamertag); r3dscpy(n3.text,message2); n3.peerId = 99999; //gServerLogic.p2pSendToPeer(peerId_, NULL, &n2, sizeof(n2)); gServerLogic.p2pSendToPeer(plr->peerId_, plr, &n3, sizeof(n3)); tplr->loadout_->isInvite = true; plr->loadout_->isInvite = true; } else { char message2[128] = {0}; PKT_S2C_ReceivedGroupInvite_s n3; sprintf(message2, "Allready Invited"); r3dscpy(n3.text,message2); n3.peerId = 99999; //gServerLogic.p2pSendToPeer(peerId_, NULL, &n2, sizeof(n2)); gServerLogic.p2pSendToPeer(plr->peerId_, plr, &n3, sizeof(n3)); } } }
if invite a player to group > client kick and crash....





