ULX

Author Topic: [ULX] RandomMap ~ Randomize your map!  (Read 3718 times)

0 Members and 1 Guest are viewing this topic.

Offline Tomzen

  • Full Member
  • ***
  • Posts: 115
  • Karma: -1
  • A new lua adventurer
    • Thirdage Gaming
[ULX] RandomMap ~ Randomize your map!
« on: May 11, 2015, 10:33:27 PM »
Description:
Type '!randommap' in chat or use menu/console and the map will be changed to a random map in your server map files (and if you have CS or TF2 mounted it will also use them maps)

Extra Information:
Inside the .lua file you can modify the 3rd line (unwanted =) and add maps you want the random map command to skip and not choose.

SOURCE: Only one source included (ph/ttt)
Code: [Select]
function ulx.maprandom( calling_ply )
local maps = file.Find( "maps/*.bsp", "GAME" )
    map = (maps[math.random( #maps )])
    unwanted = {"de_cbble.bsp", "de_aztec.bsp", "gm_flatgrass", "gm_construct"}
   
while map:find(#unwanted) do
        maps = file.Find( "maps/*.bsp", "GAME" )
        map = (maps[math.random( #maps )])
end

while not map:find("^ph") or map:find("^ttt") or map:find("^cs") or map:find("^de") do
        maps = file.Find( "maps/*.bsp", "GAME" )
        map = (maps[math.random( #maps )])
        end

if map:find("^ph") or map:find("^ttt") or map:find("^cs") or map:find("^de") then
    map = map:sub( 1, -5 )
    ulx.fancyLogAdmin( calling_ply, "#A randomized the map to " .. map .. ".bsp" )
    game.ConsoleCommand("changelevel " .. map .. "\n")
        return
    end
end
local maprandom = ulx.command ( "Tom's Admin", "ulx maprandom", ulx.maprandom, "!maprandom" )
maprandom:defaultAccess( ULib.ACCESS_ADMIN )
maprandom:help( "Randomizes Map" )

USAGE: I recommend using console, or menu to run this command (located in Fun).
Menu: Tom's Admin > randommap
Console: ulx randommap
Chat: !randommap

Download:
There are two versions, first one is 'randommap_ph/ttt.zip' which is locked to "ph, ttt, cs and de" maps only.
And then second one 'randommap_all' has no locks and will use any maps, including "koth, arena, cp, mvm" and loads of others (hence why its "locked")

Installation:
Download = Download the version/zip you would like, then extract it and place contents into the /addons folder inside garrysmod/ then restart the map, and its installed.
Source = Copy the SOURCE of the version you would like, then create a new .lua file inside the /sh file of ulx (garrysmod/ulx/lua/ulx/modules/sh), paste and save it, then restart map.
« Last Edit: May 17, 2015, 01:34:48 AM by Tomzen »
Finished:
Impersonate
<==> FakePromote/Demote <==> RandomMap <==> ForceMic <==> Search <==> PlayMenu <==
WIP:
ServerMode <==

Offline FASGamer

  • Newbie
  • *
  • Posts: 9
  • Karma: -1
Re: [ULX] RandomMap ~ Randomize your map!
« Reply #1 on: May 16, 2015, 05:12:07 PM »
Does this happen to have a timer feature? Like I can set it to run the map randomizer every 3 hours.

Offline Tomzen

  • Full Member
  • ***
  • Posts: 115
  • Karma: -1
  • A new lua adventurer
    • Thirdage Gaming
Re: [ULX] RandomMap ~ Randomize your map!
« Reply #2 on: May 16, 2015, 11:50:40 PM »
No, sorry.
Finished:
Impersonate
<==> FakePromote/Demote <==> RandomMap <==> ForceMic <==> Search <==> PlayMenu <==
WIP:
ServerMode <==