Skip to content

[Proposal] Tool to generate C# Native Wrapper (.cs) from rdr3natives.json #9

Description

@Jay201500

Hello!

First of all, thanks for maintaining this documentation.

I have written a Python script that parses rdr3natives.json and automatically generates a fully typed C# wrapper class (RedMNatives.cs).

The Problem:
Currently, the standard CitizenFX client library for RedM does not expose all available natives. C# developers often encounter missing methods and are forced to manually look up hashes and cast types using generic Function.Call.

The Solution:
This script automates that process and generates a complete wrapper file based on your documentation. It bridges the gap between the available documentation and the incomplete C# API.

Key Features:

  1. Completeness: Provides access to all natives listed in rdr3natives.json, not just the ones currently in CitizenFX.
  2. Strong Typing: Automatically maps types (e.g., BOOL -> bool, Vector3) and handles complex ref / pointer parameters using OutputArgument.
  3. IntelliSense: Injects the documentation and comments from the JSON directly into the IDE for easy development.

Example Output:

/// <summary>
/// Native: _SET_RANDOM_OUTFIT_VARIATION
/// </summary>
/// <remarks>Hash: 0x283978A15512B2FE | Category: PED</remarks>
public static void SetRandomOutfitVariation(int ped, bool p1)
{
    Function.Call((Hash)0x283978A15512B2FE, ped, p1);
}

Proposal:
I would like to contribute this script as a tool (e.g., generate_cs.py) to this repository. It would allow users to generate the latest, complete C# bindings whenever the documentation is updated.

Let me know if you are interested, and I will submit a Pull Request!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions