API

Our script has an "API" to check and set thing when some things are done in the garages

```lua
--@param garageType string The type of garage (Garages, Impounds)
--@plate string The plate of the vehicle
function CanTakeOutCar(garageType, plate)
    -- Your code logic here
    return true
end

-- Both of them are triggered by the garage script
RegisterNetEvent("mr-garages:client:VehicleTakenOut", function(plate, netId)
    local vehicle = NetworkGetEntityFromNetworkId(netId)
    -- Your code logic Here
end)

RegisterNetEvent("mr-garages:client:VehicleStored", function(plate, model, garage)
    -- Your code logic Here
end)

```

The "CanTakeOutCar" function is returning if a player can take out a vehicle, this can be used if you want to check for fines, check if the player is dead and etc The "VehicleTakenOut & VehicleStored" can be used to set data when a vehicle is out of the garage, like nitro script, fake plates and etc

Last updated