Autor: Maihym
Was macht dieses Scirpt ?
A: Man kann durch dieses Script alle Mission Seitige Code auf den Server verschieben. So könnt ihr Maverick oder Mikero sparen (finde ich)
MPMISSION
1. In der init.sqf ganz oben folgendes einfügen:
2. Öffnet eure initPlayerLocal.sqf wieder ganz oben folgendes:
waitUntil {!(isNil "allFunctions")};
[] remoteExec ["TON_fnc_receiveFunctions",clientOwner];
waitUntil {(!(isNil "life_serverFunctionsReady"))}; waitUntil {life_serverFunctionsReady};
3. Fügt in der CfgRemoteExec.hpp unter ANYONE folgendes ein:
LIFE SERVER
1. In der init.sqf wieder ganz oben fügt ihr folgendes ein:
life_serverFunctionsReady = false;
TON_fnc_receiveFunctions =
compileFinal "
{
_name = _x select 0;
_code = _x select 1;
missionNamespace setVariable [_name,_code];
}forEach allFunctions;
life_serverFunctionsReady = true;
";
publicVariable "TON_fnc_receiveFunctions";
[] spawn {
["server"] remoteExec ["TON_fnc_initFunctions",2];
waitUntil {life_serverFunctionsReady};
};
Alles anzeigen
2. Erstellt einen neuen Ordner namens "Client"
3. Erstellt eine neue sqf namens fn_initFunctions und fügt diese in den Client Ordner:
private ['_code', '_function', '_file', '_fileContent'];
if !(isNil "allFunctions") exitWith {};
allFunctions = [];
{
_code = '';
_function = _x select 0;
_file = _x select 1;
_fileContent = preprocessFileLineNumbers _file;
_code = compileFinal _fileContent;
_pushme = [_function,_code];
allFunctions pushBack _pushme;
}
forEach
[
//['life_fnc_FUNCTIONNAME', '\life_server\Client\PathToFunction\fn_FUNCTIONNAME.sqf']
];
publicVariable "allFunctions";
[allFunctions] remoteExec ["TON_fnc_receiveFunctions",2];
Alles anzeigen
4. Fügt in der Config.cpp unter class CfgFunctions folgendes ein:
Life_Server & Mission
Beispiel: Wir wollen unsere KeyHandler.sqf im Life Server haben
1. Im Client Ordner erstellt ihr neue Ordner [Pfad wo die SQF ist]
2. Kopiert die keyhandler.sqf in den Life Server und löscht sie in der MP Mission
3. Jetzt geht ihr in die fn_initFunctions.sqf und fügt unter foreach folgendes ein:
So sollte es, dann bei euch ausschauen:
private ['_code', '_function', '_file', '_fileContent'];
if !(isNil "allFunctions") exitWith {};
allFunctions = [];
{
_code = '';
_function = _x select 0;
_file = _x select 1;
_fileContent = preprocessFileLineNumbers _file;
_code = compileFinal _fileContent;
_pushme = [_function,_code];
allFunctions pushBack _pushme;
}
forEach
[
['life_fnc_keyHandler', '\life_server\Client\core\functions\fn_keyHandler.sqf']
];
publicVariable "allFunctions";
[allFunctions] remoteExec ["TON_fnc_receiveFunctions",2];
Alles anzeigen
4. INFO!!!!!!
Wenn ihr das bei mehren Dateien macht muss ein Komma stehen
Beispiel:
private ['_code', '_function', '_file', '_fileContent'];
if !(isNil "allFunctions") exitWith {};
allFunctions = [];
{
_code = '';
_function = _x select 0;
_file = _x select 1;
_fileContent = preprocessFileLineNumbers _file;
_code = compileFinal _fileContent;
_pushme = [_function,_code];
allFunctions pushBack _pushme;
}
forEach
[
['life_fnc_keyHandler', '\life_server\Client\core\functions\fn_keyHandler.sqf'], //KOMMA HIER !!!!!
['life_fnc_AmaZiinG', '\life_server\Client\core\AmaZiinG\fn_AmaZiinG.sqf'] //KOMMA AM ENDE NICHT !!!!
];
publicVariable "allFunctions";
[allFunctions] remoteExec ["TON_fnc_receiveFunctions",2];
Alles anzeigen
Fertig!