Browse docs
Exports
Call client exports from a client script and server exports from a server script. Keep the resource folder named sky_pets. These are the exports registered by the core resource; its Sky.Cb requests and NUI callbacks are internal protocols.
Client exports
OpenShop(shopId)
Opens the configured pet shop directly, without the NPC's pets/supplies choice screen. shopId is a string key in Config.Shops, such as "pet_shop". The function starts the client flow and has no success return value. The server still checks proximity and the catalogue request.
The default shop point is at the cashier inside the bundled MLO: vector3(-169.0462, 226.0295, 92.27). This export does not move the player there.
exports["sky_pets"]:OpenShop("pet_shop")
OpenSuppliesShop(shopId)
Opens a configured supplies shop directly. shopId must be a string key in Config.SuppliesShops, such as "pet_supplies"; passing the pet-shop ID does not choose its linked supplies shop for you. It shares the shop-opening function and has no success return value.
By default, the supplies shop uses the same cashier point inside the MLO. Saved /petsconfig locations can change it independently.
exports["sky_pets"]:OpenSuppliesShop("pet_supplies")
OpenAnimalMenu()
Opens the local animal-form editor. Returns { ok = true } on success or { ok = false, error = "..." } for a local/server rejection. The player needs access, a valid state and no nearby player within the configured safety radius.
local result = exports["sky_pets"]:OpenAnimalMenu()
if not result.ok then
print(("Animal menu unavailable: %s"):format(result.error))
end
TogglePetHud() and TogglePetMenu()
These client exports are registered only when Config.Hud.openMethod or Config.Radial.openMethod respectively is set to "export" before resource start. They toggle the local player's HUD and pet radial. Each returns true when the toggle succeeds or false when the current state blocks it (for example, while another pet UI is open). The defaults use F7/F6 key bindings instead, so these exports do not exist in the default configuration.
-- Requires Config.Radial.openMethod = "export" and a resource restart.
local opened = exports["sky_pets"]:TogglePetMenu()
if not opened then
print("Pet menu cannot be toggled right now")
end
Server exports
GiveAnimalAccess(target)
Grants access to the separate player animal-form feature. target is an online player source (number) or a validated persistent owner identifier (string). Returns { ok = true, hasAccess = boolean } or { ok = false, error = string }. An eligible staff command permission may also give the player effective access without an explicit grant.
local result = exports["sky_pets"]:GiveAnimalAccess(player_source)
if not result.ok then
print(("Grant failed: %s"):format(result.error))
end
RemoveAnimalAccess(target)
Revokes a grant using the same target types and result shape. If a player's staff permission still allows the animal menu, hasAccess can remain true; the return reports effective access. Active sessions are closed when effective access is lost.
local result = exports["sky_pets"]:RemoveAnimalAccess(player_source)
if result.ok then
print(("Effective animal access: %s"):format(tostring(result.hasAccess)))
end
HasAnimalAccess(target)
Returns a boolean for effective access. An invalid target returns false. This reads the saved grant and, for an online player, the configured command permission.
if exports["sky_pets"]:HasAnimalAccess(player_source) then
print("Animal form is available to this player")
end
OpenAnimalMenu(source)
Requests that the server open the animal-form editor for an online player source. Returns { ok = true } or { ok = false, error = string }. It validates access and rejects a nearby-player conflict before sending the menu-open message. This is distinct from the client export of the same name.
local result = exports["sky_pets"]:OpenAnimalMenu(player_source)
if not result.ok then
print(("Animal menu denied: %s"):format(result.error))
end
No core export grants pet ownership, adds combat XP or changes a pet's health. Those changes stay inside the validated shop and gameplay flows.