Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
R34P3R

Another JIP question...

Recommended Posts

i think the Script is fine.. but if i open a new network Game then the PlayerScript will not be run.. but the Server Scriptblock load perfecly...

INIT:

// JIP ( SERVER)

if (isServer) then {

//Vars

ziel1done=false;
ziel1failed=false;

ziel2done=false;
ziel2failed=false;

ziel3done=false;
ziel3failed=false;

ziel4done=false;
ziel4failed=false;

ziel5done=false;

//Wetter

0 setfog (random 0.3);
0 setrain (random 0.9);
0 setovercast (random 0.7);

//JIP
"SENDJIP" addPublicVariableEventHandler { 
	[sENDJIP] execVM "server\onnewplayer.sqf"; 
};

// Pilot
if(!ziel1done) then {
	removeAllWeapons pilot;
	pilot setCaptive true;
	doStop pilot;
	pilot stop true;
	pilot playMove "AmovPercMstpSsurWnonDnon";
	pilot disableAI "Anim";
};

// General
if(!ziel2done) then {
	removeAllWeapons general;
	doStop general;
	general playMove "AmovPercMstpSnonWnonDnon_Ease";
	general disableAI "Anim";
	general stop true;
};

} else {

// PLAYER

SENDJIP = player;
PublicVariable "SENDJIP";

waituntil {sleep 0.5; !isNil "ziel1done" };

0 setfog G_FOG;
0 setovercast G_OVERCAST;
0 setrain G_RAIN;
skiptime (G_DAYTIME - daytime);

// Missions

[] execVM "missions\briefing.sqf";
[] execVM "missions\briefing_update.sqf";

//heavy color correction
"colorCorrections" ppEffectAdjust [1, 0.9, -0.004, [0.0, 0.0, 0.0, 0.0], [1, 0.8, 0.6, 0.5],  [0.199, 0.587, 0.114, 0.0]]; 
"colorCorrections" ppEffectCommit 0;    
"colorCorrections" ppEffectEnable true;

//light film grain
"filmGrain" ppEffectEnable true; 
"filmGrain" ppEffectAdjust [0.02, 1, 1, 0.1, 1, false];
"filmGrain" ppEffectCommit 0;

// Remove Deadbodys
_xhandle = execvm "client\remove_dead.sqf";

//Player Rank

_chkrank = execVM "client\player_rank.sqf";

if(!ziel1done) then { [] execVM "missions\mission1_wait.sqf"; };
if(!ziel2done) then { [] execVM "missions\mission2_wait.sqf"; };

};

SERVER\ONNEWPLAYER.SQF:

G_FOG = fog;
G_OVERCAST = overcast;
G_RAIN = rain;
G_DAYTIME = daytime;

PublicVariable "G_FOG";
PublicVariable "G_OVERCAST";
PublicVariable "G_RAIN";
PublicVariable "G_DAYTIME";

PublicVariable "ziel1done";
PublicVariable "ziel1failed";

PublicVariable "ziel2done";
PublicVariable "ziel2failed";

PublicVariable "ziel3done";
PublicVariable "ziel3failed";

PublicVariable "ziel4done";
PublicVariable "ziel4failed";

PublicVariable "ziel5done";

i also have a Logic with the name "server" in my Mission.

hope somebody can help me.. i worked on the JIP since 5 Days but i dont get it to work. Tanks a lot.

Share this post


Link to post
Share on other sites

1. there is easier way to detect if new player was connected:

if (isServer) then
{
 ...
 onPlayerConnected "[] execVM "server\onnewplayer.sqf";
 ..
} 
else
{ // player

so you don't need to play with SENDJIP variable

2. you don't need to have logical object server, because we have isServer command

3. player command that you use: SENDJIP = player;

doesn't work for several seconds on the begining gor JIP players! (but you don't need SENDJIP variable so just remove all stuff with SENDJIP)

4. I think (maybe I'm wrong) publicVariable command is expensive, so imo it would be better public array with all of the zielXdone, zielXfailed values:

ziels = [ziel1done, ..., ziel5done, G_FOG, ...];
publicVariable "ziels";

and then read all of the values on the client side:

ziel1done = ziels select 0; etc

Share this post


Link to post
Share on other sites
Sign in to follow this  

×