Jump to content
Sign in to follow this  
Redfield-77

Help me make this work on a dedicated server please

Recommended Posts

I am a terrible scripter and I am not sure how to make this script work on a dedicated server. It works perfectly in the editor but no go on our dedi. The script spawns colored arrows on the spots where FT members should be standing and they point to the corresponding sector of fire.

if (! isServer) exitWith {};


_w1 = _this select 0;
_w2 = _this select 1;
_w3 = _this select 2;
_w4 = _this select 3;
_w5 = _this select 4;

_w1 = createVehicle ["Sign_Arrow_Direction_Blue_F",getMarkerPos "wedge1",[], 0, "CAN_COLLIDE"];
_w2 = createVehicle ["Sign_Arrow_Direction_F",getMarkerPos "wedge2",[], 0, "CAN_COLLIDE"];
_w3 = createVehicle ["Sign_Arrow_Direction_Cyan_F",getMarkerPos "wedge3",[], 0, "CAN_COLLIDE"];
_w4 = createVehicle ["Sign_Arrow_Direction_Green_F",getMarkerPos "wedge4",[], 0, "CAN_COLLIDE"];
_w5 = createVehicle ["Sign_Arrow_Direction_Yellow_F",getMarkerPos "wedge5",[], 0, "CAN_COLLIDE"];


_w2 setDir 45;
_w3 setDir 315;
_w4 setDir 45;
_w5 setDir 180;

sleep 10;


deleteVehicle _w1;
deleteVehicle _w2;
deleteVehicle _w3;
deleteVehicle _w4;
deleteVehicle _w5;

I realize its probly something easy to fix but keep in mind I have no idea what im doing.

Share this post


Link to post
Share on other sites

what is it executed from ?

maybe try this ?

if (!isServer) exitWith {hint "I WAS KICKED BECAUSE I AM NOT THE SERVER";};

to see if the client is trying to read the script and you are kicking them from the script.

Edited by BL1P

Share this post


Link to post
Share on other sites

I call the script with an AddAction on a sign board that has a .jpeg of the formations on it. Im not really sure how that would help me, or if I understand you correctly. I did read that Vehicles cannot be created locally though.

Share this post


Link to post
Share on other sites

AddActions are executed by the client.

Using

if(!isServer) exitWith {};

will stop the client from running the script as this reads "If you are NOT the server, Go Away"

FYI, vehicles can be created locally. See createVehicleLocal ;)

Edited by roy86

Share this post


Link to post
Share on other sites

Thanks Roy,

So if I just remove the

if(!isServer) exitWith {};

It will work on a dedicated server?

Share this post


Link to post
Share on other sites

Almost, I'm assuming your addAction is something like this:

_signBoard addAction ["Create Arrows","some_script.sqf"];

If this is the case then the below has no place in the some_script

_w1 = _this select 0;
_w2 = _this select 1;
_w3 = _this select 2;
_w4 = _this select 3;
_w5 = _this select 4;

I've shrunk it so this should work being called from an AddAction.

some_script.sqf

if(isDedicated) exitWith{}; //<!-- Prevents Server Running the Code should something else call this serverside.

_w1 = createVehicle ["Sign_Arrow_Direction_Blue_F",getMarkerPos "wedge1",[], 0, "CAN_COLLIDE"];
_w2 = createVehicle ["Sign_Arrow_Direction_F",getMarkerPos "wedge2",[], 0, "CAN_COLLIDE"];
_w3 = createVehicle ["Sign_Arrow_Direction_Cyan_F",getMarkerPos "wedge3",[], 0, "CAN_COLLIDE"];
_w4 = createVehicle ["Sign_Arrow_Direction_Green_F",getMarkerPos "wedge4",[], 0, "CAN_COLLIDE"];
_w5 = createVehicle ["Sign_Arrow_Direction_Yellow_F",getMarkerPos "wedge5",[], 0, "CAN_COLLIDE"];

_w2 setDir 45;
_w3 setDir 315;
_w4 setDir 45;
_w5 setDir 180;

sleep 10;

deleteVehicle _w1;
deleteVehicle _w2;
deleteVehicle _w3;
deleteVehicle _w4;
deleteVehicle _w5;

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  

×