Initialize is optional
IScript provides an empty default implementation.
Unofficial documentation built directly from the CitizenFX FiveM 0.0.3-alpha packages. It includes basic usage guides and a searchable public API reference.
A basic client resource needs a .NET 10 project and one direct NuGet reference.
<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>The runtime finds concrete classes implementing IScript, creates them with a parameterless constructor, registers their attributes, and calls the optional Initialize() method.
using CitizenFX.FiveM.Client;
using CitizenFX.FiveM.Shared.Script;
public class Client : IScript
{
public void Initialize()
{
API.Log.Info("Hello from CitizenFX");
}
}IScript provides an empty default implementation.
The runtime uses Activator.CreateInstance(type).
A neutral starter example for registering the most common handlers.
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[Tick] does not exist in this version. Use API.Yield(), API.Delay(), or a fixed interval.
await API.Yield()Continue on the next runtime tick.
await API.Delay(ms)Dynamic delay in milliseconds.
API.SetInterval(...)A synchronously repeated action with a fixed interval.
private async Task RunLoop()
{
while (true)
{
// Repeated resource logic
await API.Delay(1000);
}
}Generated C# wrappers are available through the static Native class.
var playerPed = Native.PlayerPedId();
var position = Native.GetEntityCoords(playerPed, true);
API.Log.Info($"Player: {position}");Select the Natives filter in the API reference and enter its C# name.
View the signature, parameters, hash, and available overloads.
A dedicated Client, Server, Shared, and Base API explorer with a package tree, search, and progressively loaded results.
Open API reference →The text and examples are derived from the public API and decompiled implementation.
The reference matches the 0.0.3-alpha packages for net10.0.
The explorer documents exact declarations; the package does not describe the meaning of individual GTA natives.