Guest
Public paste!

HelixN

By: a guest | Mar 20th, 2010 | Syntax: Lua | Size: 3.39 KB | Hits: 72 | Expires: Never
Copy text to clipboard
  1. --[[
  2. --Name: Resource Smart
  3. --Author: Helix Nebula
  4. --Version: 2.0
  5. --]]
  6.  
  7. --DO NOT INCLUDE THE MAIN FOLDER, THAT WILL BE AUTOMATICALLY ADDED etc:
  8. --NOT RIGHT: models/cake.mdl
  9. --RIGHT: cake.mdl
  10. --NOT RIGHT: sound/lol.wav
  11. --RIGHT: lol.wav
  12. --FOR MODELS ONLY WRITE models/cake.mdl NOT THE .phys OR ANYTHING ELSE
  13. --PLEASE REMEMBER TO SET THE SETTINGS BEFORE USE
  14.  
  15. --**Including**--
  16. include("parts.lua") --Metatables
  17.  
  18. --**TABLES**--
  19. ResourceSmart = {}
  20. ResourceSmart.DownloadList = {}
  21. ResourceSmart.Commandlist = {}
  22. ResourceSmart.VersionURL = "http://www.colzdragon.net/resourcesmart_ver.txt"
  23. ResourceSmart.Version = 2
  24. ResourceSmart.Prefix = "rs_"
  25. ResourceSmart.ToggleDownloadList = CreateConVar( ResourceSmart.Prefix .. "commands", 1, FCVAR_NOTIFY )
  26. ResourceSmart.Toggled = CreateConVar( ResourceSmart.Prefix .. "toggle", 1, FCVAR_NOTIFY )
  27. ResourceSmart.PCSToggled = CreateConVar( ResourceSmart.Prefix .. "toggle_pc_sound", 1, FCVAR_NOTIFY )
  28. ResourceSmart.PCMToggled = CreateConVar( ResourceSmart.Prefix .. "toggle_pc_model", 1, FCVAR_NOTIFY )
  29.  
  30. RSAddFile( "FistsModelV", "weapons/v_pvp_ire.mdl" )
  31. RSAddFile( "FistsModelW", "weapons/w_pvp_ire.mdl" )
  32. RSAddDir( "materials/shane/hud/" )
  33. RSAddDir( "sound/colzdragon/" )
  34. RSAddDir( "sound/colzdragon/dice/" )
  35. RSAddDir( "sound/colzdragon/Rage/" )
  36. RSAddDir( "sound/sharpeye/" )
  37. RSAddDir( "materials/depthhud/" )
  38. RSAddDir( "materials/colzdragon/chatbox/" )
  39. RSNMapAddDir( "sound/colzdragon/weather/", "rp_downtown_v2" )
  40.  
  41. if ResourceSmart.Toggled:GetBool() then
  42.         for k, v in pairs( DownloadList ) do
  43.                 local f = RSCreateFile( v )
  44.                 f:AddFile()
  45.                 f:Precache( PreCacheModels, PreCacheSounds )
  46.         end
  47. end
  48.  
  49. local function ShowDownloadList( ply )
  50.         if not ResourceSmart.Toggled:GetBool() then
  51.                 ply:ChatPrint( HUD_PRINTCONSOLE, ">>> ResourceSmart[ Core ] >> is disabled" )
  52.                 return;
  53.         end
  54.                 ply:ChatPrint( HUD_PRINTCONSOLE, string.format( "**%s%s%s are being precached**" ) )
  55.                 (ResourceSmart.PCSToggled) and "Sounds" or "",
  56.                 (ResourceSmart.PCSToggled and ResourceSmart.PCMToggled) and "/" or "",
  57.                 (ResourceSmart.PCMToggled) and "Models" or "" ) )
  58.         for k, v in pairs( DownloadList ) do
  59.                 local f = RSCreateFile( v )
  60.                 if f:IsSound() then
  61.                         ply:ChatPrint( HUD_PRINTCONSOLE, ">>" .. k .. "<< | " .. v .. " | >>Sound<<" )
  62.                 elseif f:IsMaterial() then
  63.                         ply:ChatPrint( HUD_PRINTCONSOLE, ">>" .. k .. "<< | " .. v .. " | >>Material<<" )
  64.                 elseif f:IsModel() then
  65.                         ply:ChatPrint( HUD_PRINTCONSOLE, ">>" .. k .. "<< | " .. v .. " | >>Model<<" )
  66.                 elseif f:IsFont() then
  67.                         ply:ChatPrint( HUD_PRINTCONSOLE, ">>" .. k .. "<< | " .. v .. " | >>Font<<" )
  68.                 elseif f:IsParticle() then
  69.                         ply:ChatPrint( HUD_PRINTCONSOLE, ">>" .. k .. "<< | " .. v .. " | >>Particle<<" )
  70.                 else
  71.                         ply:ChatPrint( HUD_PRINTCONSOLE, ">>" .. k .. "<< | " .. v .. " | >>UNKNOWN<<" )
  72.                 end
  73.         end
  74. end
  75. concommand.Add( ResourceSmart.Prefix .. "downloads", ShowDownloadList )
  76.  
  77. local function DownloadSystemCommandList( ply )
  78.         if ResourceSmart.ToggleDownloadList:GetBool() then
  79.                 ply:PrintMessage( HUD_PRINTCONSOLE, ">>> ResourceSmart[ Core ] >> List of Commands" )
  80.                 for k, v in pairs( CommandList ) do
  81.                         ply:ChatPrint( HUD_PRINTCONSOLE, ">>" .. k .. "<< | " .. ResourceSmart.Prefix .. v )
  82.                 end
  83.                 return;
  84.         else
  85.                 ply:ChatPrint( HUD_PRINTCONSOLE, ">>> ResourceSmart[ Core ] >> Command Listing is Disabled!" )
  86.         end
  87. end
  88. concommand.Add( ResourceSmart.Prefix .. "commands", DownloadSystemCommandList )