# FAQ

## Can I open the menu with something other than the chat command?

Yes! You can utilize the following **client** event to open the menu however you wish (ex: radialmenu, use item, etc): `"wp-animals:client:openMenu"`

```lua
-- Example: Calling from the client
TriggerEvent("wp-animals:client:openMenu")

-- Example: Calling from the server, where source is the target client
TriggerClientEvent("wp-animals:client:openMenu", source)
```

## How can I edit the script to use an item for the cost instead of using money?

This can easily be done with some modifications to the `PayForItemAndReturnStatus`function (located in the framework.lua file). This is useful if you want to use items such as "paid for" coupons to exchange for pets.&#x20;

Here are the high level changes you can make:

* Update the `price`fields in Config.Animals, changing it to the name of the item that you want to use. Example: price = "petcoupon"
* Update PayForItemAndReturnStatus function
  * First check if the player has the item in their inventory
  * If they do have the item, remove it from their inventory and return true
  * If they do not have the item, notify them that it requires this specific item and return false

Here is an example of what this could look like:

<pre class="language-lua"><code class="lang-lua"><strong>---@param source - The source of the player purchasing the animal
</strong><strong>---@param price - This will represent whatever you put in your config for the price
</strong><strong>function PayForItemAndReturnStatus(source, price)
</strong>    if not IsDuplicityVersion() then return end

    local isPaymentSuccessful = false

    if HasItem(source, price) then
        RemoveItem(source, price, 1)
        isPaymentSuccessful = true
    else
        isPaymentSuccessful = false
        Notify("You need a " .. price .. " to purchase an animal")  
    end

    return isPaymentSuccessful
end 
</code></pre>

{% hint style="info" %}
NOTE: You will need to replace `HasItem` with the correct functions that your inventory script uses.&#x20;

If you try to just copy paste this, it will **NOT** work because that is a pseudo code function provided for the purpose of this example.
{% endhint %}

## How do I update the Animal shop location?

Update the coords on `Config.AnimalStore` in the Config.

```lua
Config.AnimalStore = {
    coords = vector3(562.4, 2740.13, 42.66),
    width = 3.0,
    length = 5.0,
    height = 5.0,
    minZ = 40.0,
    maxZ = 45.0,
}
```

{% hint style="info" %}
NOTE: Don't forget to adjust the minZ and maxZ to be below/above the Z coordinate!
{% endhint %}


---

# 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://waypoint-scripts.gitbook.io/waypoint-scripts/scripts/waypoint-animals/faq.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.
