Advertisement
Guest User

Untitled

a guest
Jan 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.69 KB | None | 0 0
  1. WEED_ITEMS = {}
  2.  
  3. WEED_ITEMS.__index = __index
  4. WEED_ITEMS.Items = {}
  5.  
  6. if SERVER then
  7. util.AddNetworkString("PurchaseItem")
  8. end
  9.  
  10. function WEED_ITEMS:Add(item,data)
  11. if(self.Items[data.category or "Pots"] == nil) then
  12. self.Items[data.category or "Pots"] = {}
  13. end
  14. self.Items[data.category or "Pots"][item] = data
  15. end
  16.  
  17. function WEED_ITEMS:Purchase(who,item)
  18. local f = false
  19. _weedDebug("Purchase started")
  20. if(item == "Beeper") then
  21. if(who:getDarkRPVar("money") >= WEED_CONFIG.BeeperPrice) then
  22. who:SetNWBool("HasBeeper",true)
  23. who:addMoney(-WEED_CONFIG.BeeperPrice)
  24. DarkRP.notify(who, 3, 3, "You bought the beeper at $"..WEED_CONFIG.BeeperPrice)
  25. end
  26. return
  27. end
  28. for k,v in pairs(self.Items) do
  29. for a,j in pairs(v) do
  30. if(a==item) then
  31. if(who:getDarkRPVar("money") >= j.price) then
  32. if(WEED_CONFIG.UseGroupData && (j.max or 0) > 0) then
  33. for k,v in pairs(WEED_CONFIG.GroupData) do
  34. if(k==who:GetUserGroup()) then
  35. if(who.Pots == nil) then
  36. who.Pots = {}
  37. end
  38. if(who.Pots[a] == nil) then
  39. who.Pots[a] = 1
  40. else
  41. if(who.Pots[a] < (j.max or 0)*v) then
  42. who.Pots[a] = who.Pots[a] + 1
  43.  
  44. else
  45. DarkRP.notify(who, 1, 3, "You already hit this item limit")
  46. return
  47. end
  48. end
  49. end
  50. end
  51. end
  52. if(j.ent != nil) then
  53.  
  54. local trace = {}
  55. trace.start = who:EyePos()
  56. trace.endpos = trace.start + who:GetAimVector() * 85
  57. trace.filter = who
  58.  
  59. local tr = util.TraceLine(trace)
  60.  
  61. _weedDebug("Enitty "..j.ent.." has been created")
  62. local ent = ents.Create(j.ent)
  63. ent:SetPos(tr.HitPos)
  64. ent:SetAngles(Angle(0,who:EyeAngles().y,0))
  65. ent:Spawn()
  66. ent.SID = who.SID
  67. if(ent.Setowning_ent) then
  68. ent:Setowning_ent(who)
  69. end
  70. ent:CPPISetOwner(who)
  71. ent.Owner = who
  72. ent.cls = a
  73. if(isfunction(j.purchase)) then
  74. j:purchase(ent)
  75. end
  76. end
  77. if(j.wep != nil) then
  78. if(!who:HasWeapon(j.wep)) then
  79. who:Give(j.wep)
  80. else
  81. DarkRP.notify(who, 1, 3, "You already got this item!")
  82. return
  83. end
  84. end
  85. who:addMoney(-j.price)
  86. DarkRP.notify(who, 3, 3, "You bought "..j.name.." at "..j.price)
  87. _weedDebug("Money deduced")
  88. end
  89. f = true
  90. break
  91. end
  92. if(f) then
  93. break
  94. end
  95. end
  96. end
  97. end
  98.  
  99. if SERVER then
  100. hook.Add("EntityRemoved","RemovePotPetition",function(ent)
  101. if(ent.Owner != nil) then
  102. if(ent.Owner.Pots != nil && ent.Owner.Pots[ent.cls or ""] != nil) then
  103. ent.Owner.Pots[ent.cls or ""] = ent.Owner.Pots[ent.cls or ""] - 1
  104. end
  105. end
  106. end)
  107.  
  108.  
  109. end
  110.  
  111. net.Receive("PurchaseItem",function(l,ply)
  112. WEED_ITEMS:Purchase(ply,net.ReadString())
  113. end)
  114.  
  115.  
  116. WEED_ITEMS:Add("base_seed",{name="Amnesia Haze",
  117. category="Seeds",
  118. description="Amnesia Haze seeds from Gonzo Seeds, you’ll be able to produce some amazing plants that taste great",
  119. price=19,
  120. ent="sent_seed",
  121. purchase=function(_,ent) ent:SetSeed(1) end,
  122. draw=function(_,ent,b)
  123. ent:SetMaterial("models/gonzo/weed/weed")
  124. b:SetColor(Color(150,200,150))
  125. end,
  126. model="models/props_junk/watermelon01.mdl",
  127. max=5})
  128.  
  129. WEED_ITEMS:Add("base_seed3",{name="Amnesia Haze (Bulk)",
  130. category="Seeds",
  131. description="Amnesia Haze seeds package",
  132. price=75,
  133. ent="sent_seed",
  134. purchase=function(_,ent) ent:SetSeed(1)
  135. for k=1,2 do
  136. local a = ents.Create("sent_seed")
  137. a:SetPos(ent:GetPos() + ent:GetUp()*24*k)
  138. a:Spawn()
  139. a:CPPISetOwner(ent.Owner)
  140. a:SetSeed(1)
  141. end
  142. end,
  143. draw=function(_,ent,b)
  144. ent:SetMaterial("models/gonzo/weed/weed")
  145. b:SetColor(Color(150,200,150))
  146. end,
  147. model="models/props_junk/watermelon01.mdl",
  148. max=5})
  149.  
  150. WEED_ITEMS:Add("water_seed",{name="Bubble Kush",
  151. category="Seeds",
  152. description="Cool seed! But you'll need a lot water to maintain this seed. Although, you'll get some awesome kush!",
  153. price=45,
  154. ent="sent_seed",
  155. purchase=function(_,ent) ent:SetSeed(2) end,
  156. draw=function(_,ent,b)
  157. ent:SetMaterial("models/gonzo/weed/weed")
  158. b:SetColor(Color(255,175,100))
  159. end,
  160. model="models/props_junk/watermelon01.mdl",
  161. max=5})
  162.  
  163. WEED_ITEMS:Add("water_seed3",{name="Bubble Kush (Bulk)",
  164. category="Seeds",
  165. description="Bubble Kush seeds package",
  166. price=40*3,
  167. ent="sent_seed",
  168. purchase=function(_,ent) ent:SetSeed(2)
  169. for k=1,2 do
  170. local a = ents.Create("sent_seed")
  171. a:SetPos(ent:GetPos() + ent:GetUp()*24*k)
  172. a:Spawn()
  173. a:CPPISetOwner(ent.Owner)
  174. a:SetSeed(2)
  175. end
  176. end,
  177. draw=function(_,ent,b)
  178. ent:SetMaterial("models/gonzo/weed/weed")
  179. b:SetColor(Color(255,175,75))
  180. end,
  181. model="models/props_junk/watermelon01.mdl",
  182. max=5})
  183.  
  184. WEED_ITEMS:Add("elder_seed",{name="O.G. Kush",
  185. category="Seeds",
  186. description="This seed takes much more time to grow, but DAMN! You'll get the best weed ever, bro!",
  187. price=75,
  188. ent="sent_seed",
  189. purchase=function(_,ent) ent:SetSeed(3) end,
  190. draw=function(_,ent,b)
  191. ent:SetMaterial("models/gonzo/weed/weed")
  192. b:SetColor(Color(25,75,25)) end,
  193. model="models/props_junk/watermelon01.mdl",
  194. max=5})
  195.  
  196. WEED_ITEMS:Add("elder_seed3",{name="O.G. Kush (Bulk)",
  197. category="Seeds",
  198. description="O.G. Kush seeds package",
  199. price=65*3,
  200. ent="sent_seed",
  201. purchase=function(_,ent) ent:SetSeed(3)
  202. for k=1,2 do
  203. local a = ents.Create("sent_seed")
  204. a:SetPos(ent:GetPos() + ent:GetUp()*24*k)
  205. a:Spawn()
  206. a:CPPISetOwner(ent.Owner)
  207. a:SetSeed(3)
  208. end
  209. end,
  210. draw=function(_,ent,b)
  211. ent:SetMaterial("models/gonzo/weed/weed")
  212. b:SetColor(Color(25,75,25))
  213. end,
  214. model="models/props_junk/watermelon01.mdl",
  215. max=5})
  216. //76561198304825483
  217. WEED_ITEMS:Add("quick_seed",{name="Haze Berry",
  218. category="Seeds",
  219. description="Are you lazy? Sell this for some easy money!",
  220. price=50,
  221. ent="sent_seed",
  222. purchase=function(_,ent) ent:SetSeed(4) end,
  223. draw=function(_,ent,b)
  224. ent:SetMaterial("models/gonzo/weed/weed")
  225. b:SetColor(Color(255,75,255)) end,
  226. model="models/props_junk/watermelon01.mdl",
  227. max=5})
  228.  
  229. WEED_ITEMS:Add("quick_seed3",{name="Haze Berry (Bulk)",
  230. category="Seeds",
  231. description="Quick seeds package",
  232. price=40*3,
  233. ent="sent_seed",
  234. purchase=function(_,ent) ent:SetSeed(4)
  235. for k=1,2 do
  236. local a = ents.Create("sent_seed")
  237. a:SetPos(ent:GetPos() + ent:GetUp()*24*k)
  238. a:Spawn()
  239. a:CPPISetOwner(ent.Owner)
  240. a:SetSeed(4)
  241. end
  242. end,
  243. draw=function(_,ent,b)
  244. ent:SetMaterial("models/gonzo/weed/weed")
  245. b:SetColor(Color(255,75,255))
  246. end,
  247. model="models/props_junk/watermelon01.mdl",
  248. max=5})
  249.  
  250. --------------------------------------------------------------------------------
  251.  
  252. WEED_ITEMS:Add("plastic_pot",{name="Bucket",
  253. category="Pots",
  254. description="Looks like a regular paint bucket, but a plant could easily grow here!",
  255. price=80,
  256. ispot = true,
  257. ent="sent_pot",
  258. purchase=function(_,ent) ent:SetPot(2) end,
  259. model="models/gonzo/weedb/pot2.mdl",
  260. max=7})
  261.  
  262. WEED_ITEMS:Add("stone_pot",{name="Broken Pot",
  263. category="Pots",
  264. description="Very sturdy and can retain a lot more water!",
  265. price=90,
  266. ispot = true,
  267. ent="sent_pot",
  268. purchase=function(_,ent) ent:SetPot(1) end,
  269. model="models/gonzo/weedb/pot1.mdl",
  270. max=7})
  271.  
  272. WEED_ITEMS:Add("cool_pot",{name="Flower Pot",
  273. category="Pots",
  274. description="This is a great vessel to grow your weed in!",
  275. price=400,
  276. ispot = true,
  277. ent="sent_pot",
  278. purchase=function(_,ent) ent:SetPot(3) end,
  279. model="models/gonzo/weedb/pot3.mdl",
  280. max=7})
  281.  
  282. WEED_ITEMS:Add("extra_pot",{name="Multiple Pot",
  283. category="Pots",
  284. description="Need to grow 3 plants at once? No problem, here's my deal.",
  285. price=650,
  286. ispot = true,
  287. ent="sent_pot",
  288. purchase=function(_,ent) ent:SetPot(4) end,
  289. model="models/gonzo/weedb/pot4.mdl",
  290. max=4})
  291.  
  292. -----------------------------------------------------------------------
  293.  
  294. WEED_ITEMS:Add("battery_simple",{name="Simple battery",
  295. category="Energy",
  296. description="Do you need a quick and disposable energy source? Try this One-Use Battery!",
  297. price=200,
  298. ent="sent_battery",
  299. purchase=function(_,ent) ent:SetBattery(1) end,
  300. model="models/gonzo/weedb/battery.mdl",
  301. max=6})
  302.  
  303. WEED_ITEMS:Add("battery_rechargeable",{name="Rechargeable Battery",
  304. category="Energy",
  305. description="Do you need to continue your production? Grab a rechargeable lithium battery.",
  306. price=400,
  307. ent="sent_battery",
  308. purchase=function(_,ent) ent:SetBattery(2) end,
  309. model="models/gonzo/weedb/battery.mdl",
  310. max=3})
  311.  
  312. WEED_ITEMS:Add("charger",{name="Battery Charger",
  313. category="Energy",
  314. description="Recharge your batteries with this device! *WARNING! You can only recharge up to 20 batteries before this device expires*",
  315. price=500,
  316. ent="sent_charger",
  317. model="models/gonzo/weedb/charger.mdl",
  318. max=6})
  319.  
  320. -----------------------------------------------------------------------
  321.  
  322. WEED_ITEMS:Add("lamp_base",{name="Basic Lamp",
  323. category="Lighting",
  324. description="Do you need a lamp to keep your plants warm? No problem! This lamp emits warmth in a cone in front of it.",
  325. price=550,
  326. ent="sent_light",
  327. purchase=function(_,ent) ent:SetLight(1) end,
  328. model="models/gonzo/weedb/lamp.mdl",
  329. max=6})
  330.  
  331. WEED_ITEMS:Add("lamp_radial",{name="Radial Lamp",
  332. category="Lighting",
  333. description="Do you need a lamp to keep your plants warm? No problem! This lamp emits warmth in a grid around it.",
  334. price=500,
  335. ent="sent_light",
  336. purchase=function(_,ent) ent:SetLight(2) end,
  337. model="models/gonzo/weedb/lamp2.mdl",
  338. max=6})
  339.  
  340. -----------------------------------------------------------------------
  341.  
  342. WEED_ITEMS:Add("water_pot",{name="Watering Can",
  343. category="Water",
  344. description="Keep your growing plants hydrated with this basic watering can!",
  345. price=50,
  346. ent="sent_water_pot",
  347. purchase=function(_,ent) ent:SetWater(1) end,
  348. model="models/gonzo/weedb/water_pot.mdl",
  349. max=8})
  350.  
  351. WEED_ITEMS:Add("water_shower",{name="Shower",
  352. category="Water",
  353. description="Water your Multiple Pots without any effort!",
  354. price=400,
  355. ent="sent_water_pot",
  356. purchase=function(_,ent) ent:SetWater(2) end,
  357. model="models/gonzo/weedb/shower.mdl",
  358. max=5})
  359.  
  360. WEED_ITEMS:Add("water_tank",{name="Water tank",
  361. category="Water",
  362. description="Extract water from the floor! You can extract up to "..WEED_CONFIG.WaterSourceBuckets.." watering cans!",
  363. price=600,
  364. ent="sent_water_tank",
  365. model="models/gonzo/weedb/water_source.mdl",
  366. max=4})
  367.  
  368. WEED_ITEMS:Add("water_supply",{name="Water Supply",
  369. category="Water",
  370. description="Recharge showers, 3 charges",
  371. price=400,
  372. ent="sent_water_loader",
  373. model="models/props_c17/canister01a.mdl",
  374. max=3})
  375.  
  376. -----------------------------------------------------------------------
  377.  
  378. WEED_ITEMS:Add("base_soil",{name="Base Soil",
  379. category="Soil",
  380. description="Makes your seed grow strong and healthy!",
  381. price=350,
  382. purchase=function(_,ent) ent:SetSoil(1) end,
  383. ent="sent_soil",
  384. model="models/gonzo/weedb/Soil_bag.mdl",
  385. max=5})
  386.  
  387. WEED_ITEMS:Add("acid_soil",{name="Acid Soil",
  388. category="Soil",
  389. description="Your weed will grow faster, but this will require more water than usual.",
  390. price=250,
  391. purchase=function(_,ent) ent:SetSoil(2) end,
  392. draw=function(_,ent) ent:SetSkin(1) end,
  393. ent="sent_soil",
  394. model="models/gonzo/weedb/Soil_bag.mdl",
  395. max=5})
  396.  
  397. WEED_ITEMS:Add("soft_soil",{name="Water Soil",
  398. category="Soil",
  399. description="Your weed will grow slower, but forget about watering your plant once you fill the pot!",
  400. price=350,
  401. purchase=function(_,ent) ent:SetSoil(3) end,
  402. draw=function(_,ent) ent:SetSkin(2) end,
  403. ent="sent_soil",
  404. model="models/gonzo/weedb/Soil_bag.mdl",
  405. max=5})
  406.  
  407. -----------------------------------------------------------------------
  408.  
  409. WEED_ITEMS:Add("bong",{name="Bong",
  410. category="Tools",
  411. description="Smoke your weed with this crazy ass bong!",
  412. price=500,
  413. wep="sent_bong",
  414. model="models/weapons/w_bong.mdl"})
  415.  
  416. WEED_ITEMS:Add("messure",{name="Measuring Tool",
  417. category="Tools",
  418. description="Watch your plant health and water level, useful to check with precision your love",
  419. price=350,
  420. wep="sent_messure",
  421. model="models/weapons/w_messure.mdl"})
  422.  
  423. WEED_ITEMS:Add("magazine",{name="How to: Grow Weed! 101",
  424. category="Tools",
  425. description="Learn how to grow a plant! 101 before start to do weed",
  426. price=30,
  427. ent="sent_magazine",
  428. model="models/props_lab/bindergreenlabel.mdl",
  429. max=5})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement