how to achieve a script to only run server side

Soul

Valued Member!
i'm trying to achieve a script to run on the server
it spawns in stuff made by players but its running onthe mission file

so people who join in after something has been done by a player they dont see it
everyone else who whas in the server does see it, if you go back to lobby and respawn
it wont be visible anymore since it doestn seem to exist on the server or the new client
doestn get the information to make it visible ...

how is this achieved?
 
i tried putting the script in this

if(isServer) then {script insert here};

but that didnt work, going to try your method but it seems the same as what i tried to me...
or am i wrong about that?

ps your boobytrap script is very loved on our server!
 
i tried putting the script in this

if(isServer) then {script insert here};

but that didnt work, going to try your method but it seems the same as what i tried to me...
or am i wrong about that?

ps your boobytrap script is very loved on our server!

Put the code that I posted at the very top of it, then the rest of the script underneath it.
 
For example....
Code:
if (!isServer) exitWith {}; //Make sure this script runs only on server.
 
_bombOwnerUID = (_this select 0) select 0;      //diag_log format ["Bomb owner's UID is %1",_bombOwnerUID];
_bombPos = (_this select 0) select 1;          //diag_log format ["Bomb's position is %1",_bombPos];
 
//Create the stash object
_spawnStash = createVehicle ["StashSmall", [0,0,0], [], 0, "CAN_COLLIDE"];
 
//Prevent server from deleting the object by assigning it a blank UID.
_spawnStash setVariable ["ObjectUID",""];
 
//Create the trigger object
_bombTrigger = createTrigger["EmptyDetector",[0,0,0]];
_bombTrigger setTriggerArea [5,5,0,false];
_bombTrigger setTriggerActivation ["ANY","PRESENT",true];
_bombTrigger setTriggerStatements ["{(isPlayer _x)} count thisList > 0;","0 = [thisTrigger,_spawnStash,thislist] execVM 'Scripts\detonateBomb.sqf'",""]; //You don't want a vehicle like a helicopter to set off the trigger.
_bombTrigger setVariable ["ownerUID",_bombOwnerUID];
 
//Set position of stash and trigger
_spawnStash setPosATL _bombPos;
_bombTrigger setPosATL _bombPos;
DZ_boobyTrap = nil;



My booby trap :D
 
Back
Top