Jump to content
Sign in to follow this  
GodsStallion

Code to prevent unit spawn scripts running multiple times in multiplayer?

Recommended Posts

Can't remember the command to stop the script spawning groups for every player in the game. Example if one infantry squad is supposed to spawn, then when 5 players are in the game it will spawn 5 infantry squads instead of one.

I'm sure the code/command begins with ifServer present or something like that.

Even though its funny seeing 5 tanks spawning in the same place and then flying off in the air, I'd rather it not happen. HELP!

Share this post


Link to post
Share on other sites

Script? Trigger?

If everyone is running the script, everyone will spawn vehicles. Can be prevented by putting

if (!isServer) exitWith {};

at the top of the script.

Alternatively

//do stuff here

if (isServer) then {
 "AH1Z" createVehicle markerPos "respawn_west";
 //etc
}
//more stuff

If you have other stuff that both clients and server should run.

Share this post


Link to post
Share on other sites

I used that scripting line as I had a similar issue but I used it for spawning hear and now the host is the only one that can see the weaponholders. Any clue how to prvenet multiple spawns yet allow everyone to see the gear? I can find the weaponholder when someone else is hosting but when I open it there's nothing in it and nothing appears on the ground.

Share this post


Link to post
Share on other sites

use addWeaponCargoGlobal / addMagazineCargoGlobal

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  

×