FreeScript
csharp_executor
by slayercio · version 2025.09.10 · updated yesterday
No reviews yet
- Downloads
- 0
- Reviews
- 0
- Size
- 40 KB
- Code check
- Clean
- Licence
- MIT
- Released
- Nov 2026
FiveM c# scripts executor
FiveM C# Executor
A lightweight C# executor for FiveM.
This project allows you to load and execute managed assemblies
It is a working executor, but not yet fully featured – currently limited to executing assemblies stored as raw byte arrays in headers.
**Currently executed script is a simple
Loaded scripts should be created just like you would make FiveM c# scripts, see: FiveM docs
Disclaimer
This project is provided for educational purposes only.
Features
Currently, execution works by embedding your assembly as raw bytes inside a header file:
Alternatively u can use included GUI to execute
Building
The project uses CMake for cross-platform builds.
Generating header from assembly
Since execution requires embedding assemblies into headers, you can use the included
Example:
This will generate a C++ header containing
API reference
Execute a script
Get available runtimes
Provides access to all registered runtimes.
RuntimeInfo reference
Returns a string containing name of the resource owning the runtime
TODO
A lightweight C# executor for FiveM.
This project allows you to load and execute managed assemblies
(.NET / C#) directly inside the FiveM environment.It is a working executor, but not yet fully featured – currently limited to executing assemblies stored as raw byte arrays in headers.
**Currently executed script is a simple
sanchez spawner (clicking F6 spawns and places player into it) (source is in ExecutedResource.cs)**Loaded scripts should be created just like you would make FiveM c# scripts, see: FiveM docs
Disclaimer
This project is provided for educational purposes only.
- I do not condone or take responsibility for using this software in violation of FiveM's Terms of Service, copyright laws, or any other legal restrictions.
- Use at your own risk.
- The author is not responsible for any consequences, bans, or damages caused by misuse.
Features
- Execute managed C# assemblies from raw uint8_t[] blobs.
- Minimal API with clear extension points.
Currently, execution works by embedding your assembly as raw bytes inside a header file:
// Convert your C# assembly to a static uint8_t array
static std::vector scriptData = std::vector(
std::begin(executed),
std::end(executed)
);
// Run the script
executor.Execute("test_script", scriptData);Alternatively u can use included GUI to execute
Building
The project uses CMake for cross-platform builds.
**Create a build directory**
mkdir build
cd build
**Configure**
cmake ..
**or if using single-configuration generator**
cmake -DCMAKE_BUILD_TYPE=Release ..
**Build**
cmake --build .
**or if using something like MSBuild/MSVC**
cmake --build . --config ReleaseGenerating header from assembly
Since execution requires embedding assemblies into headers, you can use the included
generate_header.py script:
./generate_header.pyExample:
./generate_header.py your_assembly.dll include/cse/executed.hThis will generate a C++ header containing
const unsigned char executed[] = {
0x4D, 0x5A, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, ...
};API reference
Execute a script
bool Executor::Execute(
const std::string& scriptName,
const std::vector& scriptData,
std::optional pdbData,
std::optional runtime
);
- scriptName -> doesn't really matter that much, used just internally
- scriptData -> vector containing raw bytes of the assembly
- pdbData (optional) -> you can include raw bytes of debug symbols if you want
- runtime (optional) -> if you want to execute in a specific runtime otherwise executes in the first available
true on success false on failureGet available runtimes
const std::vector& Executor::GetRuntimes();Provides access to all registered runtimes.
RuntimeInfo reference
std::string RuntimeInfo::GetResourceName() const;Returns a string containing name of the resource owning the runtime
TODO
- Implement creating new runtime
- Implement creating runtimes for resources that don't have it