SHARE
TWEET

Untitled

a guest Nov 5th, 2018 126 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. hook.Add( "Initialize", "CS_CONFIG_Initialize_Hook", function()
  2. // MAIN CONFIG
  3.  
  4.     -- Main
  5.     CreditShop_Config.UseDarkRP = true -- Whether or not you are using DarkRP.
  6.     CreditShop_Config.UseWorkshop = true -- True uses WorkShop (ID: 1378473140), false uses FastDL (Remember to sync it).
  7.  
  8.     -- Themes
  9.     CreditShop_Config.Theme = "Blur" -- Options: "Blur", "Flat" can be used with the skin.
  10.  
  11.     -- Menu Configs
  12.     CreditShop_Config.ShopName = "CREDIT STORE" -- The name of the shop, e.g. "CREDIT STORE"
  13.     CreditShop_Config.ShopName3DEffect = true -- Whether or not the shop title should have a 3D effect
  14.     CreditShop_Config.ShopUseCommand = true -- Whether or not the shop can be opened through a command (command can be changed below)
  15.     CreditShop_Config.ShopCommand = "/creditstore" -- The command used to open the shop
  16.     CreditShop_Config.ShopOpenWith = "F3" -- Can the shop be opened by a key Options: ( "NONE" = can't be opened using a key, "F1", "F2", "F3", "F4" )
  17.    
  18.     CreditShop_Config.ExchangeName = "CREDIT EXCHANGE" -- The name of the exchange, e.g. "CREDIT EXCHANGE"
  19.     CreditShop_Config.ExchangeName3DEffect = true -- Whether or not the exchange title should have a 3D effect
  20.  
  21.     -- SQL
  22.     CreditShop_Config.UseSQL = false -- Whether or not an SQL should be used (recommended true if you have a database)
  23.     CreditShop_Config.CSDATABASE_HOST = "HOST" -- The host of the SQL database ( an IP ).
  24.     CreditShop_Config.CSDATABASE_USERNAME = "USERNAME" -- The username for the SQL database.
  25.     CreditShop_Config.CSDATABASE_PASSWORD = "PASSWORD" -- The password for the SQL database.
  26.     CreditShop_Config.CSDATABASE_DATABASENAME = "DATABASENAME" -- The databasename of the SQL database.
  27.     CreditShop_Config.CSDATABASE_DATABASEPORT = 3306 -- The DatabasePort, normally 3306.
  28.  
  29.     --Paydays and Credit System
  30.     CreditShop_Config.STARTCREDITS = 5 -- This is the amount of credits that players start with.
  31.     CreditShop_Config.ENABLE_SIMPLE_HUD = true -- Whether or not the simple HUD should be enabled - only draws credits
  32.     CreditShop_Config.PAYDAYS = true -- Whether or not paydays should occur
  33.     CreditShop_Config.PAYDAY_AMOUNT = 1000 -- How much credits a person should be given every PAYDAY_INTERVALS.
  34.     CreditShop_Config.PAYDAY_INTERVALS = 120 -- In seconds, how often should the player receive the PAYDAY_AMOUNT.
  35.  
  36.     CreditShop_Config.CdDrpRate = 100 -- The amount of darkrp currency you get from 1 credit, and therefore how many dollars it takes to get 1 credit.
  37.    
  38.     CreditShop_Config.SaveStatsTime = 10 -- How often a player's credit stats should be saved.
  39.  
  40.     --PAGES--
  41.  
  42.     CreditShop_ExtraPages[1] = {
  43.         Name = "Donate",
  44.         Website = "https://www.gmodstore.com/scripts/view/4663",
  45.         Icon = "icon16/coins.png"
  46.     }
  47.  
  48.     CreditShop_ExtraPages[2] = {
  49.         Name = "Wiki",
  50.         Website = "http://wiki.garrysmod.com/page/Main_Page",
  51.         Icon = "icon16/computer.png"
  52.     }
  53.  
  54.     CreditShop_ExtraPages[3] = {
  55.         Name = "Colors",
  56.         Website = "https://www.w3schools.com/colors/colors_rgb.asp",
  57.         Icon = "icon16/color_wheel.png"
  58.     }
  59.    
  60.    
  61. // ADD ITEM CONFIG
  62.     local ItemSort = "High_Low" -- Options: "High_Low", "Low_High", "Random"
  63.     --[[--
  64.     CreditShop_Items["health"] = { -- Unique name
  65.         Name = "200 Health", -- Name shown in shop
  66.         Description = "Gives you 200 HP. (Maximum 200 HP allowed)", -- The description shown in the shop
  67.         InDepthDescription = "Sets your player model until your next death/job change!", -- A description shown in the about menu
  68.         Model = "models/props_junk/GlassBottle01a.mdl", -- The model of the product
  69.         Price = 1, -- the price of the product
  70.         PM = false, -- whether the product is a player model or not, do not set this to true aswell as icon
  71.         Icon = true, -- whether you want to use an icon or not
  72.         IconImg = "materials/dark_matter/health.png", -- if Icon = true, then what image shoud it use
  73.         OnPurFunction = -- the function to be called when a player buys it!
  74.             function(ply,item)
  75.                 local HealthToGive = 200
  76.                 local MaxHealth = 200
  77.                
  78.                 if ply:Health() + HealthToGive < MaxHealth then
  79.                     ply:SetHealth(ply:Health() + HealthToGive)
  80.                 else
  81.                     ply:SetHealth(MaxHealth)
  82.                 end  
  83.             end,
  84.     }
  85.     --]]--
  86.  
  87.     -- Playermodel example
  88.     CreditShop_Items["skeleton"] = {
  89.         Name = "Skeleton PM",
  90.         Description = "Sets your player model until your next death/job change!",
  91.         InDepthDescription = "Sets your player model until your next death/job change!",
  92.         Model = "models/player/skeleton.mdl",
  93.         Price = 2,
  94.         PM = true,
  95.         Icon = false,
  96.         OnPurFunction =
  97.             function(ply,item)
  98.                 ply:SetModel("models/player/skeleton.mdl")
  99.             end,
  100.     }
  101.  
  102.     -- Icon (HP) example
  103.     CreditShop_Items["health"] = {
  104.         Name = "200 Health",
  105.         Description = "Gives you 200 HP. (Maximum 200 HP allowed)",
  106.         InDepthDescription = "Gives you 200 HP. (Maximum 200 HP allowed)",
  107.         Model = "models/props_junk/GlassBottle01a.mdl",
  108.         Price = 1,
  109.         PM = false,
  110.         Icon = true,
  111.         IconImg = "materials/credit_shop/health.png",
  112.         OnPurFunction =
  113.             function(ply,item)
  114.                 local HealthToGive = 200
  115.                 local MaxHealth = 200
  116.                
  117.                 if ply:Health() + HealthToGive < MaxHealth then
  118.                     ply:SetHealth(ply:Health() + HealthToGive)
  119.                 else
  120.                     ply:SetHealth(MaxHealth)
  121.                 end  
  122.             end,
  123.     }
  124.  
  125.     -- Icon (AP) example
  126.     CreditShop_Items["armor"] = {
  127.         Name = "200 Armor",
  128.         Description = "Gives you 200 armor. (Maximum 200 armor allowed)",
  129.         InDepthDescription = "Gives you 200 armor. (Maximum 200 armor allowed)",
  130.         Model = "models/props_junk/garbage_plasticbottle003a.mdl",
  131.         Price = 2,
  132.         PM = false,
  133.         Icon = true,
  134.         IconImg = "materials/credit_shop/armor.png",
  135.         OnPurFunction =
  136.             function(ply,item)
  137.                 local ArmorToGive = 200
  138.                 local MaxArmor = 200
  139.                
  140.                 if ply:Health() + ArmorToGive < MaxArmor then
  141.                     ply:SetArmor(ply:Health() + ArmorToGive)
  142.                 else
  143.                     ply:SetArmor(MaxArmor)
  144.                 end  
  145.             end,
  146.     }
  147.  
  148.     -- Icon (Weapon) example
  149.     CreditShop_Items["minigun"] = {
  150.         Name = "Minigun",
  151.         Description = "Gives you a minigun!",
  152.         InDepthDescription = "Gives you a minigun!",
  153.         Model = "models/weapons/w_m134_minigun.mdl",
  154.         Price = 10,
  155.         PM = false,
  156.         Icon = false,
  157.         OnPurFunction =
  158.             function(ply,item)
  159.                 ply:Give( "m9k_minigun" )
  160.             end,
  161.     }
  162.    
  163.     -- Permanent weapon example2
  164.     CreditShop_Items["perm_shotgun"] = {
  165.         Name = "Perm Shotgun",
  166.         Description = "Gives you a Permanent Shotgun!",
  167.         InDepthDescription = "Gives you a Permanent Shotgun!",
  168.         Model = "models/weapons/w_shotgun.mdl",
  169.         PermClass = "weapon_shotgun",
  170.         PermWep = true,
  171.         Price = 50,
  172.         PM = false,
  173.         Icon = false,
  174.         OnPurFunction =
  175.             function(ply,item)
  176.                 ply:Give( "weapon_shotgun" )
  177.                 ply:CS_AddPermWep( "weapon_shotgun" )
  178.             end,
  179.     }
  180.    
  181.     CreditShop_Items["perm_smg"] = {
  182.         Name = "Perm SMG",
  183.         Description = "Gives you a SMG Shotgun!",
  184.         InDepthDescription = "Gives you a SMG Shotgun!",
  185.         Model = "models/weapons/w_smg1.mdl",
  186.         PermClass = "weapon_smg1",
  187.         PermWep = true,
  188.         Price = 35,
  189.         PM = false,
  190.         Icon = false,
  191.         OnPurFunction =
  192.             function(ply,item)
  193.                 ply:Give( "weapon_smg1" )
  194.                 ply:CS_AddPermWep( "weapon_smg1" )
  195.             end,
  196.     }
  197.    
  198.     -- Vehicle example
  199.     CreditShop_Items["jeep"] = {
  200.         Name = "Jeep",
  201.         Description = "Gives you a Jeep!",
  202.         InDepthDescription = "Gives you a Jeep!",
  203.         Model = "models/buggy.mdl",
  204.         Price = 15,
  205.         PM = true,
  206.         Icon = false,
  207.         OnPurFunction =
  208.             function(ply,item)
  209.                 local car = ents.Create("prop_vehicle_jeep_old")
  210.                 car:SetModel("models/buggy.mdl")
  211.                 car:SetKeyValue("vehiclescript","scripts/vehicles/jeep_test.txt")
  212.                 car:SetPos(ply:GetPos()-Vector( 0, 100, 0 ) )
  213.                 car:Spawn()
  214.             end,
  215.     }  
  216.    
  217.     -- User group example
  218.     CreditShop_Items["vip"] = {
  219.         Name = "VIP Rank",
  220.         Description = "Gives you the VIP rank!",
  221.         InDepthDescription = "Gives you the VIP rank!",
  222.         Model = "models/buggy.mdl",
  223.         Price = 1500,
  224.         PM = false,
  225.         Icon = true,
  226.         IconImg = "icon16/shield.png",
  227.         OnPurFunction =
  228.             function(ply,item)
  229.                 ply:SetUserGroup( "admin" )
  230.             end,
  231.     }
  232.  
  233.     if( CreditShop_Config.UseDarkRP == true ) then
  234.         -- Icon (Money) examples
  235.         CreditShop_Items["dollars"] = {
  236.             Name = "$75,000",
  237.             Description = "Gives you $75,000",
  238.             InDepthDescription = "Gives you $75,000",
  239.             Model = "models/props/cs_assault/money.mdl",
  240.             Price = 750,
  241.             PM = false,
  242.             Icon = false,
  243.             IconImg = "materials/dark_matter/minigun.png",
  244.             OnPurFunction =
  245.                 function(ply,item)
  246.                     ply:addMoney(75000)
  247.                 end,
  248.         }
  249.  
  250.         CreditShop_Items["dollars2"] = {
  251.             Name = "$250,000",
  252.             Description = "Gives you $250,000",
  253.             InDepthDescription = "Gives you $250,000",
  254.             Model = "models/props/cs_assault/money.mdl",
  255.             Price = 2500,
  256.             PM = false,
  257.             Icon = false,
  258.             IconImg = "materials/dark_matter/minigun.png",
  259.             OnPurFunction =
  260.                 function(ply,item)
  261.                     ply:addMoney(250000)
  262.                 end,
  263.         }
  264.  
  265.         CreditShop_Items["dollars3"] = {
  266.             Name = "$1,000,000",
  267.             Description = "Gives you $1,000,000",
  268.             InDepthDescription = "Gives you $1,000,000",
  269.             Model = "models/props/cs_assault/money.mdl",
  270.             Price = 100000,
  271.             PM = false,
  272.             Icon = false,
  273.             IconImg = "materials/dark_matter/minigun.png",
  274.             OnPurFunction =
  275.                 function(ply,item)
  276.                     ply:addMoney(1000000)
  277.                 end,
  278.         }
  279.     end
  280.        
  281.     if( ItemSort == "High_Low" ) then
  282.         table.sort(CreditShop_Items, function(a, b) return a.Price > b.Price end);
  283.     elseif( ItemSort == "Low_High" ) then
  284.         table.sort(CreditShop_Items, function(a, b) return a.Price < b.Price end);
  285.     end
  286.    
  287. // PRESET CONFIG
  288.  
  289.     --PRESETS--
  290.  
  291.     --[[--
  292.     CreditShop_Presets[1] = {
  293.         Name = "Tropical Preset", --Preset Name
  294.         TextColor = Color(120,120,120,255), --Preset Text color
  295.         ThemeColor = Color(0,238,255,150) --Preset Theme color
  296.     }
  297.  
  298.     CreditShop_Presets[5] = {
  299.         Name = "Rainbow Preset", --Preset Name
  300.         Flash = true, --Should the preset constantly change colors
  301.         TextColor = Color(255,255,255,255), --Preset Text Color
  302.         minRed = 0, -- Minimum Red
  303.         maxRed = 255, -- Maximum Red
  304.         minGreen = 0, -- Minimum Green
  305.         maxGreen = 255, -- Maximum Green
  306.         minBlue = 0, -- Minimum Blue
  307.         maxBlue = 255, -- Maximum Blue
  308.         Alpha = 200 -- Alpha ( opacity )
  309.     }
  310.     --]]--
  311.  
  312.  
  313.     CreditShop_Presets = {} --IGNORE
  314.  
  315.     CreditShop_Presets[1] = {
  316.         Name = "Red Preset",
  317.         TextColor = Color(255,174,174,255),
  318.         ThemeColor = Color(255,0,0,150)
  319.     }
  320.  
  321.     CreditShop_Presets[2] = {
  322.         Name = "Orange Preset",
  323.         TextColor = Color(255,234,174,255),
  324.         ThemeColor = Color(255,144,0,175)
  325.     }
  326.  
  327.     CreditShop_Presets[3] = {
  328.         Name = "Yellow Preset",
  329.         TextColor = Color(255,255,196,255),
  330.         ThemeColor = Color(255,255,0,184)
  331.     }
  332.  
  333.     CreditShop_Presets[4] = {
  334.         Name = "Green Preset",
  335.         TextColor = Color(211,255,210,255),
  336.         ThemeColor = Color(12,255,0,200)
  337.     }
  338.  
  339.     CreditShop_Presets[5] = {
  340.         Name = "Light Blue Preset",
  341.         TextColor = Color(255,255,255,255),
  342.         ThemeColor = Color(0,255,242,200)
  343.     }
  344.  
  345.     CreditShop_Presets[6] = {
  346.         Name = "Blue Preset",
  347.         TextColor = Color(142,142,255,255),
  348.         ThemeColor = Color(0,4,255,200)
  349.     }
  350.  
  351.     CreditShop_Presets[7] = {
  352.         Name = "Pink Preset",
  353.         TextColor = Color(251,160,255,255),
  354.         ThemeColor = Color(255,0,238,200)
  355.     }
  356.  
  357.     CreditShop_Presets[8] = {
  358.         Name = "Purple Preset",
  359.         TextColor = Color(178,0,157,236),
  360.         ThemeColor = Color(126,0,161,236)
  361.     }
  362.  
  363.     CreditShop_Presets[9] = {
  364.         Name = "Sun Preset",
  365.         TextColor = Color(255,0,0,255),
  366.         ThemeColor = Color(198,66,0,150)
  367.     }
  368.  
  369.     CreditShop_Presets[10] = {
  370.         Name = "Dark Preset",
  371.         TextColor = Color(255,255,255,255),
  372.         ThemeColor = Color(0,0,0,255)
  373.     }
  374.  
  375.     CreditShop_Presets[11] = {
  376.         Name = "Tropical Preset",
  377.         TextColor = Color(120,120,120,255),
  378.         ThemeColor = Color(0,238,255,150)
  379.     }
  380.  
  381.     CreditShop_Presets[12] = {
  382.         Name = "Rainbow Preset",
  383.         Flash = true,
  384.         TextColor = Color(255,255,255,255),
  385.         minRed = 0,
  386.         maxRed = 255,
  387.         minGreen = 0,
  388.         maxGreen = 255,
  389.         minBlue = 0,
  390.         maxBlue = 255,
  391.         Alpha = 200
  392.     }
  393.  
  394.     CreditShop_Presets[13] = {
  395.         Name = "Red Mayhem Preset",
  396.         Flash = true,
  397.         TextColor = Color(255,255,255,255),
  398.         minRed = 0,
  399.         maxRed = 255,
  400.         minGreen = 0,
  401.         maxGreen = 0,
  402.         minBlue = 0,
  403.         maxBlue = 0,
  404.         Alpha = 200
  405.     }
  406.  
  407.     CreditShop_Presets[14] = {
  408.         Name = "Green Mayhem Preset",
  409.         Flash = true,
  410.         TextColor = Color(255,255,255,255),
  411.         minRed = 0,
  412.         maxRed = 0,
  413.         minGreen = 0,
  414.         maxGreen = 255,
  415.         minBlue = 0,
  416.         maxBlue = 0,
  417.         Alpha = 200
  418.     }
  419.  
  420.     CreditShop_Presets[15] = {
  421.         Name = "Blue Mayhem Preset",
  422.         Flash = true,
  423.         TextColor = Color(255,255,255,255),
  424.         minRed = 0,
  425.         maxRed = 0,
  426.         minGreen = 0,
  427.         maxGreen = 0,
  428.         minBlue = 0,
  429.         maxBlue = 255,
  430.         Alpha = 200
  431.     }
  432.  
  433.     CreditShop_Presets[16] = {
  434.         Name = "White Mayhem Preset",
  435.         Flash = true,
  436.         TextColor = Color(255,255,255,255),
  437.         minRed = 200,
  438.         maxRed = 255,
  439.         minGreen = 200,
  440.         maxGreen = 255,
  441.         minBlue = 200,
  442.         maxBlue = 255,
  443.         Alpha = 200
  444.     }
  445.    
  446.     //IGNORE
  447.     function formatCredits( num ) -- Formats a number like this "10,000 Credits", saves space
  448.         return string.Comma(num).." Credits"
  449.     end
  450.    
  451. end )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top