commit d179f008bfaef42be710f7f9831a2f8ebd8a5753 Author: NRZ7 Date: Sat Oct 8 14:55:39 2016 +0200 First Release diff --git a/addons/modChecker/modChecker.paa b/addons/modChecker/modChecker.paa new file mode 100644 index 0000000..544a39d Binary files /dev/null and b/addons/modChecker/modChecker.paa differ diff --git a/addons/modChecker/modChecker.sqf b/addons/modChecker/modChecker.sqf new file mode 100644 index 0000000..77a3be1 --- /dev/null +++ b/addons/modChecker/modChecker.sqf @@ -0,0 +1,99 @@ +// ********************************************************************************************************** +// * This project is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) +// * https://creativecommons.org/licenses/by-sa/4.0/ +// ********************************************************************************************************** +// @file Name: modChecker.sqf +// @file Author: NRZ7 (www.standarol.com) +// @description: This script check the mods loaded by the client. If any mod is not loaded, pop's a screen with detailed information and clickable community links (modCheckerDisplay.sqf). +// You can configure requiered addons (error 99) or optional addons (error 1). If any required mod fails, the client load "You Loose" screen after close the dialog. +// + + +errorLevel = 0; + + +// Exile_Client Example +// Change "Exile_Client" to name of the Cfg patche from desired mod +if (isClass(configFile >> "CfgPatches" >> "Exile_Client")) then { +// Change checkExile to your desired mod variable name +// Change "Exile Mod is" to your mod string + checkExile = "Exile Mod is found!
"; + } else { +// Change "Exile Mod is" to your mod string + checkExile = "Exile Mod is NOT FOUND!
"; +// Set 99 to Required, Set 1 to optional + errorLevel = errorLevel + 99 + }; + +// Esseker Example +if (isClass(configFile >> "CfgPatches" >> "Esseker")) then { + checkEsseker = "Esseker Map is found!
"; + } else { + checkEsseker = "Esseker Map is NOT FOUND!
"; + errorLevel = errorLevel + 99 + }; + +// Zombis & Demonds Example +if (isClass(configFile >> "CfgPatches" >> "Ryanzombies")) then { + checkRyan = "Zombies and Demonds is found!
"; + } else { + checkRyan = "Zombies and Demonds is NOT FOUND!
"; + errorLevel = errorLevel + 99 + }; + +// CUP_Weapons Example +if (isClass(configFile >> "CfgPatches" >> "CUP_Weapons_WeaponsCore")) then { + checkWeapons = "CUP Weapons is found!
"; + } else { + checkWeapons = "CUP Weapons is NOT FOUND!
"; + errorLevel = errorLevel + 1 + }; + +// CUP_Vehicles Example +if (isClass(configFile >> "CfgPatches" >> "CUP_Vehicles_Core")) then { + checkVehicles = "CUP Vehicles is found!
"; + } else { + checkVehicles = "CUP Vehicles is NOT FOUND!
"; + errorLevel = errorLevel + 1 + }; + +// CUP_TerrainCore Example +if (isClass(configFile >> "CfgPatches" >> "CUP_Worlds")) then { + checkTerrain = "CUP Terrain Core is found!
"; + } else { + checkTerrain = "CUP Terrain Core is NOT FOUND!
"; + errorLevel = errorLevel + 1 + }; + +// CUP_Units Example +if (isClass(configFile >> "CfgPatches" >> "CUP_Creatures_People_Core")) then { + checkUnits = "CUP Units is found!
"; + } else { + checkUnits = "CUP Units is NOT FOUND!
"; + errorLevel = errorLevel + 1 + }; + +// Community Base Addon Example +if (isClass(configFile >> "CfgPatches" >> "CBA_main")) then + { + checkCBA = "CBA_A3 is found!
"; + } else { + checkCBA = "CBA_A3 is NOT FOUND!
"; + errorLevel = errorLevel + 1 + }; + +if (errorLevel > 0) then { + warnMessage = "Some is WRONG with your MODS
"; + } else { + warnMessage = "All MODS are FINE
"; + }; + +if ((errorLevel == 0) && (firstCheck == 0)) then { + firstCheck = 1 // Do nothing + } else { + execVM "addons\modChecker\modCheckerDisplay.sqf" + }; + +// execVM "addons\modChecker\modCheckerDisplay.sqf" + + diff --git a/addons/modChecker/modCheckerDisplay.sqf b/addons/modChecker/modCheckerDisplay.sqf new file mode 100644 index 0000000..cfa8700 --- /dev/null +++ b/addons/modChecker/modCheckerDisplay.sqf @@ -0,0 +1,97 @@ +// ********************************************************************************************************** +// * This project is licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) +// * https://creativecommons.org/licenses/by-sa/4.0/ +// ********************************************************************************************************** +// @file Name: modCheckerDisplay.sqf +// @file Author: NRZ7 (www.standarol.com) +// @description: This script is a UI launched by modchecker.sqf. If any mod is not loaded, pop's a screen with detailed information and clickable community links (modCheckerDisplay.sqf). +// You can configure custom messages and links to your community guides. + +/* + Some code is from + File: rules.sqf + For exile edited by Repentz + Link: http://www.exilemod.com/topic/10375-advanced-server-rules-for-xm8/ +*/ + +if ((firstCheck == 0) && (errorLevel > 0)) then { player allowdamage false }; // God Mode ON to avoid die and close dialog only if ModCheckerDisplay is auto opened. + +disableSerialization; +[ + "", + 0, + 0.2, + 10, + 0, + 0, + 8 +] spawn BIS_fnc_dynamicText; + +createDialog "RscDisplayWelcome"; + +_display = findDisplay 999999; // 999999 needed to whitelist in infistar if you are using this. +_text1 = _display displayCtrl 1100; +_buttonSpoiler = _display displayctrl 2400; +_textSpoiler = _display displayctrl 1101; +_text2 = _display displayCtrl 1102; + +///////////////////////////////////////////////////////////////////////////////////////////// +// Remember to add-delete-modify the same mod variable names like modChecker.sqf +///////////////////////////////////////////////////////////////////////////////////////////// + +// Display header +_message = ""; +_message = _message + "
"; +_message = _message + "Welcome to Mod Checker
"; +_message = _message + "______________________________________________________________________________________

"; +_message = _message + warnMessage; +_message = _message + "
"; + +//Mod variable names +_message = _message + checkExile; +_message = _message + checkEsseker; +_message = _message + checkRyan; +_message = _message + checkWeapons; +_message = _message + checkVehicles; +_message = _message + checkUnits; +_message = _message + checkTerrain; +_message = _message + checkCBA; + +// Custom message with community links +_message = _message + "
"; +_message = _message + "If you get any error, please, read the following links

"; +_message = _message + "Download the mods from Steam Workshop Only click on Subscribe!
"; +_message = _message + "Guía de lanzamiento e instalación de mods [ESPAÑOL]


"; + +///////////////////////////////////////////////////////////////////////////////////////////////////// +// END OF CUSTOMIZABLE TEXT, DO NOT TOUCH UNDER THIS LINE IF YOU DON'T KWOW WHAT ARE YOU WANT +//////////////////////////////////////////////////////////////////////////////////////////////////// + +//Fill only the first text +_text1 ctrlSetStructuredText (parseText _message); + +//Resize StructuredText component to display the scrollbar if needed +_positionText1 = ctrlPosition _text1; +_yText1 = _positionText1 select 1; +_hText1 = ctrlTextHeight _text1; +_text1 ctrlSetPosition [_positionText1 select 0, _yText1, _positionText1 select 2, _hText1]; +_text1 ctrlcommit 0; +//Hide second text, spoiler text and button +_buttonSpoiler ctrlSetFade 1; +_buttonSpoiler ctrlCommit 0; +_buttonSpoiler ctrlEnable false; +_textSpoiler ctrlSetFade 1; +_textSpoiler ctrlCommit 0; +_text2 ctrlSetFade 1; +_text2 ctrlCommit 0; + +//Waith until dialog is closed and kick the player if a required mod is not loaded. +waitUntil {!dialog }; +if (errorLevel > 90) then // non requiered addons have level 1. Requiered addons have error level 99. + { + endMission "LOSER" + } + else + { + firstCheck = 1; player allowDamage true // Disables God Mode protection and set mods as checked. + }; \ No newline at end of file diff --git a/config.cpp b/config.cpp new file mode 100644 index 0000000..761f633 --- /dev/null +++ b/config.cpp @@ -0,0 +1,12 @@ +class CfgXM8 +{ + extraApps[] = {"modChecker"}; + + class modChecker + { + title = "Mod Checker"; + logo = "addons\modChecker\modChecker.paa"; + quickFunction = "[] execVM 'addons\modChecker\modChecker.sqf'"; + + }; +}; \ No newline at end of file diff --git a/initPlayerLocal.sqf b/initPlayerLocal.sqf new file mode 100644 index 0000000..227ade8 --- /dev/null +++ b/initPlayerLocal.sqf @@ -0,0 +1,29 @@ +// Add this at the bottom of initPlayerLocal.sqf + +/////////////////////////////////////////////////////////////////////////// +// MOD CHECKER +/////////////////////////////////////////////////////////////////////////// + +waitUntil {!isNull findDisplay 46 && !isNil 'ExileClientLoadedIn' && getPlayerUID player != ''}; // wait until player is in spawned +uiSleep 3; + +firstCheck = 0; +execVM "addons\modChecker\modChecker.sqf"; + +/////////////////////////////////////////////////////////////////////////// +// MOD CHECKER + PROTECTION REMEMBER +/////////////////////////////////////////////////////////////////////////// + +/*Note, if you have Exile ProtectionRemember.sqf, use this + +waitUntil {!isNull findDisplay 46 && !isNil 'ExileClientLoadedIn' && getPlayerUID player != ''}; // wait until player is in spawned +uiSleep 3; +execVM "addons\scripts\protectionRemember.sqf"; +/////////////////////////////////////////////////////////////////////////// +// MOD CHECKER +/////////////////////////////////////////////////////////////////////////// + +firstCheck = 0; +execVM "addons\modChecker\modChecker.sqf"; + +*/ \ No newline at end of file