How do I put scripts etc on server side on Island Life?

MrOMNZ

New Member
Hello

I would really appreciate if anyone could help me

How do I put scripts etc on server side on Island Life?

Thanks
 
He asked because Island Life is generally a mission only configuration like Wasteland
Dayz admins are familiar with separating out code that operates on the server from code that operates on the client, so someone on the Island Life forums probably said, "Thats the way Dayz works, someone there might know" ... so this probably was the correct place to ask.
Has not logged in for a month so probably doesnt care anymore but the correct answer is to create a folder in your Arma server named ServerFiles and then just call those files on the server only using the folder location \ServerFiles\serverScript.sqf
Then any file that is within an if (isServer) code block can be moved into the ServerFiles folder and removed from the mission. One issue that will arise is the global variables created by that script and required on clients will not be found on the clients because "global" means globally on that particular machine, i.e. the server. Dayz has a publicvariable system to make those values available to the clients. So you would need to have a script on the server that runs constantly monitors all global server variables and broadcasts the CHANGED VALUES ONLY to all clients using publicvariable whenever that value has changed.
For reference, the server_monitor.sqf of dayz checks the server time and broadcasts that to all players to keep time in sync.
Code:
//Set the Time
...
...
    setDate _date;
    dayzSetDate = _date;
    publicVariable "dayzSetDate";
    diag_log ("TIME SYNC: Local Time set to " + str(_date));
};

There is also a file that is entirely concerned with this which its method of use would be useful as a reference.
E:\Arma\Server\@hive\AddOns\dayz_server\compile\server_sendToClient.sqf
Code:
private ["_unit","_variable","_arraytosend","_owner","_vehicle","_qty"];
//Inbound [_unit,"PVCDZ_hlt_Transfuse",[_unit,player,1000]]
_unit = _this select 0;
_variable = _this select 1;
_arraytosend = _this select 2;
_owner = owner _unit;


//diag_log format ["%1, %2, %3, %4", _unit, _variable, _arraytosend, _owner];

//execution
switch (_variable) do {
    case "VehHandleDam": {
        _vehicle = _arraytosend select 0;
        if (local _vehicle) then {
            _arraytosend call fnc_veh_handleDam;
        } else {
            PVCDZ_veh_SH = _arraytosend;
            _owner publicVariableClient "PVCDZ_veh_SH";
        };
    };
  
    case "SetFuel": {
        _vehicle = _arraytosend select 0;
        _qty = _arraytosend select 1;
        if (local _vehicle) then {
            _vehicle setFuel _qty;
        } else {
            PVCDZ_veh_SetFuel = _arraytosend;
            _owner publicVariableClient  "PVCDZ_veh_SetFuel";
        };
    };
... REST OF FILE DELETED ... YOU GET THE IDEA ....
 
Last edited:
Back
Top