Skip to content

Commit

Permalink
started work on server speficic configuration file settings for serve…
Browse files Browse the repository at this point in the history
…r owners to configure more options/behaviour of the menu and the functions inside the menu
  • Loading branch information
TomGrobbe committed May 25, 2018
1 parent efe8175 commit 87aea60
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 deletions.
12 changes: 9 additions & 3 deletions vMenu/CommonFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,13 @@ public async void SpawnVehicle(uint vehicleHash, bool spawnInside, bool replaceP
// Otherwise
else
{
// Set the vehicle to be no longer needed. This will make the game engine decide when it should be removed (when all players get too far away).
previousVehicle.IsPersistent = false;
previousVehicle.MarkAsNoLongerNeeded();
if (!Configuration.keepSpawnedVehiclesPersistent)
{
// Set the vehicle to be no longer needed. This will make the game engine decide when it should be removed (when all players get too far away).
previousVehicle.IsPersistent = false;
previousVehicle.PreviouslyOwnedByPlayer = false;
previousVehicle.MarkAsNoLongerNeeded();
}
}
previousVehicle = null;
}
Expand Down Expand Up @@ -1820,6 +1824,7 @@ public void LoadSavedPed(string savedName)
}
#endregion

#region saved ped json string to ped info
/// <summary>
/// Load and convert json ped info into PedInfo struct.
/// </summary>
Expand Down Expand Up @@ -1907,6 +1912,7 @@ public PedInfo JsonToPedInfo(string json, string saveName)
}
return pi;
}
#endregion

#region Save and restore weapon loadouts when changing models
private struct WeaponInfo
Expand Down
44 changes: 44 additions & 0 deletions vMenu/Configuration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CitizenFX.Core;
using static CitizenFX.Core.Native.API;

namespace vMenuClient
{
public static class Configuration
{
private static bool initialized = false;
public static void InitializeConfig()
{
if (!initialized)
{
string file = LoadResourceFile("vMenu", "config/config.ini");
if (file != null && !string.IsNullOrEmpty(file))
{
ParseConfig(file);
}
else
{
Debug.Write("\n\n[vMenu] Error loading config file! Please notify the server owner if you see this.\n\n");
}
}
initialized = true;
}

private static void ParseConfig(string config)
{

}




#region vehicle related settings
public static bool keepSpawnedVehiclesPersistent = false;
#endregion

}
}
1 change: 1 addition & 0 deletions vMenu/vMenuClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="CommonFunctions.cs" />
<Compile Include="Configuration.cs" />
<Compile Include="EventManager.cs" />
<Compile Include="FunctionsController.cs" />
<Compile Include="MainMenu.cs" />
Expand Down

0 comments on commit 87aea60

Please sign in to comment.