Module core.plugins.radio.cl_init

Car Radio System.

Module Overview

Functions

PLUGIN:CreateStation() Function to create the radio station, by playing the URL.
PLUGIN:GetRadios() Function to get all radios which are playing.
PLUGIN:IsActive(car) Function to check if a vehicle radio is active.
PLUGIN:LoadSettings() Function to load the settings from the data file.
PLUGIN:SaveSettings() Function to save the settings.
PLUGIN:SetPlayerVolume(vol) Function to set the media player volume.
PLUGIN:PlayerInVehicle(vehicle) Function to check if the player is in a given vehicle, as driver or passenger.
PLUGIN:Tick() Function called to update the volume of the radio, create it if it doesn't exist and destroy it if no radios are within range.
PLUGIN:SettingsMenu() Function to open up the settings menu.

Tables

PLUGIN Table for plugin data.

Functions

PLUGIN:CreateStation()
Function to create the radio station, by playing the URL.
PLUGIN:GetRadios()
Function to get all radios which are playing.

Returns:

    table Table of active radios.
PLUGIN:IsActive(car)
Function to check if a vehicle radio is active.

Parameters:

  • car The vehicle to check activity for.

Returns:

    boolean If the radio is active or not.
PLUGIN:LoadSettings()
Function to load the settings from the data file.
PLUGIN:SaveSettings()
Function to save the settings.
PLUGIN:SetPlayerVolume(vol)
Function to set the media player volume.

Parameters:

  • vol The new volume to set (between 0 and 1)
PLUGIN:PlayerInVehicle(vehicle)
Function to check if the player is in a given vehicle, as driver or passenger.

Parameters:

  • vehicle The vehicle to check

Returns:

    boolean If the player is inside the vehicle.
PLUGIN:Tick()
Function called to update the volume of the radio, create it if it doesn't exist and destroy it if no radios are within range.
PLUGIN:SettingsMenu()
Function to open up the settings menu.

Tables

PLUGIN
Table for plugin data.

Fields:

  • name The name of the plugin
  • author The plugin author.
  • radioEnabled If the radio is enabled.
  • enabled List of enabled radio sources.
  • settings The settings table.
  • station The radio audio station.
  • vol The current calculated radio volume.
  • distFullVol The distance where the radio would be at full volume.
  • distFadeEndSqr distFadeEndSqr squared.
  • distFullVolSqr distFullVol squared.
  • distFadeEndSqr distFadeEndSqr squared.