Gmod Server map download help

Hello, I have a gmod server and I’m wonder how do i make it so the server make you download a map only if it switched to it and you don’t have the map.

Are you using WorkshopDL? If so,

local maps = {
   [ "gm_whatever" ] = "123456",
   [ "ttt_whatever" ] = "123456",

local map = maps[ game.GetMap() ]

if ( map ) then
   resource.AddWorkshop( map )

Run that serverside

[editline]23rd August 2015[/editline]

Also, to make it only download if the client doesn’t have the map, so a clientside file.Exists check and network it serverside. I can provide some code when I get home if needed.

now where would i put hie code you posted, and can i have that code so they only download it if they need the map to play.