❔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 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.
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:
---@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
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,
}
Last updated