gScripts - Get tons of scripts from the web!
gScripts
CloudScripts 2.0!
Usage:
Load the main script
Type "gscripts" in console
Get the list of scripts
Select a script to install (just click on it)
Then hit install!
After that, go to the "Run Scripts" page
Select a script to run (You can install tons of scripts if you want!)
Then just click "Run"!
How to request a script:
Post on this thread with this format:
Media:






Source code:
Changelog:
v1 - Created
v1.1 - Now saves to files in garrysmod/data/gscripts/*scriptkey*.txt instead of saving to lua memory, aka you don't have to reinstall scripts every time you restart your game
v1.2 - Added norecoil script
v1.3 - Added basic esp script
v1.4 - Added lenny's scripts + uninstaller fix
CloudScripts 2.0!
Usage:
Load the main script
Type "gscripts" in console
Get the list of scripts
Select a script to install (just click on it)
Then hit install!
After that, go to the "Run Scripts" page
Select a script to run (You can install tons of scripts if you want!)
Then just click "Run"!
How to request a script:
Post on this thread with this format:
Code:
-REQUEST A SCRIPT- Name: *scriptname* Code: *pastebin link*






Source code:
Code:
local mClamp = math.Clamp
local cAddText = chat.AddText
local sExplode = string.Explode
local hFetch = http.Fetch
local vCreate = vgui.Create
local dSimpleText = draw.SimpleText
local dSimpleTextOutlined = draw.SimpleTextOutlined
local sSetDrawColor = surface.SetDrawColor
local sDrawRect = surface.DrawRect
local sDrawOutlinedRect = surface.DrawOutlinedRect
local hAdd = hook.Add
local hRemove = hook.Remove
local tCreate = timer.Create
local tDestroy = timer.Destroy
local conAdd = concommand.Add
local sGsub = string.gsub
local fExists = file.Exists
local fIsDir = file.IsDir
local fCreateDir = file.CreateDir
local fRead = file.Read
local fWrite = file.Write
local fDelete = file.Delete
local CompileString = CompileString
local Color = Color
local ScrH = ScrH
local ScrW = ScrW
local tonumber = tonumber
if !fIsDir("gscripts", "DATA") then fCreateDir("gscripts") end
local gScripts = {}
gScripts.Percent = 0
gScripts.PrefixURL = "http://pastebin.com/raw.php?i="
gScripts.PrefixCol = Color(0, 150, 255)
gScripts.MessageCol = Color(255, 255, 255)
gScripts.ErrorCol = Color(255, 0, 0)
gScripts.Scripts = {}
function gScripts.Notify(strMessage)
cAddText(gScripts.PrefixCol, "[gScripts] ", gScripts.MessageCol, strMessage)
end
function gScripts.Error(strMessage)
cAddText(gScripts.PrefixCol, "[gScripts] ", gScripts.ErrorCol, "[ERROR] ", gScripts.MessageCol, strMessage)
end
function gScripts.StartPercent(bGetScript)
local iAdd = bGetScript and 0.25 or 1
hAdd("Think", "gScripts.StartPercent", function()
gScripts.Percent = gScripts.Percent + iAdd
if gScripts.Percent >= 100 then
gScripts.Percent = 0
hRemove("Think", "gScripts.StartPercent")
end
end )
end
function gScripts.GetScript(strName, strKey)
gScripts.StartPercent(true)
hFetch(gScripts.PrefixURL .. strKey, function(strBody, iLen, tblHeaders, strCode)
fWrite("gscripts/" .. strKey .. ".txt", strBody)
end, function(strError)
gScripts.Error("Failed to get script " .. strName .. " (" .. strError .. ")")
end)
end
function gScripts.GetList()
gScripts.StartPercent(false)
for strScriptName,strScriptKey in next, gScripts.Scripts do
gScripts.Scripts[strScriptName] = nil
end
hFetch(gScripts.PrefixURL .. "WTg0uhjL", function(strBody, iLen, tblHeaders, strCode)
local tblScripts = sExplode(",", strBody)
for iScriptNum,strScriptData in next, tblScripts do
if !strScriptData then continue end
strScriptData = sGsub(strScriptData, "\n", "")
local tblScriptData = sExplode("=", strScriptData)
if !tblScriptData[1] or !tblScriptData[2] then continue end
tblScriptData[1] = sGsub(tblScriptData[1], "\n", "")
tblScriptData[2] = sGsub(tblScriptData[2], "\n", "")
tblScripts[iScriptNum] = nil
tblScripts[tblScriptData[1]] = tblScriptData[2]
end
for strScriptName,strScriptKey in next, tblScripts do
if tonumber(strScriptName) then continue end
gScripts.Scripts[strScriptName] = strScriptKey
end
end, function(strError)
gScripts.Error("Failed to get script list! (" .. strError .. ")")
end)
end
function gScripts.DrawOutlinedText(iX, iY, strFont, strText, colTextCol, colBackground)
dSimpleTextOutlined(strText, strFont, iX, iY, colTextCol, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, colBackground)
end
function gScripts.DrawText(iX, iY, strFont, strText, colTextCol)
dSimpleText(strText, strFont, iX, iY, colTextCol, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end
function gScripts.DrawBackground(iWidth, iHeight, iX, iY, colRectCol, colBackground)
sSetDrawColor(colRectCol)
sDrawRect(iX, iY, iWidth, iHeight)
sSetDrawColor(colBackground)
sDrawOutlinedRect(iX, iY, iWidth, iHeight)
end
function gScripts.DrawBar(iMin, iMax, iCur, iWidth, iHeight, iX, iY, colBarCol, colBackground)
local iMul = iWidth / iMax
local iMCur = iCur * iMul
sSetDrawColor(colBarCol)
sDrawRect(iX, iY, mClamp(iMCur, iMin, iWidth), iHeight)
sSetDrawColor(colBackground)
sDrawOutlinedRect(iX, iY, iWidth, iHeight)
end
function gScripts.Menu()
local frame = vCreate("DFrame")
frame:SetSize(350, 300)
frame:SetPos(ScrW() / 2 - frame:GetWide() / 2, ScrH() / 2 - frame:GetTall() / 2)
frame:SetTitle("gScripts")
frame:ShowCloseButton(true)
frame:SetVisible(true)
frame.Paint = function()
gScripts.DrawBackground(frame:GetWide(), frame:GetTall(), 0, 0, Color(0, 150, 200, 170), Color(255, 255, 255, 255))
end
frame:MakePopup()
local sheet = vCreate("DPropertySheet")
sheet:SetParent(frame)
sheet:SetPos(5, 25)
sheet:SetSize(340, 270)
sheet.Paint = function()
gScripts.DrawBackground(sheet:GetWide(), sheet:GetTall(), 0, 0, Color(0, 0, 0, 0), Color(0, 0, 0, 0))
end
local taba = vCreate("DLabel")
taba:SetParent(sheet)
taba:SetText("")
taba:SizeToContents()
taba.Paint = function()
gScripts.DrawBackground(sheet:GetWide(), sheet:GetTall(), 0, 0, Color(0, 0, 0, 0), Color(255, 255, 255, 255))
end
local tabb = vCreate("DLabel")
tabb:SetParent(sheet)
tabb:SetText("")
tabb:SizeToContents()
tabb.Paint = function()
gScripts.DrawBackground(sheet:GetWide(), sheet:GetTall(), 0, 0, Color(0, 0, 0, 0), Color(255, 255, 255, 255))
end
local function SetDownloadList()
local lista = vCreate("DListView")
lista:SetParent(taba)
lista:SetPos(10, 10)
lista:SetSize(165, 260)
lista:SetMultiSelect(false)
lista:AddColumn("Scripts")
for strScriptName,strScriptKey in next, gScripts.Scripts do
if !fExists("gscripts/" .. strScriptKey .. ".txt", "DATA") then
lista:AddLine(strScriptName)
end
end
lista.OnRowSelected = function(panel, line)
gScripts.DownloadSelect = lista:GetLine(line):GetValue(1)
end
end
SetDownloadList()
local function SetRunList()
local listb = vCreate("DListView")
listb:SetParent(tabb)
listb:SetPos(10, 10)
listb:SetSize(165, 260)
listb:SetMultiSelect(false)
listb:AddColumn("Scripts")
for strScriptName,strScriptKey in next, gScripts.Scripts do
if fExists("gscripts/" .. strScriptKey .. ".txt", "DATA") then
listb:AddLine(strScriptName)
end
end
listb.OnRowSelected = function(panel, line)
gScripts.RunSelect = listb:GetLine(line):GetValue(1)
end
end
SetRunList()
local bar = vCreate("DPanel")
bar:SetParent(taba)
bar:SetPos(212, 115)
bar:SetSize(100, 17)
bar.Paint = function()
gScripts.DrawBar(0, 100, gScripts.Percent, 100, 17, 0, 0, Color(0, 125, 200, 255), Color(255, 255, 255, 255))
end
local button = vCreate("DButton")
button:SetSize(100, 35)
button:SetPos(212.5, 60)
button:SetText("Get Script List")
button:SetParent(taba)
button.DoClick = function()
gScripts.Notify("Downloading the list of scripts...")
gScripts.GetList()
local bCanRemove = false
hAdd("Think", "gScripts.GetList", function()
if !bCanRemove and gScripts.Percent > 1 then
bCanRemove = true
end
if gScripts.Percent == 0 and bCanRemove then
SetDownloadList()
SetRunList()
hRemove("Think", "gScripts.GetList")
end
end )
end
local button2 = vCreate("DButton")
button2:SetSize(100, 35)
button2:SetPos(212.5, 150)
button2:SetText("Install")
button2:SetParent(taba)
button2.DoClick = function()
if gScripts.DownloadSelect and !fExists("gscripts/" .. gScripts.Scripts[gScripts.DownloadSelect] .. ".txt", "DATA") then
gScripts.Notify("Installing script " .. gScripts.DownloadSelect .. "...")
gScripts.GetScript(gScripts.DownloadSelect, gScripts.Scripts[gScripts.DownloadSelect])
local bCanRemove = false
hAdd("Think", "gScripts.GetScript." .. gScripts.DownloadSelect, function()
if !bCanRemove and gScripts.Percent > 1 then
bCanRemove = true
end
if gScripts.Percent == 0 and bCanRemove then
SetDownloadList()
SetRunList()
hRemove("Think", "gScripts.GetScript." .. gScripts.DownloadSelect)
gScripts.DownloadSelect = nil
end
end )
end
end
local button3 = vCreate("DButton")
button3:SetSize(100, 35)
button3:SetPos(212.5, 80)
button3:SetText("Run")
button3:SetParent(tabb)
button3.DoClick = function()
if gScripts.RunSelect and fExists("gscripts/" .. gScripts.Scripts[gScripts.RunSelect] .. ".txt", "DATA") then
gScripts.Notify("Running script " .. gScripts.RunSelect .. "...")
local funcRun = CompileString(fRead("gscripts/" .. gScripts.Scripts[gScripts.RunSelect] .. ".txt", "DATA"), "gScripts-" .. gScripts.RunSelect)
funcRun()
end
end
local button4 = vCreate("DButton")
button4:SetSize(100, 35)
button4:SetPos(212.5, 130)
button4:SetText("Uninstall")
button4:SetParent(tabb)
button4.DoClick = function()
if gScripts.RunSelect and fExists("gscripts/" .. gScripts.Scripts[gScripts.RunSelect] .. ".txt", "DATA") then
gScripts.Notify("Uninstalling script " .. gScripts.RunSelect .. "...")
fDelete("gscripts/" .. gScripts.Scripts[gScripts.RunSelect] .. ".txt")
SetDownloadList()
SetRunList()
gScripts.RunSelect = nil
end
end
sheet:AddSheet("Install Scripts", taba, "gui/silkicons/wrench", false, false, "Install Scripts")
sheet:AddSheet("Run Scripts", tabb, "gui/silkicons/user", false, false, "Run Scripts")
end
conAdd("gscripts", gScripts.Menu)
v1 - Created
v1.1 - Now saves to files in garrysmod/data/gscripts/*scriptkey*.txt instead of saving to lua memory, aka you don't have to reinstall scripts every time you restart your game
v1.2 - Added norecoil script
v1.3 - Added basic esp script
v1.4 - Added lenny's scripts + uninstaller fix

