SHOW:
|
|
- or go back to the newest paste.
1 | -- YOU DON'T NEED TO TOUCH THIS IF YOU DON'T KNOW WHAT IT IS | |
2 | RARITY_UNCOMMON = 1 | |
3 | RARITY_COMMON = 2 | |
4 | RARITY_RARE = 3 | |
5 | RARITY_EPIC = 4 | |
6 | RARITY_LEGENDARY = 5 | |
7 | ||
8 | Inventory.Config = Inventory.Config or {} | |
9 | function Inventory.Config:AddRarity(entClass, rarity) | |
10 | self.Rarities[entClass] = rarity | |
11 | end | |
12 | Inventory.Config.Items = Inventory.Config.Items or {} | |
13 | Inventory.Config.Rarities = {} | |
14 | -- TOUCH BELOW HERE | |
15 | ||
16 | -- Should you be able to use ALT + *key* to pick up items? | |
17 | Inventory.Config.PickUpWithALT = true | |
18 | ||
19 | -- What key should be used in combination with alt? | |
20 | -- https://wiki.garrysmod.com/page/Enums/BUTTON_CODE | |
21 | Inventory.Config.AltKey = IN_USE | |
22 | -- Type the letter that ^ actually is. | |
23 | Inventory.Config.AltKeyStr = "E" | |
24 | ||
25 | -- What key should you open the inventory menu with? | |
26 | -- https://wiki.garrysmod.com/page/Enums/BUTTON_CODE | |
27 | -- If you want to disable this, set it to false instead of a key! | |
28 | Inventory.Config.InventoryKey = KEY_I | |
29 | ||
30 | -- Should users spawn with an inventory weapon allowing them to pick up items with the weapon? | |
31 | Inventory.Config.SpawnWithInventorySWEP = true | |
32 | ||
33 | -- What color should the standard chat messages prefix have? | |
34 | Inventory.Config.PrefixCol = Color(46, 204, 113) | |
35 | -- What should the prefix say? | |
36 | Inventory.Config.PrefixText = "[INVENTORY]" | |
37 | ||
38 | -- What language? | |
39 | -- By default this only supports English, but you can add your own language | |
40 | Inventory.Config.Language = "English" | |
41 | ||
42 | -- The NPC's model? | |
43 | - | Inventory.Config.NPCModel = "" |
43 | + | Inventory.Config.NPCModel = "models/misc/exchange_blue.mdl" |
44 | -- The outline color of the NPC's overhead HUD. | |
45 | Inventory.Config.NPCColor = Color(201, 176, 15) | |
46 | -- The text on the NPC's overhead HUD | |
47 | Inventory.Config.NPCText = "Vault" | |
48 | -- The icon for the NPC's overhead HUD | |
49 | Inventory.Config.NPCIcon = Material("xenin/inventory/icon.png", "smooth") | |
50 | ||
51 | -- How many items should there be in a row in the bank? | |
52 | Inventory.Config.BankItemsPerRow = 8 | |
53 | -- Slots for the bank. | |
54 | -- Free is for everyone that isn't in the paid list. | |
55 | -- The paid list works by doing ["rank"] = amount_of_slots | |
56 | Inventory.Config.BankSlots = { | |
57 | Free = 8, | |
58 | Paid = { | |
59 | ["bronzevip"] = 16, | |
60 | ["silvervip"] = 24, | |
61 | ["goldvip"] = 32, | |
62 | ["admin"] = 40, | |
63 | ["superadmin"] = 40 | |
64 | } | |
65 | } | |
66 | ||
67 | -- Same as above but for the inventory itself, not the bank | |
68 | Inventory.Config.ItemsPerRow = 8 | |
69 | -- Same as above but for the inventory itself, not the bank | |
70 | Inventory.Config.Slots = { | |
71 | Free = 8, | |
72 | Paid = { | |
73 | ["bronzevip"] = 16, | |
74 | ["silvervip"] = 24, | |
75 | ["goldvip"] = 32, | |
76 | ["admin"] = 40, | |
77 | ["superadmin"] = 40 | |
78 | } | |
79 | } | |
80 | ||
81 | -- The categories are defined here | |
82 | -- [number] is the number the category will be known as. | |
83 | -- name is obviously the name. | |
84 | -- color represents the color used to visualise the category | |
85 | -- maxStack is how many items can max be stacked if it's that category | |
86 | -- amountBackgroundColor is an optional thing! Use this for colors where seeing the default amount text background color might be hard. | |
87 | Inventory.Config.Categories = { | |
88 | [1] = { name = "Common", color = Color(168, 168, 168), maxStack = 10, amountBackgroundColor = Color(0, 0, 0, 225) }, -- grey | |
89 | [2] = { name = "Uncommon", color = Color(0, 255, 132), maxStack = 10 }, -- green | |
90 | [3] = { name = "Rare", color = Color(0, 174, 255), maxStack = 10 }, -- blue | |
91 | [4] = { name = "Epic", color = Color(112, 0, 209), maxStack = 5 }, -- purple | |
92 | [5] = { name = "Legendary", color = Color(224, 191, 0), maxStack = 1 }, -- orange | |
93 | } | |
94 | ||
95 | -- Should users be able to sort by rarity quality? | |
96 | Inventory.Config.EnableRaritySorting = true | |
97 | ||
98 | ||
99 | -- If you want a specific entity class to be a rarity. | |
100 | Inventory.Config:AddRarity("rw_sw_b2rp_blaster", RARITY_LEGENDARY) | |
101 | Inventory.Config:AddRarity("rw_sw_droideka", RARITY_LEGENDARY) | |
102 | Inventory.Config:AddRarity("rw_sw_droideka_sniper", RARITY_LEGENDARY) | |
103 | Inventory.Config:AddRarity("rw_sw_dual_e5", RARITY_EPIC) | |
104 | Inventory.Config:AddRarity("rw_sw_dual_e5bx", RARITY_EPIC) | |
105 | Inventory.Config:AddRarity("rw_sw_dual_rg4d", RARITY_EPIC) | |
106 | Inventory.Config:AddRarity("rw_sw_dual_se14", RARITY_EPIC) | |
107 | Inventory.Config:AddRarity("rw_sw_e5", RARITY_UNCOMMON) | |
108 | Inventory.Config:AddRarity("rw_sw_e5bx", RARITY_RARE) | |
109 | Inventory.Config:AddRarity("rw_sw_e5c", RARITY_RARE) | |
110 | Inventory.Config:AddRarity("rw_sw_e5s", RARITY_RARE) | |
111 | Inventory.Config:AddRarity("rw_sw_e5s_auto", RARITY_LEGENDARY) | |
112 | Inventory.Config:AddRarity("rw_sw_rg4d", RARITY_COMMON) | |
113 | Inventory.Config:AddRarity("rw_sw_se14", RARITY_COMMON) | |
114 | Inventory.Config:AddRarity("rw_sw_se14c", RARITY_COMMON) | |
115 | Inventory.Config:AddRarity("rw_sw_sg6", RARITY_EPIC) | |
116 | Inventory.Config:AddRarity("rw_sw_z4", RARITY_LEGENDARY) | |
117 | Inventory.Config:AddRarity("rw_sw_arc_blaster", RARITY_LEGENDARY) | |
118 | Inventory.Config:AddRarity("rw_sw_bowcaster", RARITY_EPIC) | |
119 | Inventory.Config:AddRarity("rw_sw_cr2", RARITY_EPIC) | |
120 | Inventory.Config:AddRarity("rw_sw_cr2c", RARITY_EPIC) | |
121 | Inventory.Config:AddRarity("rw_sw_tusken_cycler", RARITY_LEGENDARY) | |
122 | Inventory.Config:AddRarity("rw_sw_d", RARITY_COMMON) | |
123 | Inventory.Config:AddRarity("rw_sw_defender", RARITY_COMMON) | |
124 | Inventory.Config:AddRarity("rw_sw_dl18", RARITY_COMMON) | |
125 | Inventory.Config:AddRarity("rw_sw_dl44", RARITY_UNCOMMON) | |
126 | Inventory.Config:AddRarity("rw_sw_dt29_1", RARITY_UNCOMMON) | |
127 | Inventory.Config:AddRarity("rw_sw_dt29_2", RARITY_UNCOMMON) | |
128 | Inventory.Config:AddRarity("rw_sw_dt29_3", RARITY_UNCOMMON) | |
129 | Inventory.Config:AddRarity("rw_sw_dt29_4", RARITY_UNCOMMON) | |
130 | Inventory.Config:AddRarity("rw_sw_dual_defender", RARITY_EPIC) | |
131 | Inventory.Config:AddRarity("rw_sw_ee3", RARITY_RARE) | |
132 | Inventory.Config:AddRarity("rw_sw_ee3a", RARITY_RARE) | |
133 | Inventory.Config:AddRarity("rw_sw_huntershotgun", RARITY_EPIC) | |
134 | Inventory.Config:AddRarity("rw_sw_iqa11", RARITY_EPIC) | |
135 | Inventory.Config:AddRarity("rw_sw_iqa11c", RARITY_EPIC) | |
136 | Inventory.Config:AddRarity("rw_sw_manda_blaster", RARITY_LEGENDARY) | |
137 | Inventory.Config:AddRarity("rw_sw_nt242", RARITY_RARE) | |
138 | Inventory.Config:AddRarity("rw_sw_nt242c", RARITY_RARE) | |
139 | Inventory.Config:AddRarity("rw_sw_relbyv10", RARITY_UNCOMMON) | |
140 | Inventory.Config:AddRarity("rw_sw_s5", RARITY_UNCOMMON) | |
141 | Inventory.Config:AddRarity("rw_sw_s5c", RARITY_UNCOMMON) | |
142 | Inventory.Config:AddRarity("rw_sw_scattershotgun", RARITY_EPIC) | |
143 | Inventory.Config:AddRarity("rw_sw_x8", RARITY_UNCOMMON) | |
144 | Inventory.Config:AddRarity("rw_sw_z2", RARITY_LEGENDARY) | |
145 | Inventory.Config:AddRarity("rw_sw_dlt19", RARITY_RARE) | |
146 | Inventory.Config:AddRarity("rw_sw_dlt19x", RARITY_RARE) | |
147 | Inventory.Config:AddRarity("rw_sw_dual_e11", RARITY_EPIC) | |
148 | Inventory.Config:AddRarity("rw_sw_dual_rk3", RARITY_EPIC) | |
149 | Inventory.Config:AddRarity("rw_sw_e11", RARITY_COMMON) | |
150 | Inventory.Config:AddRarity("rw_sw_e11_noscope", RARITY_COMMON) | |
151 | Inventory.Config:AddRarity("rw_sw_e11d", RARITY_LEGENDARY) | |
152 | Inventory.Config:AddRarity("rw_sw_rk3", RARITY_COMMON) | |
153 | Inventory.Config:AddRarity("rw_sw_scoutblaster", RARITY_COMMON) | |
154 | Inventory.Config:AddRarity("rw_sw_t21", RARITY_EPIC) | |
155 | Inventory.Config:AddRarity("rw_sw_t21b", RARITY_EPIC) | |
156 | Inventory.Config:AddRarity("rw_sw_tl40", RARITY_EPIC) | |
157 | Inventory.Config:AddRarity("rw_sw_tl50", RARITY_EPIC) | |
158 | Inventory.Config:AddRarity("rw_sw_a280", RARITY_UNCOMMON) | |
159 | Inventory.Config:AddRarity("rw_sw_a280cfe", RARITY_RARE) | |
160 | Inventory.Config:AddRarity("rw_sw_a280c", RARITY_UNCOMMON) | |
161 | Inventory.Config:AddRarity("rw_sw_dh17", RARITY_COMMON) | |
162 | Inventory.Config:AddRarity("rw_sw_dh17a", RARITY_COMMON) | |
163 | Inventory.Config:AddRarity("rw_sw_dlt20a", RARITY_EPIC) | |
164 | Inventory.Config:AddRarity("rw_sw_dual_dh17a", RARITY_EPIC) | |
165 | Inventory.Config:AddRarity("rw_sw_rt97c", RARITY_LEGENDARY) | |
166 | Inventory.Config:AddRarity("rw_sw_t7", RARITY_LEGENDARY) | |
167 | Inventory.Config:AddRarity("rw_sw_dc15a", RARITY_UNCOMMON) | |
168 | Inventory.Config:AddRarity("rw_sw_dc15a_o", RARITY_RARE) | |
169 | Inventory.Config:AddRarity("rw_sw_dc15le", RARITY_UNCOMMON) | |
170 | Inventory.Config:AddRarity("rw_sw_dc15le_o", RARITY_RARE) | |
171 | Inventory.Config:AddRarity("rw_sw_dc15s", RARITY_UNCOMMON) | |
172 | Inventory.Config:AddRarity("rw_sw_dc15se", RARITY_UNCOMMON) | |
173 | Inventory.Config:AddRarity("rw_sw_dc15x", RARITY_RARE) | |
174 | Inventory.Config:AddRarity("rw_sw_dc17", RARITY_COMMON) | |
175 | Inventory.Config:AddRarity("rw_sw_dc17c", RARITY_COMMON) | |
176 | Inventory.Config:AddRarity("rw_sw_dc17s", RARITY_COMMON) | |
177 | Inventory.Config:AddRarity("rw_sw_dc19", RARITY_UNCOMMON) | |
178 | Inventory.Config:AddRarity("rw_sw_dc19le", RARITY_RARE) | |
179 | Inventory.Config:AddRarity("rw_sw_dp23", RARITY_LEGENDARY) | |
180 | Inventory.Config:AddRarity("rw_sw_dp24", RARITY_RARE) | |
181 | Inventory.Config:AddRarity("rw_sw_dual_dc15s", RARITY_EPIC) | |
182 | Inventory.Config:AddRarity("rw_sw_dual_dc17", RARITY_EPIC) | |
183 | Inventory.Config:AddRarity("rw_sw_dual_dc17s", RARITY_EPIC) | |
184 | Inventory.Config:AddRarity("rw_sw_valken38x", RARITY_EPIC) | |
185 | Inventory.Config:AddRarity("rw_sw_valkenx38a", RARITY_EPIC) | |
186 | Inventory.Config:AddRarity("rw_sw_westarm5", RARITY_LEGENDARY) | |
187 | Inventory.Config:AddRarity("rw_sw_z6", RARITY_LEGENDARY) | |
188 | Inventory.Config:AddRarity("seal6-tac-insert", RARITY_COMMON) | |
189 | Inventory.Config:AddRarity("zeus-thermaldet", RARITY_RARE) | |
190 | Inventory.Config:AddRarity("zeus-smokegranade", RARITY_RARE) | |
191 | Inventory.Config:AddRarity("zeus-flashbang", RARITY_RARE) | |
192 | Inventory.Config:AddRarity("rw_sw_bx_sword", RARITY_EPIC) | |
193 | Inventory.Config:AddRarity("rw_vibrosword", RARITY_EPIC) | |
194 | Inventory.Config:AddRarity("holocomm", RARITY_EPIC) | |
195 | Inventory.Config:AddRarity("stealth_camo", RARITY_LEGENDARY) | |
196 | ||
197 | ||
198 | -- Chat commands | |
199 | -- Code to holster weapons | |
200 | local funcHolster = function(ply) | |
201 | if (!IsValid(ply)) then return end | |
202 | if (!ply:IsPlayer()) then return end | |
203 | if (!ply:Alive()) then return end | |
204 | local activeWep = ply:GetActiveWeapon() | |
205 | if (!IsValid(activeWep)) then return end | |
206 | local inv = ply:Inventory() | |
207 | local amt = table.Count(inv:GetInventory()) | |
208 | local slots = inv:GetSlots() | |
209 | if (amt >= slots) then | |
210 | XeninUI:Notify(ply, Inventory:GetPhrase("ChatCommand.Holster.Unable"), 1, 4, XeninUI.Theme.Red) | |
211 | ||
212 | return | |
213 | end | |
214 | ||
215 | ply:dropDRPWeapon(activeWep, function(wep) | |
216 | ply:Inventory():Pickup(wep) | |
217 | end, false) | |
218 | end | |
219 | ||
220 | local openMenu = function(ply) | |
221 | ply:ConCommand("inventory") | |
222 | end | |
223 | ||
224 | Inventory.Config.ChatCommands = { | |
225 | ["/holster"] = funcHolster, | |
226 | ["/holsterwep"] = funcHolster, | |
227 | ["/gunholster"] = funcHolster, | |
228 | ["/invholster"] = funcHolster, | |
229 | ["/drop"] = function(ply) | |
230 | if (!IsValid(ply)) then return end | |
231 | if (!ply:IsPlayer()) then return end | |
232 | if (!ply:Alive()) then return end | |
233 | local activeWep = ply:GetActiveWeapon() | |
234 | if (!IsValid(activeWep)) then return end | |
235 | ||
236 | ply:dropDRPWeapon(activeWep) | |
237 | end, | |
238 | ["/inventory"] = openMenu, | |
239 | ["!inventory"] = openMenu, | |
240 | ["/inv"] = openMenu, | |
241 | ["!inv"] = openMenu | |
242 | } |