# 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: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

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

The question should be specific, self-contained, and written in natural language.
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.
