clipboardExports & Events

All exports and events available to integrate this resource into others.

circle-info

Types / Classes

All types / classes can be found in shared/unlocked/types.lua.

circle-info

Suggestions?

If you wish to have any exports and or events added, please head over to our Discordarrow-up-right and create a suggestion post. We are happy to allow for easier integration within other resources.

Client Sided Exports

Save Vehicle

If you want to save a vehicle to the database that is in the world, run this export. This is the same function that gets ran with you use the /savevehicle command, which can be found here. Example:

---@param vin string
---@return boolean, string? @Success, reason for failure
exports["zyke_garages"]:SaveVehicle(vin)

Is Vehicle A Temporary Vehicle

Returns if the vehicle is a temporary vehicle or not. Example:

---@param vehicle integer @Vehicle handler
---@return boolean, boolean | nil @Is temp, has temp been initialized
exports["zyke_garages"]:IsVehicleATempVehicle(vehicle)

Pay Impound

Pay an impound for a vehicle. Example:

Set New Owner

If you want to set owners for vehicles through other resources, you can easily do so via our exports. Example:

Open Garage Settings

Opens the garage settings menu, which can also be opened with a command found herearrow-up-right. Example:

Set Fake Plate

This export allows you to swap the plate of a vehicle temporarily. Note that unless you set "performRealisticSwap" to true, it will not perform any animations, check if you're close to the vehicle etc. Example:

Open Impounder Menu

This export allows you to open the impounder menu just like the existing command. The export checks your job and performs all necessary actions to work. Example:

Set Lock State

Using this export you can set the current door lock status for vehicles with a vin number. Example:

Set Engine State

Using this export, you can set the current engine state for vehicles with a vin number. Example:

Has Key

Check if the player has access to the plate or vin number provided. Example:

Give Keys (Temporary Vehicles)

Temporary "temp" keys are used to temporarily give someone access to a vehicle. This allows you to manage it in the vehicle menu as your own. This functionality is by default implemented to give keys if you steal an NPC vehicle, or a vehicle spawned by a script that is not owned by anyone. This can easily be implemented into other resources such as vehicle renter scripts to temporarily give you full access to the vehicle. Example:

Remove Keys

Removes all keys from your inventory tied to the plate you provided. Example:

Open Garage

Open a garage via an export.

Example:

Example: Grab the garage id from the section you are currently standing in, to open the garage. The example approach targets both normal garages & impounds.

Is In Garage Section

Check if you are currently standing inside of a garage section. The garage id for the section you are in is returned as the second parameter, or nil. Example:

Is In Impound Section

Check if you are currently standing inside of an impound section. The garage id for the section you are in is returned as the second parameter, or nil. Example:

Is In Any Section

Performs the Is In Garage Section & Is In Impound Section exports automatically to grab an id for easier integration of just one export. Example:

Server Sided Exports

Set New Owner

If you want to set owners for vehicles through other resources, you can easily do so via our exports. Example:

Set Garage

Set a new garage for a vehicle. Example:

Can Transfer Ownership

Check if you can transfer ownership of your vehicle or not. The conditions can be modified in zyke_garages/server/unlocked/functions.lua. Example:

Initialize Vehicle

Initialize a spawned vehicle, ensuring it has all the required values to operate properly. Trigger this whenever another script handles the spawning of your vehicle. Example:

Has Key

Check if the player has access to the plate provided. Example:

Remove Keys

Removes all keys from the provided player's inventory tied to the plate you provided. Example:

Give Keys (Temporary Vehicles)

This export is used to give keys for temporary vehicles. Temporary vehicles are vehicles that are not owned by anyone. Example:

Shared Exports

Get Vin From Vehicle

This export returns the vin from a vehicle. If the vehicle doesn't have a vin it will ensure it and give it one, unless you specify it not to. Example:

Ensure Vehicle Vin

If you want to manually ensure a vehicle's vin number, you can do it with this export. Example:

Get Vehicle Position

Returns the vehicle position if it has been taken out of the garage and exists. Example:

Set Waypoint To Vehicle

Set a basic waypoint to the vehicle provided. Example:

Shared Events

Handle Vehicle Purchase

There's multiple ways to use this event, please refer to Setup for in-depth examples. If you are new to development, we recommend you use Handle Vehicle Purchase With Plate. This is the more performant version, since you have the values directly and don't need to find them, but more difficult to use. Example:

Handle Vehicle Purchase With Plate

This command is similar to Handle Vehicle Purchase. This event performs a scan of nearby vehicles attempting to find the correct vehicle with the plate provided. If you can't run Handle Vehicle Purchase, run this. Example:

Remove As Persistent

With this export you can deregister a vehicle as persistent. Unless this is executed, the vehicle will always respawn when removed. This has to be used whenever you want to remove a vehicle. Note that if you pass in the vehicle handle, you have to execute the export before the vehicle is removed. Example:

Last updated