# SCRIPT::GET_EVENT_DATA

- **Hash:** `0x57EC5FA4D4D6AFCA`
- **Namespace:** SCRIPT
- **Runtime name (Lua/JS):** `GetEventData`
- **Side:** client (game native)
- **Name status:** official
- **Documentation:** described
- **Since game build:** 1207
- **URL:** https://natives.borderlinerp.com/natives/SCRIPT/GET_EVENT_DATA

## Signature

```c
BOOL GET_EVENT_DATA(int eventGroup, int eventIndex, Any* eventData, int eventDataSize);
```

## Parameters

- `eventGroup` (`int`)
- `eventIndex` (`int`)
- `eventData` (`Any*`)
- `eventDataSize` (`int`)

## Returns

`BOOL`

## Description

eventGroup: 0 = SCRIPT_EVENT_QUEUE_AI (CEventGroupScriptAI), 1 = SCRIPT_EVENT_QUEUE_NETWORK (CEventGroupScriptNetwork), 2 = unk, 3 = unk, 4 = SCRIPT_EVENT_QUEUE_SCRIPT_ERRORS (CEventGroupScriptErrors)

Note: eventDataSize is NOT the size in bytes, it is the size determined by the SIZE_OF operator (RAGE Script operator, not C/C++ sizeof). That is, the size in bytes divided by 8 (script variables are always 8-byte aligned!).

https://github.com/femga/rdr3_discoveries/tree/master/AI/EVENTS

## Usage

### Lua

```lua
local retval, eventData = GetEventData(eventGroup, eventIndex, eventDataSize)

-- always available, by hash
local retval, eventData = Citizen.InvokeNative(0x57EC5FA4D4D6AFCA, eventGroup, eventIndex, Citizen.PointerValueInt(), eventDataSize, Citizen.ReturnResultAnyway())
```

### JavaScript

```js
const [retval, eventData] = GetEventData(eventGroup, eventIndex, eventDataSize);

// by hash
const [retval, eventData] = Citizen.invokeNative('0x57EC5FA4D4D6AFCA', eventGroup, eventIndex, Citizen.pointerValueInt(), eventDataSize, Citizen.returnResultAnyway());
```

### C#

```csharp
var eventData = new OutputArgument();
bool retval = Function.Call<bool>((Hash)0x57EC5FA4D4D6AFCA, eventGroup, eventIndex, eventData, eventDataSize);
// eventData.GetResult<int>()
```

- Pointer (out) arguments are not passed in Lua/JS: their values are returned after the result, in order.
- `Any*` arguments are often structs. Build them with a DataView buffer and pass it with `:Buffer()` — see the examples and notes below.

*Sources: alloc8or RDR3 NativeDB.*
