Waypoint Scripts
  • Waypoint Scripts
  • Store
  • Support Discord
  • Scripts
    • 🚑Waypoint AI EMS
      • 📝Setup
      • 🖥️Code Snippets
      • ❔FAQ
      • 📃Exports / Events
      • 🔢Telemetry
    • 🚕Waypoint AI Taxi
      • 📝Setup
      • 🖥️Code Snippets
      • 📃Exports / Events
      • 🔢Telemetry
    • 🎆Waypoint Fireworks
      • 📝Setup
    • 💡Waypoint Neons
      • 📝Setup
    • 🐕Waypoint Animals
      • 📝Setup
      • ❔FAQ
  • Free Scripts
    • 🚚Waypoint Tow / Hauling
    • 🛠️Waypoint Placeables
    • 🚦Waypoint Traffic Lights
    • 🧘‍♂️Waypoint Yogamats
    • 🖨️Waypoint Printer
    • 🚲Waypoint Pocket Bikes
    • 👻Waypoint Smoke Monster
    • 🪑Waypoint Seats
Powered by GitBook
On this page
  • Can I open the menu with something other than the chat command?
  • How can I edit the script to use an item for the cost instead of using money?
  • How do I update the Animal shop location?
  1. Scripts
  2. Waypoint Animals

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"

-- 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 PayForItemAndReturnStatusfunction (located in the framework.lua file). This is useful if you want to use items such as "paid for" coupons to exchange for pets.

Here are the high level changes you can make:

  • Update the pricefields 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:

---@param source - The source of the player purchasing the animal
---@param price - This will represent whatever you put in your config for the price
function PayForItemAndReturnStatus(source, price)
    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 

NOTE: You will need to replace HasItem with the correct functions that your inventory script uses.

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.

How do I update the Animal shop location?

Update the coords on Config.AnimalStore in the Config.

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,
}

NOTE: Don't forget to adjust the minZ and maxZ to be below/above the Z coordinate!

PreviousSetupNextWaypoint Tow / Hauling

Last updated 4 months ago

🐕
❔