View Single Post
Zah dud4h

JCF Member

Joined: Dec 2014

Posts: 26

Zah dud4h is doing well so far

Feb 11, 2021, 03:58 PM
Zah dud4h is offline
jjSendPacket not sending packets

Well, there's something weird going on with the jjSendPacket function, apparently.

As a server, if you put a negative number in its second parameter (e.g. `jjSendPacket(packet, -clientID)`), it will do something different than what it should do according to the documentation.

Once you put the negative value of a clientID, the server decides not to send the packet back to players that are not using the clientIDs 1, 3 or 7 (probably also 15 and 31, since there seems to be a pattern here).

Judging by the pattern of the numbers, i suspect there is something in the code that tries to do a bitwise "AND" operation (&) instead of using the "AND" logic comparator (&&), or perhaps some other bitwise operator mistake.

I've sent an attachment with the mutator code I used to test this behavior with multiple clients. It should send packets to the server by just pressing the left mouse button.

Note that when I used this mutator, there was no level script running alongside it in the background, nor any other mutator.

I suggest that people should avoid using this until it gets fixed and that they rather should send packets to the players excluding the clientID they want manually. Here's a possible workaround:

Code:
array<bool> clientExists(32,false);
for (int i = 1;i < 32;i++) {
  jjPLAYER@ play = jjPlayers[i];
  if (play.isActive) clientExists[play.clientID] = true;
}
for (int i = 1;i < 32;i++) {
  if (i == clientID) continue;
  if (clientExists[i]) {  
    jjSendPacket(replyPacket, i);
  }
}
Attached Files
File Type: txt teststream3b.txt (1.0 KB, 0 views)
__________________
.

Last edited by Zah dud4h; Feb 12, 2021 at 02:51 AM.