Guest User

Untitled

a guest
Jul 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. include ("sh_hats.lua")
  2. require ("glon")
  3. playerDat = {}
  4.  
  5.  
  6. hook.Add("PlayerSay","ISaid",function(ply, txt)
  7. if string.lower(txt) == "/shop" then
  8. -- Reading shop data about players
  9. success, ret = pcall( glon.decode, file.Read( "aprilonshop/shop.txt" ) )
  10. if ( success ) then
  11. playerDat = ret
  12. end
  13.  
  14. local frame = vgui.Create("DFrame")
  15. local IconList = vgui.Create( "DPanelList", frame )
  16.  
  17. --frame:SetPos(ScrW()/2,ScrH()/2)
  18. frame:SetSize(220,200)
  19. frame:SetTitle("Dexters Laboratory shop")
  20. frame:MakePopup()
  21.  
  22. IconList:EnableVerticalScrollbar( true )
  23. IconList:EnableHorizontal( true )
  24. IconList:SetPadding( 4 )
  25. IconList:SetPos(10,30)
  26. IconList:SetSize(200, 160)
  27. end
  28.  
  29.  
  30. for k,v in pairs(DHats) do
  31.  
  32. local icon = vgui.Create( "SpawnIcon", IconList )
  33. icon:SetModel( v.Model )
  34. IconList:AddItem( icon )
  35. icon.DoClick = function( icon )
  36. surface.PlaySound( "ui/buttonclickrelease.wav" )
  37. local uniqueID = ply:UniqueID()
  38. playerDat[ uniqueID ][ "chips" ] = tonumber(playerDat[ uniqueID ][ "chips" ]) -500
  39.  
  40. ply:PrintMessage(HUD_PRINTTALK,"You have bought "..tostring(k).." for 500 chips. You now have "..playerDat[ uniqueID ][ "chips" ].." chips!\n")
  41. file.Write( "aprilonshop/shop.txt", glon.encode( playerDat ) )
  42. end
  43. end
  44. end)
Add Comment
Please, Sign In to add comment