Haven't used the ModNet extensively myself yet. But I have figured out a limited amount of how it work.
The player who the event happens for needs to have your python do exactly what it normally does for him, but ALSO send out the ModNetMessage. All of the other players will react to the ModNetMessage in whatever manner you tell them to. Or, wording that slightly differently, the player who SENDS the message, does not GET the message himself. Thus if you are trying to get something to remain in Sync, you need the code to happen twice.
Not quite as important of a point for you, since you are trying to get the other players to do something different. Actually it works in your favor because you don't want it to run for the initiating player anyway.
The tricky bit is that you only get 5 integer values to work with. Typically you use the first value to inform yourself how to handle the other 4 sets
ie:
if (iData1 == 5):
Run My Code....
Most likely you'll pass the player number with the iData2 so you know who initiated the code, so then you have 3 integers left to form your popup with. If there aren't any more variables you don't need them anyway. You'll just have the "Run My Code..." section above loop over all players and if any of them are human, provide a popup informing them whatever you wanted to inform them about.
Can't quite tell from the posted what is going on. Are you having all players change leaders, or just wanting to announce to all players when one of the humans changes out?
I actually have two different conditions in multi-player where I have need for this function:
1. The first is the code I posted, which needs to be ran for each human player, at the beginning of their respective turns. The condition I have now is the code repeats itself once for every player on the first player's turn. So if I have 8 players, the code is repeating 8 times on the first player's turn. This is obviously bad and has denied the capability to use this function in multiplayer. I would really like to get this one fixed. The source code was in ver 1.6, the "Civ customiser", in Dales Combat Mod.
2. The second happens when an event occurs: The destruction of a Holy City. The AI Civs, with the same state religion will automatically declare war against the aggressor, human or not. This part of the code works really well.
The part that does not work: I want to ask each human theocracy player, who shares the Holy City religion, on that player's next respective turn, if the player will declare war against the aggressor, who destryed their Holy City. I have a popup designed to ask the question, but I don't know where to put it.
If the human player refuses to declare war against the aggressor, AI Civs, with the same religion will declare war against the human player, as the human player has betrayed the faith. If the human player accepts and declares war, then AI Civs, with the same state religion will have vastly improved relations with the human player. I can use the AIAttitudeAdjustment function to improve or anger relationships between Civs. My problem is where to put my popup message so that it will wait to run on the respective human player's next turn.
So there you have it, two big problems that could potentially be resolved with the onModNetMessage function. I just don't know how to code that function properly.
OrionVeteran