77 lines
1.8 KiB
Lua
77 lines
1.8 KiB
Lua
|
|
GM.Name = "Your Name Is Benny"
|
|
GM.Author = "Fesiug, Oranche, Alex"
|
|
GM.Email = "N/A"
|
|
GM.Website = "N/A"
|
|
|
|
BENNY = {}
|
|
|
|
function BENNY.SimpleAutoComplete( cmd, args, ... ) -- just stole it from the wiki
|
|
local possibleArgs = { ... }
|
|
local autoCompletes = {}
|
|
|
|
--TODO: Handle "test test" "test test" type arguments
|
|
args = args:upper()
|
|
local arg = string.Split( args:TrimLeft(), " " )
|
|
|
|
local lastItem = nil
|
|
for i, str in pairs( arg ) do
|
|
if ( str == "" && ( lastItem && lastItem == "" ) ) then table.remove( arg, i ) end
|
|
lastItem = str
|
|
end -- Remove empty entries. Can this be done better?
|
|
|
|
local numArgs = #arg
|
|
local lastArg = table.remove( arg, numArgs )
|
|
local prevArgs = table.concat( arg, " " )
|
|
if ( #prevArgs > 0 ) then prevArgs = " " .. prevArgs end
|
|
|
|
local possibilities = possibleArgs[ numArgs ] or { lastArg }
|
|
for _, acStr in pairs( possibilities ) do
|
|
if ( !acStr:StartsWith( lastArg ) ) then continue end
|
|
table.insert( autoCompletes, cmd .. prevArgs .. " " .. acStr )
|
|
end
|
|
|
|
return autoCompletes
|
|
end
|
|
|
|
local AC, IN = AddCSLuaFile, include
|
|
|
|
local CL = SERVER and AddCSLuaFile or include
|
|
|
|
function TSelShared( tbl, seed )
|
|
return tbl[math.Round( util.SharedRandom( seed, 1, #tbl ) )]
|
|
end
|
|
|
|
-- Language might want to be loaded first
|
|
-- Otherwise things will fail to call 'l8'
|
|
AC("language.lua")
|
|
IN("language.lua")
|
|
|
|
AC("convars.lua")
|
|
IN("convars.lua")
|
|
AC("camera.lua")
|
|
IN("camera.lua")
|
|
AC("items.lua")
|
|
IN("items.lua")
|
|
AC("player.lua")
|
|
IN("player.lua")
|
|
AC("player_class.lua")
|
|
IN("player_class.lua")
|
|
AC("inventory.lua")
|
|
IN("inventory.lua")
|
|
AC("gamestate.lua")
|
|
IN("gamestate.lua")
|
|
AC("teams.lua")
|
|
IN("teams.lua")
|
|
AC("pausemenu.lua")
|
|
IN("pausemenu.lua")
|
|
|
|
AC("richpresence_test.lua")
|
|
if CLIENT then
|
|
IN("richpresence_test.lua")
|
|
end
|
|
|
|
AC("debugmenu.lua")
|
|
IN("debugmenu.lua")
|
|
|
|
CL("hud.lua") |