spawnloadouts
Diferencias
Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anteriorRevisión previaPróxima revisión | Revisión previa | ||
| spawnloadouts [2026/03/19 08:42] – adminwiki | spawnloadouts [2026/03/19 08:52] (actual) – adminwiki | ||
|---|---|---|---|
| Línea 62: | Línea 62: | ||
| void main() | void main() | ||
| { | { | ||
| - | //INIT WEATHER BEFORE ECONOMY INIT------------------------ | ||
| Weather weather = g_Game.GetWeather(); | Weather weather = g_Game.GetWeather(); | ||
| - | weather.MissionWeather(false); | + | weather.MissionWeather(false); |
| - | + | | |
| - | //INIT ECONOMY-------------------------------------- | + | if ( ce ) |
| - | Hive ce = CreateHive(); | + | |
| - | if ( ce ) | + | |
| ce.InitOffline(); | ce.InitOffline(); | ||
| - | | ||
| - | // | ||
| - | // | ||
| - | |||
| } | } | ||
| | | ||
| | | ||
| - | // DONATORS | + | // SPAWN LOADOUT |
| - | // How It Works: | + | |
| - | // SpawnLoadout/ | + | |
| - | // SpawnLoadout/ | + | |
| - | // SpawnLoadout/ | + | |
| class CustomMission: | class CustomMission: | ||
| { | { | ||
| - | string m_SpawnLoadoutDirectory = " | + | string m_SpawnLoadoutDirectory = " |
| - | string m_DonatorDirectory = m_SpawnLoadoutDirectory + " | + | string m_DonatorDirectory = m_SpawnLoadoutDirectory + " |
| - | | + | string m_RegularLoadout = m_SpawnLoadoutDirectory + " |
| - | string m_RegularLoadout = m_SpawnLoadoutDirectory + " | + | string m_CommonItems = m_SpawnLoadoutDirectory + " |
| - | string m_CommonItems = m_SpawnLoadoutDirectory + " | + | |
| | | ||
| void CustomMission() | void CustomMission() | ||
| Línea 95: | Línea 83: | ||
| FileHandle templateFile; | FileHandle templateFile; | ||
| - | PrintString(" | + | |
| - | PrintString(" | + | |
| - | PrintString(" | + | |
| - | PrintString(" | + | |
| - | PrintString(" | + | |
| | | ||
| if (!FileExist(m_SpawnLoadoutDirectory)) | if (!FileExist(m_SpawnLoadoutDirectory)) | ||
| { | { | ||
| - | PrintString(" | + | |
| - | PrintString(" | + | PrintString(" |
| - | MakeDirectory(m_SpawnLoadoutDirectory); | + | MakeDirectory(m_SpawnLoadoutDirectory); |
| - | PrintString(" | + | PrintString(" |
| | | ||
| - | | + | |
| - | PrintString(" | + | PrintString(" |
| - | templateFile = OpenFile(m_CommonItems, | + | templateFile = OpenFile(m_CommonItems, |
| - | FPrintln(templateFile, | + | FPrintln(templateFile, |
| - | CloseFile(templateFile); | + | CloseFile(templateFile); |
| - | PrintString(" | + | PrintString(" |
| | | ||
| - | | + | |
| - | PrintString(" | + | PrintString(" |
| - | templateFile = OpenFile(m_RegularLoadout, | + | templateFile = OpenFile(m_RegularLoadout, |
| - | FPrintln(templateFile, | + | FPrintln(templateFile, |
| - | CloseFile(templateFile); | + | CloseFile(templateFile); |
| - | PrintString(" | + | PrintString(" |
| } | } | ||
| | | ||
| if (!FileExist(m_DonatorDirectory)) | if (!FileExist(m_DonatorDirectory)) | ||
| { | { | ||
| - | PrintString(" | + | PrintString(" |
| - | string template = GetDonatorFile(" | + | |
| | | ||
| - | PrintString(" | + | PrintString(" |
| - | MakeDirectory(m_DonatorDirectory); | + | |
| - | PrintString(" | + | |
| | | ||
| - | | + | // create template donator file |
| - | PrintString(" | + | |
| - | templateFile = OpenFile(template, | + | |
| - | FPrintln(templateFile, | + | |
| - | CloseFile(templateFile); | + | |
| - | PrintString(" | + | |
| } | } | ||
| } | } | ||
| Línea 143: | Línea 131: | ||
| override void StartingEquipSetup(PlayerBase player, bool clothesChosen) | override void StartingEquipSetup(PlayerBase player, bool clothesChosen) | ||
| { | { | ||
| - | PrintString(" | + | |
| - | player.RemoveAllItems(); | + | player.RemoveAllItems(); |
| | | ||
| - | | + | |
| - | string line; | + | string line; |
| | | ||
| - | | + | |
| - | string file = GetDonatorFile(player.GetIdentity().GetPlainId()); | + | string file = GetDonatorFile(player.GetIdentity().GetPlainId()); |
| | | ||
| - | | + | |
| - | { | + | { |
| - | PrintString(" | + | PrintString(" |
| - | SpawnLoadout(player, | + | SpawnLoadout(player, |
| - | return; | + | return; |
| - | } | + | } |
| | | ||
| - | PrintString(" | + | |
| - | SpawnLoadout(player, | + | SpawnLoadout(player, |
| } | } | ||
| | | ||
| private void SpawnLoadout(PlayerBase player, ref TStringArray loadout) | private void SpawnLoadout(PlayerBase player, ref TStringArray loadout) | ||
| { | { | ||
| - | PrintString(" | + | |
| - | FileHandle loadoutFile; | + | FileHandle loadoutFile; |
| - | string line; | + | string line; |
| | | ||
| - | | + | |
| - | PrintString(" | + | PrintString(" |
| - | foreach (string clothes : loadout) | + | foreach (string clothes : loadout) |
| - | { | + | { |
| - | PrintString(" | + | PrintString(" |
| - | player.GetInventory().CreateInInventory(clothes); | + | player.GetInventory().CreateInInventory(clothes); |
| - | } | + | } |
| - | + | | |
| - | + | // creates common items | |
| - | | + | PrintString(" |
| - | PrintString(" | + | TStringArray items = ReadFileLines(m_CommonItems); |
| - | TStringArray items = ReadFileLines(m_CommonItems); | + | foreach (string item : items) |
| - | foreach (string item : items) | + | { |
| - | { | + | |
| - | PrintString(" | + | |
| - | if (!item.Contains("//" | + | |
| - | { | + | |
| - | player.GetInventory().CreateInInventory(item); | + | |
| - | } | + | } |
| - | } | + | |
| } | } | ||
| | | ||
| private void CreateQuantityItem(PlayerBase player, string item) | private void CreateQuantityItem(PlayerBase player, string item) | ||
| { | { | ||
| - | PrintString(" | + | |
| - | TStringArray quantity = new TStringArray(); | + | TStringArray quantity = new TStringArray(); |
| - | item.Split(" | + | item.Split(" |
| | | ||
| - | | + | |
| quantityItem.SetQuantity(quantity[1].ToFloat()); | quantityItem.SetQuantity(quantity[1].ToFloat()); | ||
| } | } | ||
| Línea 203: | Línea 190: | ||
| private string GetDonatorFile(string id) | private string GetDonatorFile(string id) | ||
| { | { | ||
| - | PrintString(" | + | PrintString(" |
| - | return string.Format(" | + | return string.Format(" |
| } | } | ||
| | | ||
| private TStringArray ReadFileLines(string path) | private TStringArray ReadFileLines(string path) | ||
| { | { | ||
| - | PrintString(" | + | PrintString(" |
| - | FileHandle file; | + | FileHandle file; |
| - | string line; | + | string line; |
| | | ||
| - | | + | |
| | | ||
| - | | + | |
| - | while (FGets(file, | + | while (FGets(file, |
| + | { | ||
| + | line.Trim(); | ||
| + | PrintString(" | ||
| + | if (line != string.Empty) | ||
| { | { | ||
| - | line.Trim(); | + | |
| - | PrintString(" | + | line = string.Empty; |
| - | if (line != string.Empty) | + | |
| - | { | + | |
| - | | + | |
| - | line = string.Empty; | + | |
| - | } | + | |
| } | } | ||
| + | } | ||
| | | ||
| - | | + | |
| - | return contents; | + | return contents; |
| } | } | ||
| }; | }; | ||
spawnloadouts.1773920520.txt.gz · Última modificación: por adminwiki
