Jump to content
Sign in to follow this  
Gameadd1cted

JIP code execution (6thSense.eu)

Recommended Posts

Hi guys.

I am trying to understand locality.

The following init.sqf is based on the Multiplayer guide from 6thSense (http://community.bistudio.com/wiki/6thSense.eu)

When I play a SP mission, it correctly displays "Single player mission".

When I play a MP, it correctly displays "Multiplayer".

Nevertheless, when I join the same game, it does not display "JIP Machine"

Seems to easy and I don't get it :mad:

What am I doing wrong?

hint "Start";

sleep 1;

/*
 Script by Sickboy (sb _at_ 6thSense.eu)
 Version: v0.1
*/
T_INIT = false;
T_Server = false; T_Client = false; T_JIP = false;

if (playersNumber east + playersNumber west + playersNumber resistance + playersNumber civilian > 0) then { T_MP = true } else { T_MP = false };

if (isServer) then
{
 T_Server = true;
 if (!(isNull player)) then { T_Client = true };
 T_INIT = true;
} else {
 T_Client = true;
 if (isNull player) then
 {
     T_JIP = true;
     [] spawn { waitUntil { !(isNull player) }; T_INIT = true };
 } else {
     T_INIT = true;
 };
};


// Comprobaciones SP/MP/JIP

if (!T_MP) then
{
hint "Single player mission";
};

if (T_MP) then
{
hint "Multiplayer";
};

if (T_JIP) then
{
hint "JIP Machine";
};

Share this post


Link to post
Share on other sites

SickBoy's example code in that article is excellent and still relevant but it is a little dated in that we have a few new commands that can help us determine multiplayer, server type, and JIP. The new command are:

isMultiplayer

isDedicated

We can uae these commands to simplify the JIP test:

if (isMultiplayer) then
{
   if ((!isDedicated) and (isNull player)) then
   {
        hint " I am JIP!";
   }
   else
   {
       hint "No JIP here!";
   };

Share this post


Link to post
Share on other sites

First of all, thanks for the quick answer. Tested as soon as the answer arrived.

Definitely it's me doing something wrong or not understanding the JIP.

1. I created a dedicated server on PC1. Server is started.

2. I join the game from PC2. Login as admin.

The game starts. "No JIP here!" is displayed. Perfect.

3. 30 seconds later I join the same game from the laptop (PC3).

"No JIP here!" is displayed again. :eek:

Edit: I tried joining 10 minutes later. Still "No JIP" message.

At this stage, I am lost.:confused:

Wasn't supposed to display " I am JIP!" on the laptop?

Edited by Gameadd1cted
additional information.

Share this post


Link to post
Share on other sites

PvPscene,

I have 1 server and 2 computers acting like clients (a total of 3 different computers).

I see no JIP message on the second client even though I join later (the first client is still on)

I even tried accessing the server from a different network (via mobile internet). Still no JIP.

Share this post


Link to post
Share on other sites

Hi PVP,

The mission can be downloaded here:

http://www.megaupload.com/?d=A59FNU1N

As a quick description, there is a chopper that can be commanded via radio to do an insertion and extraction.

Bellow there is an image showing the scripted chopper in the center.

6343714808_cd4ded45a2.jpg

111114 Entrenamiento by Militar2k, on Flickr

Edited by Gameadd1cted
wrong link format

Share this post


Link to post
Share on other sites

remove the sleep 1; before the code...

Share this post


Link to post
Share on other sites

PvPscene,

It works :yay: Thanks a lot :)

Now, why does it happen so? This is my guess:

player returns null on a server.

However, player can be null for a short period of time on a client machine (until it synchronizes?)

So, if the machine is a CLIENT and player isNull => JIP

The sleep in the init code resulted in player not being Null.

Therefore the code would never catch a JIP state.

Is this correct?

Share this post


Link to post
Share on other sites

for a JIP the system var player is not immediately available

if you sleep, it will of course

Share this post


Link to post
Share on other sites

Is it dependent on the duration of the sleep command?

E.g. does it make any difference if we use sleep 0.1 or sleep 10?

Share this post


Link to post
Share on other sites

So on a JIP client, player is null immediately after execution of the init.sqf, but is no longer null a second later? Is this behaviour absolutely reliable?

Share this post


Link to post
Share on other sites

It should be mostly reliable and one of the few ways how to detect on the local machine if you're a JIP player.

The player object should never be null in case of non JIP.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×