Jump to content
dlder

Spawned vehicle not visible for other players in MP?

Recommended Posts

Dear community,

 

when I use my addon to open the Virtual Garage in SP or MP, I can spawn any vehicle I want and use it.

BUT: for some reason, in MP my friend won't see the vehicle; and if I drive in said vehicle, he just sees me kinda floating over the ground.

 

-> for me that means that the vehicle is spawned client side only; which shouldn't happen and is kinda weird, as the AI - which would run server side - CAN interact and enter my spawned vehicle... so maybe it's just other player-clients?

 

Without further ado, here's the code I'm using:

		_keyDown = (findDisplay 46) displayAddEventHandler ["KeyDown", "if ((inputAction 'User16') > 0) then
		{
			if (serverCommandAvailable '#kick') then
			{
				if (isNil 'HS_PG_Opened') then
				{
					HS_PG_Opened = 1;
					
					_pos = player getPos [20, getDir player];
					BIS_fnc_garage_center = createVehicle ['Land_HelipadEmpty_F', _pos, [], 0, 'NONE'];
					['Open', true] call BIS_fnc_garage;
				}
				else
				{
					hint format ['Sorry %1, but in  MP, the Virtual Garage is only available once every respawn!', profileName];
					{sleep 5; hintSilent '';} spawn BIS_fnc_spawn;
				};
			}
			else
			{
				hint format ['Sorry %1, but you are not an admin!', profileName];
				{sleep 5; hintSilent '';} spawn BIS_fnc_spawn;
			};
		};"];

And I've tried the following; executing the code on the server:

['Open', true] call BIS_fnc_garage;
------------------------------------------------------------------
['Open', true] remoteExec ['BIS_fnc_garage', 2];

"2" is the target; in this case it's executed only on the server: doesn't work

"0" doesn't work either -> this time the spawned vehicle will (of course) spawn for every player, but neither sees the vehicle of the other player

 

So, what am I doing wrong?

How am I able to spawn vehicles from the Virtual Garage in multiplayer?

 

Thanks in advance for any help/pointers etc.!!

 

cheers

 

Share this post


Link to post
Share on other sites

The Virtual Garage function spawns the vehicle only locally with createVehicleLocal. It might be necessary to replace the local vehicle with one that spawns globally when the player closes the garage. There is a scripted eventhandler that you might be able to use.

  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, 7erra said:

The Virtual Garage function spawns the vehicle only locally with createVehicleLocal.

 

That's it!

I now created an eventhandler and it spawns a vehicle which is visible in MP 🙂

 

Now I "only" have to figure out how to select the spawned vehicle; so I can delete it and spawn the same type on the server... (unfortunately there is no return variable from "BIS_fnc_garage" 😒

 

Share this post


Link to post
Share on other sites

BIS_fnc_garage_center contains the selected vehicle when the scripted EH fires

  • Thanks 1

Share this post


Link to post
Share on other sites

Really?

Doesn't it contain "Land_HelipadEmpty_F"?

 

Nope, you are absolutely right! Again! 🙂

 

Thank you very much!!

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

×