spawnloadouts
Diferencias
Muestra las diferencias entre dos versiones de la página.
| Ambos lados, revisión anteriorRevisión previa | |||
| spawnloadouts [2026/03/19 08:44] – adminwiki | spawnloadouts [2026/03/19 08:52] (actual) – adminwiki | ||
|---|---|---|---|
| Línea 83: | 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 131: | 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 191: | 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.1773920655.txt.gz · Última modificación: por adminwiki
