CommonDataFramework 1.0.0.5
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package CommonDataFramework --version 1.0.0.5
NuGet\Install-Package CommonDataFramework -Version 1.0.0.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CommonDataFramework" Version="1.0.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CommonDataFramework" Version="1.0.0.5" />
<PackageReference Include="CommonDataFramework" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CommonDataFramework --version 1.0.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CommonDataFramework, 1.0.0.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CommonDataFramework@1.0.0.5
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CommonDataFramework&version=1.0.0.5
#tool nuget:?package=CommonDataFramework&version=1.0.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Common Data Framework
Common Data Framework 'CDF' is an open-source LSPDFR plugin that offers an extended vehicle and ped record API for developers. It's main goal is to replace missing features of the LSPDFR API while providing synchronization of that data across all plugins who use it. It is used by the upcoming 'Policing Redefined' plugin and is already planned to be implement in current and future plugins.
Features
General
- Lightweight and easy-to-use API:
ped.GetPedData()andvehicle.GetVehicleData(), aswell as events - Even when the entity stopped existing, CDF stores the data in the database for an extra period of time to ensure longer accessibility
- Very customizeable objects to alter almost any property to your needs
- End-user can customize probabilities through a simple
.inito enhance their gameplay experience without you having to write extra code
Pedestrian Data
- Drivers license expiration
- Home address
- Permits (weapon, fishing, hunting)
- ...and more
- Syncs with LSPDFR persona, all persona fields can be directly accessed through the object too
Vehicle Data
- VIN
- Registration
- Insurance
- Vehicle owner (of type
PedData) aswell as different owner "types"
Example images by PR
Example for developers
using CommonDataFramework.API;
using CommonDataFramework.Modules;
using CommonDataFramework.Modules.PedDatabase;
using CommonDataFramework.Modules.VehicleDatabase;
using LSPD_First_Response.Mod.API;
using Rage;
using Rage.Attributes;
public class EntryPoint : Plugin
{
internal static bool OnDutyState;
public override void Initialize()
{
LSPDFRFunctions.OnOnDutyStateChanged += OnOnDutyStateChanged;
Game.AddConsoleCommands();
}
public override void Finally()
{
LSPDFRFunctions.OnOnDutyStateChanged -= OnOnDutyStateChanged;
}
// Example of getting ped data:
[ConsoleCommand]
internal static void Command_LogClosestPed(bool changeHuntingPermit)
{
Ped[] peds = Game.LocalPlayer.Character.GetNearbyPeds(1);
if (peds.Length == 0)
{
Game.LogTrivial("Could not find any nearby ped.");
return;
}
Ped ped = peds[0];
PedData pedData = ped.GetPedData();
Game.LogTrivial($"Ped name: {pedData.FullName}.");
// Example of giving the ped a hunting permit:
if (changeHuntingPermit && pedData.HuntingPermit.Status != EDocumentStatus.Valid)
{
pedData.HuntingPermit.Status = EDocumentStatus.Valid;
Game.LogTrivial($"Hunting permit expiration: {pedData.HuntingPermit.ExpirationDate:MM/dd/yyyy}");
}
}
// Example of getting vehicle data:
[ConsoleCommand]
internal static void Command_LogClosestVehicle(bool changeRegistration)
{
Vehicle[] vehicles = Game.LocalPlayer.Character.GetNearbyVehicles(1);
if (vehicles.Length == 0)
{
Game.LogTrivial("Could not find any nearby vehicle.");
return;
}
Vehicle vehicle = vehicles[0];
VehicleData vehicleData = vehicle.GetVehicleData();
Game.LogTrivial($"Vehicle VIN: {vehicleData.Vin}.");
Game.LogTrivial($"Vehicle Owner: {vehicleData.Owner.FullName} (Type: {vehicleData.OwnerType})."); // <VehicleData>.Owner -> PedData
// Example of setting a vehicle's registration as expired:
if (changeRegistration && vehicleData.Registration.Status != EDocumentStatus.Expired)
{
vehicleData.Registration.Status = EDocumentStatus.Expired;
Game.LogTrivial($"Vehicle registration expired on: {vehicleData.Registration.ExpirationDate:MM/dd/yyyy}");
}
}
private static void OnOnDutyStateChanged(bool onDuty)
{
OnDutyState = onDuty;
// CDF might take some time until it fully read the users .xml and .ini file on startup.
// This means that if you try to access CDF stuff before it was marked as ready, it will have to fall back to default values.
// One way of solving this:
GameFiber.WaitUntil(CDFFunctions.IsPluginReady, 30000); // The fiber will wait until CDF loaded fully.
// ...rest of your startup code that includes CDF usage.
// Alternatively, if you don't care about the default values or you are not using CDF right on startup, you can simply skip this.
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net48 is compatible. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.