Client
GetGaragesData
Key | Type | Description |
---|---|---|
count? | boolean | Only return count |
- Code
exports.mGarage:GetGaragesData(count)
OpenGarage
Function to open a garage with specified parameters.
The data
table should contain the following keys:
Key | Type | Description |
---|---|---|
name | string | The name of the garage |
garagetype | string | The type of the garage (e.g., 'garage') |
intocar | boolean | Whether to automatically enter the car upon spawn |
carType | table | A list of car types allowed in the garage (e.g., 'automobile', 'bike') |
spawnpos | table | A list of spawn positions in vec4 format (coordinates with heading) |
- Code
- Example
- ESX PROPERTY
exports.mGarage:OpenGarage(data)
RegisterCommand('mGarage:opengarage', function(source, args, raw)
local ped = PlayerPedId()
local coords, heading = GetEntityCoords(ped), GetEntityHeading(ped)
exports.mGarage:OpenGarage({
name = 'Pillbox Hill',
garagetype = 'garage',
intocar = true,
carType = { 'automobile', 'bike' },
spawnpos = {
vec4(coords.x, coords.y, coords.z, heading),
}
})
end)
-
esx_property/client/main.lua
-
Search AccessGarage
-
replace with this
function AccessGarage(PropertyId)
exports.mGarage:OpenGarage({
name = Properties[PropertyId].Name,
garagetype = 'garage',
intocar = true,
carType = { 'automobile', 'bike' },
spawnpos = { vector4(Properties[PropertyId].garage.pos.x, Properties[PropertyId].garage.pos.y, Properties[PropertyId].garage.pos.z, Properties[PropertyId].garage.Heading) }
})
end
SaveCar
Store Vehicle by entity
The data
table should contain the following keys:
Key | Type | Description |
---|---|---|
name | string | The name of the garage |
garagetype | string | The type of the garage (e.g., 'garage') |
entity | boolean | Whether to automatically enter the car upon spawn |
carType | table | A list of car types allowed in the garage (e.g., 'automobile', 'bike') |
- Code
- Example
- ESX PROPERTY
exports.mGarage:SaveCar(data)
RegisterCommand('mGarage:savecar', function(source, args, raw)
local ped = PlayerPedId()
local vehicleEntity = GetVehiclePedIsIn(ped, false)
if DoesEntityExist(vehicleEntity) then
exports.mGarage:SaveCar({
name = 'Pillbox Hill',
garagetype = 'garage',
entity = vehicleEntity,
carType = { 'automobile', 'bike' },
})
else
print('No Vehicle')
end
end)
-
esx_property/client/main.lua
-
Search StoreVehicle
-
replace with this
function StoreVehicle(PropertyId)
exports.mGarage:SaveCar({
name = Properties[PropertyId].Name,
garagetype = 'garage',
entity = false,
carType = { 'automobile', 'bike' },
})
end
Impound
Function to impound a vehicle
The data
table should contain the following keys:
Key | Type | Description |
---|---|---|
entity | ||
impoundName |
- Code
- Example
exports.mGarage:ImpoundVehicle(data)
RegisterCommand('mGarage:impound', function(source, args, raw)
local ped = PlayerPedId()
local vehicleEntity = GetVehiclePedIsIn(ped, false)
if DoesEntityExist(vehicleEntity) then
exports.mGarage:ImpoundVehicle({
vehicle = vehicleEntity,
impoundName = 'Impound'
})
else
print('No Vehicle')
end
end)
CopyCoords
Function to copy single/multiple coords.
Parameter | Type | Description |
---|---|---|
action | string | The action type, either 'single' or 'multi'. |
entityType | string | The entity type, either 'ped', 'car', 'prop', or 'none'. |
callBack | function | Callback function to execute with the copied coordinates. |
data | table | {textui:boolean , switch:boolean , carModel:string, propModel:string} |
- Code
- Example
exports.mGarage:CopyCoords(action, entityType, callBack, options)
RegisterCommand("copyCoords", function(_, args)
local input = lib.inputDialog('mCoords', {
{
type = 'select',
required = true,
label = 'Type',
default = 'single',
options = {
{ label = 'Single coords', value = 'single' },
{ label = 'Multiple coords', value = 'multi' }
}
},
{
type = 'select',
required = true,
label = 'Name',
default = 'none',
options = {
{ label = 'None', value = 'none' },
{ label = 'Ped', value = 'ped' },
{ label = 'Vehicle', value = 'car' },
{ label = 'Prop', value = 'prop' },
}
},
{
type = 'checkbox',
label = 'Text UI',
checked = true
},
{
type = 'checkbox',
label = 'Switch',
checked = true
},
{
type = 'input',
label = 'Car Model',
default = 'toros'
},
{
type = 'input',
label = 'Prop Model',
default = 'prop_parkingpay'
}
})
if not input then return end
CopyCoords(input[1], input[2], function(table, tableString)
if table or tableString then
print(table, tableString)
end
end, { textui = input[3], switch = input[4], carModel = input[5], propModel = input[6] })
end)
CreateZone
Function to create a zone using ox_lib.
Parameter | Type | Description |
---|---|---|
polyzoneName | string | The name of the polyzone. |
textui | boolean | Whether to show text UI. |
Callback | function | Callback function to execute with the created zone. |
- Code
- Example
exports.mGarage:CreateZone(polyzoneName, texui, callBack)
RegisterCommand('czone', function(source, args, raw)
CreateZone('test', true, function(zone)
print(json.encode(zone, { indent = true }))
end)
nd)