Skip to content

Instantly share code, notes, and snippets.

@wrdg
Created January 11, 2024 02:58
Show Gist options
  • Save wrdg/da9654bcb328028285c6431376bc9fd2 to your computer and use it in GitHub Desktop.
Save wrdg/da9654bcb328028285c6431376bc9fd2 to your computer and use it in GitHub Desktop.
Simple script to output published id's of mods loaded from within the DayZ root directory. Useful for checking for repacks, needs a small adpation for that though :)
modded class DayZGame
{
void DayZGame()
{
array<string> mods = {};
string param;
if (CommandlineGetParam("mod", param))
{
param.Split(";", mods);
}
if (CommandlineGetParam("servermod", param))
{
param.Split(";", mods);
}
foreach (string mod : mods)
{
string meta = string.Format("$CurrentDir:%1/meta.cpp", mod);
if (!FileExist(meta))
{
continue;
}
string name;
string publishedId;
FileHandle file = OpenFile(meta, FileMode.READ);
string line;
while (FGets(file, line) > 0)
{
line.TrimInPlace();
int equalIndex = line.IndexOf("=");
int semiColonIndex = line.IndexOf(";");
if (equalIndex != -1 && semiColonIndex != -1)
{
string key = line.Substring(0, equalIndex).Trim();
key.ToLower();
string value = line.Substring(equalIndex + 1, semiColonIndex - equalIndex - 1).Trim();
if (key == "name")
{
name = value;
name.Replace("\"", string.Empty);
}
if (key == "publishedid")
{
publishedId = value;
}
}
}
PrintFormat("Mod Loaded: %1 (%2)", name, publishedId);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment