For the complete documentation index, see llms.txt. This page is also available as Markdown.

Exports

Client-Side Exports

TakeInPet

Description: Hides the player's current pet if it's within a certain range.

Export Statement:

exports("TakeInPet", TakeInPet)

Usage:

exports.cdev_pets:TakeInPet()

Parameters:

  • None

Returns:

  • None

Functionality:

  • Checks if the player owns a pet.

  • Verifies if the pet is within a 10-unit distance from the player.

  • If conditions are met, it triggers a server callback to hide the pet.

  • Notifies the player about the action's success or failure.


ForceTakeInPet

Description: Forcefully hides the player's current pet, regardless of its position.

Export Statement:

Usage:

Parameters:

  • None

Returns:

  • None

Functionality:

  • Checks if the player owns a pet.

  • Triggers a server callback to hide the pet without checking the distance.

  • Closes any open pet-related menus.


Attack

Description: Commands the player's pet to attack a specified target.

Export Statement:

Usage:

Parameters:

  • targetPed (Entity): The entity the pet should attack.

Returns:

  • None

Functionality:

  • Ensures the player owns a pet.

  • Checks if the pet is not already in an attack state.

  • Initiates the attack sequence on the target entity.


CanEnterVehicle

Description: Checks if the player's pet can enter a specific vehicle.

Export Statement:

Usage:

Parameters:

  • vehicle (Entity): The vehicle entity to check.

Returns:

  • boolean: true if the pet can enter the vehicle, false otherwise.

Functionality:

  • Determines if the player owns a pet.

  • Invokes the pet's method to verify if it can enter the specified vehicle.


CanExitVehicle

Description: Checks if the player's pet can exit a specific vehicle.

Export Statement:

Usage:

Parameters:

  • vehicle (Entity): The vehicle entity to check.

Returns:

  • boolean: true if the pet can exit the vehicle, false otherwise.

Functionality:

  • Determines if the player owns a pet.

  • Checks if the pet is currently in the specified vehicle.

  • Returns the pet's ability to exit based on its current state.


cdev_pets:onTargetPlaceVehicle

Places the player's spawned owned pet into a vehicle seat.

Trigger (client):

Payload fields:

Field
Type
Description

entity

number

Vehicle entity handle.

payload.door

number

Door/seat index: 1, 2, or 3.

payload.doorname

string

Vehicle bone name (see table below).

Supported seat bones:

doorname

door

Seat

seat_pside_f

1

Front passenger

seat_dside_r

2

Rear driver side

seat_pside_r

3

Rear passenger side

What happens internally:

  1. Resolves PetManagerClient.ownedPet (pet must be spawned and out).

  2. Checks the pet is within 10 meters of the player.

  3. Calls server callback cdev_pets:attemptVehicle (e.g. stamina / tired checks).

  4. On success, runs pet:EnterVehicle(entity, door, doorname).

Returns: None (failures are handled silently or via in-game notifications from cdev_pets).


cdev_pets:onTargetTakeVehicle

Removes the player's pet from a vehicle.

Trigger (client):

Requirements:

  • Pet must be spawned (ownedPet exists).

  • Pet state must be VEHICLE.

  • Pet must be attached to the given entity.

What happens internally:

  • Calls pet:Idle(), which plays the exit animation and detaches the pet.

Returns: None.


QBX_radialmenu Example

How Setup qbx_radialmenu

Example client-side code using the pet interaction events and vehicle exports.

Add this to your resource's client script example inside your qbx_radialmenu (not inside cdev_pets):

Usage from anywhere on the client:

Replace print() with your notification system if desired.


spawnPet

Description: Spawns a pet with a specified ID at the player's location or custom coordinates.

Export Statement:

Usage:

Parameters:

  • id (number): The unique identifier of the pet to spawn.

  • customCoords (table, optional): Coordinates to spawn the pet at. If not provided, spawns at the player's current location.

Returns:

  • None

Functionality:

  • Determines the spawn location based on provided coordinates or the player's current position.

  • Requests the server to spawn the pet.

  • Loads the pet's model and customization settings.

  • Adds the pet to the client's pet manager and sets up necessary interactions.

QuickActionFollow

Description: Toggles follow/stay on the player's spawned owned pet from external menus (radial, custom UI). Uses the same logic as the in-game follow quick action but always targets ownedPet and skips the player whistle animation. Recommended for qb-radialmenu, ox_lib radial, and similar integrations.

Export Statement:

Usage:

Parameters: None

Returns: None

Functionality:

  • Resolves the pet as PetManagerClient.ownedPet (or currentPetTarget if no owned pet is out).

  • Validates CanDrawQuickActions() (requires Keybinds.Enabled = true in config, pet within Range, player on foot, etc.).

  • If the pet is not following: triggers server callback cdev_pets:attemptFollow; on success, starts follow without player whistle animation.

  • If the pet is already following: sets the pet to stay (Idle).

  • Handles attack stand-down and bed/dead states the same way as the default follow keybind.

  • Does nothing if no valid pet, cooldown is active, or conditions are not met (no error thrown).

Config requirements:

  • PublicSharedPetsConfig.Keybinds.Enabled must be true (even when using only a radial menu).

  • Pet must be spawned and within PublicSharedPetsConfig.Range (default 5.0).

Related events (alternative to this export):

  • TriggerEvent('cdev_pets:quickAction:follow') — same handler; may play player whistle animation when not called via this export.


Server-Side Exports

addpet

Description: Adds a new pet for a specified player with given attributes.

Export Statement:

Usage:

Parameters:

  • data (table): Contains the following keys:

    • PlayerId (number): The player's server ID.

    • petShopId (string): Pet Identification for the Pet Shop You can find each pet's PetShopId in the shop.lua file, located at: cdev_pets/public/config/shop.lua.

    • isK9 (boolean): Indicates if the pet is a K9 (police dog).

    • petName (string): Name of the pet.

Returns:

  • None

Functionality:

  • Validates the provided data.

  • Inserts the new pet into the database with specified attributes.

  • Assigns skills if the pet is designated as a K9.

  • Provides the pet with a K9 activation item if applicable.


givepetitem

Description: Gives an item to a player's pet's inventory.

Export Statement:

Usage:

Parameters:

  • data (table): Contains the following keys:

    • PlayerId (number): The player's server ID.

    • item (string): The identifier of the item to give.

    • quantity (number): The quantity of the item to give.

Returns:

  • None

Functionality:

  • Validates the provided data.

  • Adds the specified item to the pet's inventory.

  • Notifies the player of the successful addition.


delpet

Description: Deletes a pet associated with a player.

Export Statement:

Usage:

Parameters:

  • data (table): Contains the following keys:

    • PlayerId (number): The player's server ID.

    • petId (number): The unique identifier of the pet to delete.

Returns:

  • None

Functionality:

  • Validates the provided data.

  • Removes the pet from the player's ownership.

  • Deletes the pet from the database.

  • Notifies the player of the successful deletion.


isPetOutBySource

Description: Checks if a player currently has a pet out (active).

Export Statement:

Usage:

Parameters:

  • source (number): The player's server ID.

Returns:

  • boolean: true if the player has a pet out, false otherwise.

Functionality:

  • Retrieves the pet associated with the player.

  • Returns whether the pet is currently active and out.


Last updated