> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vortex.menu/llms.txt
> Use this file to discover all available pages before exploring further.

# 🤖 Functions

> Here you can find some details about extra functions the menu API provides.

## **Notifications**

```lua theme={null}
-- VortexAPI.AddNotification(text, timeout);
VortexAPI.AddNotification("Hello World!", 2000)
```

## **Utilities**

```lua theme={null}
-- returns the users redENGINE username
local username = VortexAPI.GetUsername()
```

## **WorldToScreen**

<Danger>
  If the position is invalid/off screen`ret` will be false.
</Danger>

```lua theme={null}
-- returns the screen pos of a world pos (vector3)
local ret, x, y = VortexAPI.WorldToScreen(coords)
```

## **Custom User Input**

**This allows the user to enter a custom string.**

```lua theme={null}
-- VortexAPI.OpenKeyboardInput(headerText, maxLength, callbackFunc)
VortexAPI.OpenKeyboardInput("Header", 20, function(enteredString)
	print(enteredString)
end)
```

## **Camera**

\*\*Sends a raycasts from the camera positions and will returns the following values: \*\*`hit`, `endCoords`, `entity` .

```lua theme={null}
local hit, endCoords, entity = VortexAPI.RaycastCamera()

local hit, endCoords, entity = VortexAPI.RaycastGameplayCamera()
```

## **Models**

<Tip>
  If `timeout`isn't set a default of `5000ms` will be used.
</Tip>

```lua theme={null}
-- will request a model and perform a basic validity check
local hasLoaded = VortexAPI.RequestModel(hash, timeout)
```

## **Network Control**

<Info>
  Only works on servers that allow control requests on remotely owned entitys.
</Info>

```lua theme={null}
-- will request control of an entity
local gotControl = VortexAPI.RequestControl(entity, maxTrys)
```

## **Entity Spawning**

<Warning>
  This uses the menus internal entity spawning functions which include bypasses that might be unstable. These functions can be used to bypass anticheats but can also cause problems on a small amount of servers.
</Warning>

<Tip>
  You can also pass the coords as a `vector3` !
</Tip>

```lua theme={null}
-- spawn object
local object = VortexAPI.CreateObject(modelHash, x, y, z)

-- spawn vehicle
local vehicle = VortexAPI.CreateVehicle(modelHash, x, y, z, heading)

-- spawn ped
local ped = VortexAPI.CreatePed(pedType, modelHash, x, y, z, heading)
```

## Triggering Events

<Warning>
  This feature can be unstable! If an invalid `resource` is used the event will not be triggered!
</Warning>

<Tip>
  You can use `resource` and supply a custom resource that should be simulated when executing the trigger to bypass detection on some anticheats!

  This function uses Lua's variadic arguments (`...`), allowing you to pass any number of parameters or just leave them away completely.
</Tip>

```lua theme={null}
-- VortexAPI.TriggerEvent(resource, eventName, ...)
VortexAPI.TriggerEvent("esx_ambulancejob", "esx_ambulancejob:revive")

-- VortexAPI.TriggerServerEvent(resource, eventName, ...)
VortexAPI.TriggerEvent("example", "superSecretEvent", 123, "test", false)
```

## **Keys**

<Check>
  Use the key indexes from the [microsoft api](https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes).
</Check>

```lua theme={null}
-- checks if a key is pressed
VortexAPI.IsKeyPressed(virtualKeyIndex)

-- checks if a key was just pressed
VortexAPI.IsKeyJustPressed(virtualKeyIndex)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.