Jump to content
Sign in to follow this  
cruoriss

Multiple vehicle with Jip

Recommended Posts

Hey , so i've got an action added on a gui menu wich create a vehicle .

The gui menu works fine on jip but the createvehicle part is glitched .

Every time a player uses it , it creates a new vehicle ( it should replace the first one instead, wich happen fine on sp )

The vehicle also have the addactions linked to it only for the player who created it .

if (!isNil "MHQ") then {deletevehicle MHQ};

if (side player == west ) then {
sleep 0.5;
MHQ = "B_Truck_01_covered_F" createvehicle (getmarkerpos "Spawn_MHQ");
sleep 0.5;
[MHQ] execVM "scripts\MHQ\deploy.sqf";   
MHQ addaction [("Teleport to Base"),"teleport\base.sqf","",5,false,true,"",""]; 
MHQ setdir 146.342;
};

The rest of the code is for east/independant side .

Tried to add some "jip proofs" scripts but all failed .

Thanks

Share this post


Link to post
Share on other sites

did you put this code inside if(isServer)?

if not, each player will have their MHQ variable

if you don't want each player create 1 more vehicle, i suggest you put createVehicle array command in the if(isServer) scope

And if you use if(isServer) scope, and if(!isDedicated) scope, please remember that they are 2 threads running at the same time(only in MP), just like []spawn{};

on the other hand, if MHQ is an object variable, you may want to use if(!isNull MHQ)

Edited by benw

Share this post


Link to post
Share on other sites
did you put this code inside if(isServer)?

if not, each player will have their MHQ variable

if you don't want each player create 1 more vehicle, i suggest you put createVehicle array command in the if(isServer) scope

And if you use if(isServer) scope, and if(!isDedicated) scope, please remember that they are 2 threads running at the same time(only in MP), just like []spawn{};

on the other hand, if MHQ is an object variable, you may want to use if(!isNull MHQ)

Thanks a lot sir , i'll test on dedicated server when i can .

( wasn't using isserver )

Share this post


Link to post
Share on other sites

you're welcome, you can put the mission to test in KK's MP sandbox, it is very convenient, no need to configure any complicated settings

Share this post


Link to post
Share on other sites

So it seems that nothing happen when a player try to spawn an MHQ .

With "if (isserver)" only the host can spawn MHQ .

( Worked fine in editor but after test with KK's MP sandbox nothing happen )

Edited by vinceXD

Share this post


Link to post
Share on other sites
try publicvariable "MHQ"; in if(isServer)

Yay , just added :

publicvariable "MHQ";

at the end of the file and working perfct .

Using if isServer is breaking the script for non host .

Thanks again

EDIT : Everything's fine , fixed addaction problem by adding this to the init.sqf :

if (!isDedicated) then {
[] spawn {
	waitUntil {!isNil "MHQ"};
	_MHQaction = MHQ addAction ["Teleport to base", "teleport\base.sqf"];
         _MHQaction2 = MHQ execVM "scripts\MHQ\deploy.sqf";
};
};

Edited by vinceXD

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  

×