# [GUIDE] Network Messages

## 20 posts in this topic

9 minutes ago, StokesMagee said:

Yes and no. As that it's valid to send an object via an network message, you never want to because the object can and will change. Always send the netID of the object back and forth and retrieve the object once the message has been received.

• 2

##### Share on other sites
3 hours ago, StokesMagee said:

"STRING" is not the only typeName that can be used, below are examples of others:


"SCALAR"         // 1337
"BOOL"           // true/false
"ARRAY"          // [1,2,3,4,5]

I thought you were talking about target objects.

But as Wolf says, Objects change. Send the netID and do objectFromNetID and you dodge that issue.

• 1

##### Share on other sites

I am working on changing the way players spawn in exile and use a function from another loaded mod on my server, I have attempted doing so different to above (I didnt know about this until now) . I have copied Create_Player_Response to MPmission and made it ExileCustom , I then made sure the spawn type is 0 ,  then do remoteexec from MPmission > Create_Player_Response > case0 > similar to this :

[getpos player, player],remoteexec ["functionname",2];

I then turned all functions and commands on by setting mode to 2 for class functions and class commands, I tried with both target set as 0 and as 1 for all called functions.

The problem I am having is that on server restart the function called above (new spawning system) usually works great, the main function is run and its sub functions (count down and sound) works, however if the player re-spawns it only does the animation from the main function , the countdown and sound is gone, this got me thinking its got to be security thing because it works fine without exile and it works only once at server restart, or maybe it doesn't work if it is same sessionID even if player has re-spawned ? I can not figure out why, it works on server restart but when player is killed/respawns the sub functions (countdown and sound) does not go back to client.

how am I best doing this using the above? can I do the below in Create_player_Response, under case0:

call ExileClient_system_network_send; // Exile function to call to send a message to the server.

[getpos player, player],remoteexec ["functionname",2]; 

what should the sever to client code be? does it require one?

Edited by Aggro

##### Share on other sites

would someone be kind enough to extend this tutorial to do a guide for adding a new call to function send and receive, a function that is another mod ??

##### Share on other sites
On 09/11/2016 at 4:27 AM, Aggro said:

would someone be kind enough to extend this tutorial to do a guide for adding a new call to function send and receive, a function that is another mod ??

Not possible using exiles network messages system as the function that is being called needs to start with either ExileClient or ExileServer and I'm guessing you don't have control over what the functions are called if they are in another mod ?

• 1

##### Share on other sites
7 hours ago, Shix said:

Not possible using exiles network messages system as the function that is being called needs to start with either ExileClient or ExileServer and I'm guessing you don't have control over what the functions are called if they are in another mod ?

Thought so thanks for confirming, not sure what you mean by control over what they called, if you are saying calling them something else might not be possible, but wondering if I can do it as variable if that is what stops it from work, define it in exileServer:

_ExileCustomFunction = AnotherMod_FNC

direct Network messages to Exile Server referencing _ExileCustomFunction ?

RemoteExec [_ExileCustomFunction,2]

would something like that be a work around ?

The challenge i am having right now is this :

This triggers the function to work but without sound at times:

[getPos player, [Player],"Frigate Lowering Arm",30,0.1,-1,1,1500,1300,800,400,200,100,true,false,300,0] remoteExec ["OPTRE_FNC_HEV",2];

Wrapping it up in player addaction like this works everytime:

player addaction ["echiIsAwesome",{[getPos player, [Player],"Frigate Lowering Arm",30,0.1,-1,1,1500,1300,800,400,200,100,true,false,300,0] remoteExec ["OPTRE_FNC_HEV",2];}];

Edited by Aggro

##### Share on other sites
On 10/11/2016 at 5:49 PM, Aggro said:

Thought so thanks for confirming, not sure what you mean by control over what they called, if you are saying calling them something else might not be possible, but wondering if I can do it as variable if that is what stops it from work, define it in exileServer:

_ExileCustomFunction = AnotherMod_FNC

direct Network messages to Exile Server referencing _ExileCustomFunction ?

RemoteExec [_ExileCustomFunction,2]

would something like that be a work around ?

The challenge i am having right now is this :

This triggers the function to work but without sound at times:

[getPos player, [Player],"Frigate Lowering Arm",30,0.1,-1,1,1500,1300,800,400,200,100,true,false,300,0] remoteExec ["OPTRE_FNC_HEV",2];

Wrapping it up in player addaction like this works everytime:

player addaction ["echiIsAwesome",{[getPos player, [Player],"Frigate Lowering Arm",30,0.1,-1,1,1500,1300,800,400,200,100,true,false,300,0] remoteExec ["OPTRE_FNC_HEV",2];}];

Function is most likely compiled using compileFinal meaning you won't be able to recompile under a new name.

##### Share on other sites

Excellent guide @WolfkillArcadia, helped me a lot!

FIXED! Thanks Eraser1!

However, I do have a little question. Client -> Server works perfectly; I can modify custom DB fields perfectly, but Server -> Client doesn't work at all.

I've added all required fields in CfgNetworkMessages, but the Response-ones are actually not executed. I added diag_logs in all the files for debugging purposes. The reponse-files are mission-side, defined using CfgCustomCode, is that maybe my mistake? Should I change this bit of code? (I mean define these functions elsewhere)


class CfgExileCustomCode
{
// Clan Humanity System
ExileClient_database_network_getClanHumanityResponse                            = "path\to\database_getClanHumanityResponse.sqf";
ExileClient_database_network_setClanHumanityResponse                            = "path\to\database_setClanHumanityResponse.sqf";

/* more overrides */
}; 
Edited by xBowBii
Syntax, typos

##### Share on other sites
23 hours ago, xBowBii said:

Excellent guide @WolfkillArcadia, helped me a lot!

FIXED! Thanks Eraser1!

However, I do have a little question. Client -> Server works perfectly; I can modify custom DB fields perfectly, but Server -> Client doesn't work at all.

I've added all required fields in CfgNetworkMessages, but the Response-ones are actually not executed. I added diag_logs in all the files for debugging purposes. The reponse-files are mission-side, defined using CfgCustomCode, is that maybe my mistake? Should I change this bit of code? (I mean define these functions elsewhere)



class CfgExileCustomCode
{
// Clan Humanity System
ExileClient_database_network_getClanHumanityResponse                            = "path\to\database_getClanHumanityResponse.sqf";
ExileClient_database_network_setClanHumanityResponse                            = "path\to\database_setClanHumanityResponse.sqf";

/* more overrides */
}; 

Yes. Have a look at github/mezo

There's a framwork repo on there for client/server addons.

• 2

##### Share on other sites

Could someone with a lot more understanding than I do, take a look at this please? Have spent a week now trying to figure this out

Also, could the actual map be a cause of the error? as the only other person I've spoken too who had this issue resolved it by changing from stock chernarus to south zargoria. I'm using ChernarusRedux.

WOLF

edit:  Turns out the issue was with the map itself, after chernraus redux got updated on the 6/5/18 the problem was resolved!

Edited by GGWOLF
resolved the issue