Cfx.docs
FIVEM ENHANCED · .NET 10

CitizenFX API.

Unofficial documentation built directly from the CitizenFX FiveM 0.0.3-alpha packages. It includes basic usage guides and a searchable public API reference.

Alpha noticeThe API may change without backward compatibility.
01 · INSTALLATION

Quick start

A basic client resource needs a .NET 10 project and one direct NuGet reference.

C#
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="CitizenFX.FiveM.Client" Version="0.0.3-alpha" />
  </ItemGroup>
</Project>
01ClientDirect reference
02SharedTransitive dependency
03BaseRuntime foundation
02 · SCRIPT

IScript lifecycle

The runtime finds concrete classes implementing IScript, creates them with a parameterless constructor, registers their attributes, and calls the optional Initialize() method.

1Assembly scanFind IScript types
2new Client()Parameterless constructor
3AttributesCommand, event, export
4InitializeOptional startup
C#
using CitizenFX.FiveM.Client;
using CitizenFX.FiveM.Shared.Script;

public class Client : IScript
{
    public void Initialize()
    {
        API.Log.Info("Hello from CitizenFX");
    }
}

Initialize is optional

IScript provides an empty default implementation.

!

No constructor DI

The runtime uses Activator.CreateInstance(type).

03 · HANDLERY

Commands, events a exports

A neutral starter example for registering the most common handlers.

C#
public class Client : IScript
{
    [OnCommand("hello")]
    private void OnHelloCommand()
    {
        API.Log.Info("Hello!");
    }

    [OnNetEvent("example:message")]
    private void OnMessage(string message)
    {
        API.Log.Info(message);
    }

    [ExportMethod("GetVersion")]
    private string GetVersion() => "1.0.0";
}
[OnCommand("name")]Local command
[OnEvent("name")]Local event
[OnNetEvent("name")]Network event
[ExportMethod("name")]Resource export
04 · ASYNC

Scheduler and game tick

[Tick] does not exist in this version. Use API.Yield(), API.Delay(), or a fixed interval.

FRAMEawait API.Yield()

Continue on the next runtime tick.

DELAYawait API.Delay(ms)

Dynamic delay in milliseconds.

INTERVALAPI.SetInterval(...)

A synchronously repeated action with a fixed interval.

C#
private async Task RunLoop()
{
    while (true)
    {
        // Repeated resource logic
        await API.Delay(1000);
    }
}
05 · GAME API

Native calls

Generated C# wrappers are available through the static Native class.

C#
var playerPed = Native.PlayerPedId();
var position = Native.GetEntityCoords(playerPed, true);

API.Log.Info($"Player: {position}");
1

Find a native

Select the Natives filter in the API reference and enter its C# name.

2

Open its details

View the signature, parameters, hash, and available overloads.

06 · REFERENCE

Complete API reference

A dedicated Client, Server, Shared, and Base API explorer with a package tree, search, and progressively loaded results.

Open API reference
07 · DATA SOURCE

Good to know

01

Unofficial content

The text and examples are derived from the public API and decompiled implementation.

02

Exact version

The reference matches the 0.0.3-alpha packages for net10.0.

03

No XML comments

The explorer documents exact declarations; the package does not describe the meaning of individual GTA natives.