Garry's Mod

Garry's Mod

Vehicle Radio
 This topic has been pinned, so it's probably important
Fraddy15  [developer] 25 Jun, 2018 @ 3:59pm
How to make your own stations
How to make your own stations:

Create lua file in lua\vradio\stations\

Template:
local STATIONS = { [0] = { -- station index ['meta'] = { --station info ['name'] = "Your FM", --display name ['icon'] = "gui/vehicles_radio_icons/youricon.png" -- icon }, ['tracks'] = { --playlist [0] = "vehicles_radio/yourtrack_1.mp3", --track path or URL [1] = "vehicles_radio/yourtrack_2.mp3" } } } VRADIO:IncludeStation(STATIONS) --include station function

Sounds files should be in sound directory, example: your addon or your garry`s mod path\sound
Icon files should be in materials directory, example: your addon or your garry`s mod path\materials

*Recommended MP3 audio format, WAV can cause problems
*Spotify or YouTube URL, currently not supported, you need URL to file, example: "https://www.site.com/file.mp3"


Debug Mode:

Set vehicles_radio_debug to 1, - when the station is turned on, file path or URL will be displayed on screen and also be displayed in console


Syntax:

Creation main array block
local STATIONS = { --brackets open } --brackets close

Creation new block inside, [0] - is number index block, always start from zero.
local STATIONS = { [0] = { --brackets open } --brackets close }

if you want to create multiple blocks inside.
local STATIONS = { [0] = { }, --comma [1] = { } --last block does not have a comma }

Now on an example with a template structure which contains multiple stations, for example three.
local STATIONS = { [0] = { ['meta'] = { --is name block. Please, do not change block names, only index blocks ['name'] = "Your FM", --comma ['icon'] = "gui/vehicles_radio_icons/youricon.png" --does not have a comma }, --comma ['tracks'] = { [0] = "vehicles_radio/yourtrack_1.mp3", --comma [1] = "vehicles_radio/yourtrack_2.mp3", --comma [2] = "vehicles_radio/yourtrack_3.mp3" --does not have a comma } --does not have a comma }, --comma [1] = { ['meta'] = { ['name'] = "Your FM2", ['icon'] = "gui/vehicles_radio_icons/youricon.png" }, ['tracks'] = { [0] = "vehicles_radio/yourtrack_1.mp3", [1] = "vehicles_radio/yourtrack_2.mp3" } }, --comma [2] = { ['meta'] = { ['name'] = "Your FM3", ['icon'] = "gui/vehicles_radio_icons/youricon.png" }, ['tracks'] = { [0] = "vehicles_radio/yourtrack_1.mp3", [1] = "vehicles_radio/yourtrack_2.mp3" } } --does not have a comma }

Do not forget to add function to add a station in end!
local STATIONS = { [0] = { ['meta'] = { ['name'] = "Your FM", ['icon'] = "gui/vehicles_radio_icons/youricon.png" }, ['tracks'] = { [0] = "vehicles_radio/yourtrack_1.mp3", [1] = "vehicles_radio/yourtrack_2.mp3", [2] = "vehicles_radio/yourtrack_3.mp3" } }, [1] = { ['meta'] = { ['name'] = "Your FM2", ['icon'] = "gui/vehicles_radio_icons/youricon.png" }, ['tracks'] = { [0] = "vehicles_radio/yourtrack_1.mp3", [1] = "vehicles_radio/yourtrack_2.mp3" } }, [2] = { ['meta'] = { ['name'] = "Your FM3", ['icon'] = "gui/vehicles_radio_icons/youricon.png" }, ['tracks'] = { [0] = "vehicles_radio/yourtrack_1.mp3", [1] = "vehicles_radio/yourtrack_2.mp3" } } } VRADIO:IncludeStation(STATIONS) --include station function
Last edited by Fraddy15; 2 Jul, 2018 @ 1:53am
< >
Showing 1-15 of 459 comments
Fraddy15  [developer] 26 Jun, 2018 @ 2:55am 
Added support URL, now you can use the URL instead of path to file
Last edited by Fraddy15; 26 Jun, 2018 @ 2:55am
kmaclives 26 Jun, 2018 @ 8:29am 
what do we name the file? also, is the file supposed to be created within the stations folder?
Last edited by kmaclives; 26 Jun, 2018 @ 8:32am
PackWizzard 26 Jun, 2018 @ 11:13am 
iojiuuuhuhuhuhuhuihuhuhuhhhhhhhhhhhhhh

Bently 26 Jun, 2018 @ 11:52am 
Oohhh..... i see it now... thanks.
JohnMack05 26 Jun, 2018 @ 12:33pm 
I can't find the vradio folder. I'm looking in C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\garrysmod\lua.
Bently 26 Jun, 2018 @ 12:38pm 
Also, 1 more suggestion, probably you should add the option for the custom radio station to include or not include the slightly random pitch for each song. If i want to make one, i kinda dont want the random pitch.
Fraddy15  [developer] 26 Jun, 2018 @ 2:18pm 
@JohnMack05 You should create one. Addon will automatically find files inside this folder and include them.
Fraddy15  [developer] 26 Jun, 2018 @ 2:26pm 
@Kmaclives Lua file must be located at garrysmod/garrysmod/lua/vradio/stations folder. It could have any name you want without spaces and must be in lua file format(.lua). For example : garrysmod/garrysmod/lua/vradio/stations/yourstation.lua. Your sounds could be located anywhere in garrysmod/garrysmod/sound folder. Example: your song path is garrysmod/garrysmod/sound/mycoolstation/song1.mp3 but in lua file it would be “mycoolstation/song1.mp3”
Valkyries733 26 Jun, 2018 @ 6:11pm 
Curious: If we made custom radio stations. Could we upload them to the workshop? Only the lua file and what not? So like maybe someone could download a radio station that includes a bunch of halo music or something? I think it'd be cool. (Of course not reuploading your addon, just the radio station files)
Fraddy15  [developer] 26 Jun, 2018 @ 6:22pm 
@Valkyries733,Yes of course
Valkyries733 26 Jun, 2018 @ 6:50pm 
Sounds awesome man.
Manis 26 Jun, 2018 @ 10:15pm 
i copy pasted the template, changed picture, and i made the url a spotify link. But it won't work, could you help me with this? I will add my version of the template if you need to see what's wrong with it. I did save it with .lua too,
Fraddy15  [developer] 26 Jun, 2018 @ 10:31pm 
Originally posted by sTEV:
i copy pasted the template, changed picture, and i made the url a spotify link. But it won't work, could you help me with this? I will add my version of the template if you need to see what's wrong with it. I did save it with .lua too,
Yes, send your version
Manis 27 Jun, 2018 @ 12:04am 
ok
Manis 27 Jun, 2018 @ 12:05am 
it looks messed up but it the same as the template

< >
Showing 1-15 of 459 comments
Per page: 1530 50