From 79c1c484eab6fbf36a69d155a324540887e38880 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sat, 29 Oct 2016 17:51:13 -0400 Subject: Got shops working --- gamemode/init.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'gamemode/init.lua') diff --git a/gamemode/init.lua b/gamemode/init.lua index 0b311ea..b4f5c76 100644 --- a/gamemode/init.lua +++ b/gamemode/init.lua @@ -3,3 +3,26 @@ AddCSLuaFile( "shared.lua" ) AddCSLuaFile( "cl_init.lua" ) include( "shared.lua" ) + +local pmeta = FindMetaTable("Player") + +--- Loads a player's inventory +-- @param json The JSON string to create the player's inventory from +function pmeta:LoadInventory(json) + local reinv = util.JSONToTable(json) + for k,v in pairs(reinv) do + self.Inventory[k] = v + end + print("After loading inventory, player's inventory was") + PrintTable(self.Inventory) + self:SynchronizeInventory() + self:SynchPrayers() + if self:HasPrayer("Noob Help") then + print("Player had Noob Help, equiping!") + net.Start("equiphelpprayer") + net.Send(self) + else + error("Player did not have noob help, inventory was:") + PrintTable(self.Inventory) + end +end -- cgit v1.2.3-70-g09d2