# Functions Core

### Round All values Func

{% code title="RoundValues" overflow="wrap" %}

```lua
-- client and serverside
tonumber(roundValue(CashSet, 2)) -- ex: 0.28$
tonumber(roundValue(GoldSet, 2)) -- ex: 1.22g
tonumber(roundValue(XpSet, 1))   -- ex: 100 XP
tonumber(roundValue(ItemQuantity, 1)) -- 1

-- The function prevent (1.5898789875725$) or -1 or wrong values showed and respect the decimal 0.00$ or decimal for gold 0.00g or int for xp 0xp
```

{% endcode %}

### Random Int Value Func

{% code title="Random Value with Integer" overflow="wrap" %}

```lua

-- ClientSide
MyRandomInt = RandomInt(max)
-- return number 0 > your number

-- ServerSide
local MyRandomInt = exports.infinity_core:RandomInt(maxvalue)
-- return number 0 > your number

```

{% endcode %}

### Get Player Current Town Position

{% code title="Get Player Towns location" overflow="wrap" %}

```lua
-- ClientSide Only
local MyCurrentTown = GetTownPlayer()
or    MyCurrentTown = exports.infinity_core:GetTownPlayer()Pos
-- return ex: Valentine
```

{% endcode %}


---

# 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://altitude-dev.gitbook.io/doc/global-functions/functions-core.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.
