Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include ("sh_hats.lua")
- require ("glon")
- playerDat = {}
- hook.Add("PlayerSay","ISaid",function(ply, txt)
- if string.lower(txt) == "/shop" then
- -- Reading shop data about players
- success, ret = pcall( glon.decode, file.Read( "aprilonshop/shop.txt" ) )
- if ( success ) then
- playerDat = ret
- end
- local frame = vgui.Create("DFrame")
- local IconList = vgui.Create( "DPanelList", frame )
- --frame:SetPos(ScrW()/2,ScrH()/2)
- frame:SetSize(220,200)
- frame:SetTitle("Dexters Laboratory shop")
- frame:MakePopup()
- IconList:EnableVerticalScrollbar( true )
- IconList:EnableHorizontal( true )
- IconList:SetPadding( 4 )
- IconList:SetPos(10,30)
- IconList:SetSize(200, 160)
- end
- for k,v in pairs(DHats) do
- local icon = vgui.Create( "SpawnIcon", IconList )
- icon:SetModel( v.Model )
- IconList:AddItem( icon )
- icon.DoClick = function( icon )
- surface.PlaySound( "ui/buttonclickrelease.wav" )
- local uniqueID = ply:UniqueID()
- playerDat[ uniqueID ][ "chips" ] = tonumber(playerDat[ uniqueID ][ "chips" ]) -500
- ply:PrintMessage(HUD_PRINTTALK,"You have bought "..tostring(k).." for 500 chips. You now have "..playerDat[ uniqueID ][ "chips" ].." chips!\n")
- file.Write( "aprilonshop/shop.txt", glon.encode( playerDat ) )
- end
- end
- end)
Add Comment
Please, Sign In to add comment