Jump to content
Sign in to follow this  
neodyn

Spawn crate near vehicle in MP

Recommended Posts

I want to spawn 4 crates next to a player via init a script :

act1 = this addAction ["<t color="#FF33CC">"+"Unload Cargo", "script\SpawnCargo.sqf"];

The SpawnCargo.sqf script:

player switchMove "Acts_carFixingWheel";
if (isServer) then 
{
sleep 5;
Box_1 = createVehicle ["ACE_medicalSupplyCrate", position player, [], 0, "NONE"];
sleep 5;
Box_2 = createVehicle ["ACE_medicalSupplyCrate", position player, [], 0, "NONE"];
sleep 5;
Box_3 = createVehicle ["ACE_medicalSupplyCrate", position player, [], 0, "NONE"];
sleep 5;
Box_4 = createVehicle ["ACE_medicalSupplyCrate", position player, [], 0, "NONE"];
};
MedicCar removeaction act1;

Local everything looks great.

But on an dedicated server, it does not realy work.

So there are a few problems.

1. the player changes in the prone pos. but other player can't see the whole animation. The players is seeing the animation (Acts_carFixingWheel).

2. No boxes where spawning arround the player.

3. The "MedicCar removeaction act1;" does only work for the player how has init the addAction first. But i need an option to remove the addAction after the first player has init the addAction.

Anyone has an idea ?

Share this post


Link to post
Share on other sites

1. switchmove effect is local, please see wiki. you need to exec it on every client.

2. isServer doesnt make sense as addAction script is executed on client that used action so never on server.

3. removeAction has local effect, please see wiki. You will need to execute it on every client. But since you put addAction in vehicle "init" it will add action for every new player again.

Share this post


Link to post
Share on other sites

@1 & 3: do i had to set an "call BIS_fnc_MP" at the end ? Is it that what you mean with "exec it on every client." ?

@2: so i do not need the isServer. Only the e.q "Box_1 = createVehicle ["ACE_medicalSupplyCrate", position player, [], 0, "NONE"];" is enough correct ?

Share this post


Link to post
Share on other sites

what you are trying to do is not simple. you have to consider what happens if several players use action at the same time. to make it work you need to make server handle box creation and once it is done for one time reject all further requests. I also suggest avoid using vehicle init until you understand the baggage it comes with. maybe wait for remoteExec commands rather than using bis_fnc_mp.

Share this post


Link to post
Share on other sites

Nevermind, doesn't work :´(

Edited by R3vo

Share this post


Link to post
Share on other sites
Didn't test this one, but it might work.

You should always test your code before offering someone a solution.

A. Will stop you look like you know nothing if it doesn't work

B. People that will look for working solution will not have to shift through tonnes of crap code

As it happens your code doesn't work.

Share this post


Link to post
Share on other sites
You should always test your code before offering someone a solution.

A. Will stop you look like you know nothing if it doesn't work

B. People that will look for working solution will not have to shift through tonnes of crap code

As it happens your code doesn't work.

Yeah you're right, didn't have much time yesterday, and I was somewhat sure it does work.

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  

×