> For the complete documentation index, see [llms.txt](https://lua2.fatality.win/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lua2.fatality.win/api/types/gameevent_t.md).

# GameEvent\_t

Describes a game event.

## GetName <a href="#get-name" id="get-name"></a>

[<kbd><mark style="background-color:purple;">**Method**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

Returns the event name.

**Arguments**

None.

**Returns**

| Type     | Description |
| -------- | ----------- |
| `string` | Event name. |

**Example**

```lua
if event:GetName() == 'player_hurt' then
    -- ...
end
```

***

## GetBool <a href="#get-bool" id="get-bool"></a>

[<kbd><mark style="background-color:purple;">**Method**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

Returns the boolean value by key.

**Arguments**

| Name  | Type     | Description |
| ----- | -------- | ----------- |
| `key` | `string` | Entry key.  |

**Returns**

| Type   | Description                                             |
| ------ | ------------------------------------------------------- |
| `bool` | Entry value. Returns `false` if such key was not found. |

**Example**

```lua
event:GetBool('some_key');
```

***

## GetInt <a href="#get-int" id="get-int"></a>

[<kbd><mark style="background-color:purple;">**Method**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

Returns the integer value by key.

**Arguments**

| Name  | Type     | Description |
| ----- | -------- | ----------- |
| `key` | `string` | Entry key.  |

**Returns**

| Type  | Description                                         |
| ----- | --------------------------------------------------- |
| `int` | Entry value. Returns `0` if such key was not found. |

**Example**

```lua
event:GetInt('some_key');
```

***

## GetFloat <a href="#get-float" id="get-float"></a>

[<kbd><mark style="background-color:purple;">**Method**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

Returns the float value by key.

**Arguments**

| Name  | Type     | Description |
| ----- | -------- | ----------- |
| `key` | `string` | Entry key.  |

**Returns**

| Type    | Description                                           |
| ------- | ----------------------------------------------------- |
| `float` | Entry value. Returns `0.0` if such key was not found. |

**Example**

```lua
event:GetFloat('some_key');
```

***

## GetString <a href="#get-string" id="get-string"></a>

[<kbd><mark style="background-color:purple;">**Method**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

Returns the string value by key.

**Arguments**

| Name  | Type     | Description |
| ----- | -------- | ----------- |
| `key` | `string` | Entry key.  |

**Returns**

| Type     | Description                                           |
| -------- | ----------------------------------------------------- |
| `string` | Entry value. Returns `nil` if such key was not found. |

**Example**

```lua
event:GetString('some_key');
```

***

## GetController <a href="#get-controller" id="get-controller"></a>

[<kbd><mark style="background-color:purple;">**Method**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

{% hint style="danger" %}
If you pass a non-existent key into this function, the game might crash.
{% endhint %}

Returns the controller by key.

**Arguments**

| Name  | Type     | Description |
| ----- | -------- | ----------- |
| `key` | `string` | Entry key.  |

**Returns**

| Type                                                                                   | Description |
| -------------------------------------------------------------------------------------- | ----------- |
| [`C_CSPlayerController`](/api/instances/entities/c_baseentity/c_csplayercontroller.md) | Controller. |

**Example**

```lua
event:GetController('userid');
```

***

## GetPawnFromId <a href="#get-pawn-from-id" id="get-pawn-from-id"></a>

[<kbd><mark style="background-color:purple;">**Method**<mark style="background-color:purple;"></kbd>](#user-content-fn-1)[^1]

Returns the pawn by key.

**Arguments**

| Name  | Type     | Description |
| ----- | -------- | ----------- |
| `key` | `string` | Entry key.  |

**Returns**

| Type                                                                       | Description |
| -------------------------------------------------------------------------- | ----------- |
| [`C_CSPlayerPawn`](/api/instances/entities/c_baseentity/c_csplayerpawn.md) | Pawn.       |

**Example**

```lua
event:GetPawnFromId('userid');
```

[^1]: This field is a method and must be invoked using a colon (:)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://lua2.fatality.win/api/types/gameevent_t.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
