wmc-master causing server crash on Melon Bomber?

Got several issues with our Melon Bomber server, but when we get about 10 or so people online, it starts giving lua errors, here is some of them:


L 05/28/2015 - 16:21:51: server_cvar: "sensor_stretchragdoll" "0"
L 05/28/2015 - 16:21:51: Lua Error: Couldn't include file 'sh_wmc_mediatypes.lua' (File not found) (@addons/wmc-master/lua/autorun/wmediacenter.lua (line 23))

L 05/28/2015 - 16:21:51: Lua Error: [AddCSLuaFile] Couldn't find 'sh_wmc_mediatypes.lua' (@addons/wmc-master/lua/autorun/wmediacenter.lua (line 24))

L 05/28/2015 - 16:21:51: Lua Error: [AddCSLuaFile] Couldn't find 'cl_wmc_media.lua' (@addons/wmc-master/lua/autorun/wmediacenter.lua (line 14))

L 05/28/2015 - 16:21:51: Lua Error: [AddCSLuaFile] Couldn't find 'cl_wmc_player2.lua' (@addons/wmc-master/lua/autorun/wmediacenter.lua (line 14))

L 05/28/2015 - 16:21:51: Lua Error: [AddCSLuaFile] Couldn't find 'cl_wmc_debugvid.lua' (@addons/wmc-master/lua/autorun/wmediacenter.lua (line 14))


So wmediacenter.lua is:



local wyozimc_debug = SERVER and CreateConVar("wyozimc_debug", "0") or CreateClientConVar("wyozimc_debug", "0", FCVAR_ARCHIVE)

wyozimc = wyozimc or {}
function wyozimc.Debug(...)
	if not wyozimc_debug:GetBool() then return end
	print("[WMC-DEBUG] ", ...)
end
function wyozimc.IsDebug()
	return wyozimc_debug:GetBool()
end

local function AddClient(fil)
	if SERVER then AddCSLuaFile(fil) end
	if CLIENT then include(fil) end
end

local function AddServer(fil)
	if SERVER then include(fil) end
end

local function AddShared(fil)
	include(fil)
	AddCSLuaFile(fil)
end

AddShared("sh_wmc_config.lua")
AddShared("sh_wmc_utils.lua")
AddShared("sh_wmc_tablemanip.lua")
AddShared("sh_wmc_mediatypes.lua")

AddServer("sv_wmc_dbconfig.lua")
AddServer("sv_wmc_dbconnector.lua")

AddShared("sh_wmc_providers.lua")
AddServer("sv_wmc_storage.lua")

AddClient("cl_wmc_media.lua")
AddClient("cl_wmc_player2.lua")
AddClient("cl_wmc_debugvid.lua")

AddClient("cl_wmc_gui.lua")
AddClient("cl_wmc_gui_medialist.lua")
AddClient("cl_wmc_gui_settings.lua")

AddClient("cl_wmc_hud.lua")
AddClient("cl_wmc_toolmenu.lua")

wyozimc.IsInitialized = true

wyozimc.CallHook("WyoziMCInitialized")

Any assistance would be greatly appreciated. This is the errors that start displaying when the server crashes:

[editline]28th May 2015[/editline]

Also the addons/clicker/lua/sv_clickerply.lua is as follows:


---------------------------
--- Receive From Client ---
---------------------------
net.Receive('ClickerAddToCount', function(length, ply)
	local ply = net.ReadEntity()
	local amount = tonumber(net.ReadString())
	if IsValid(ply) then
		ply:Clicker_AddToCountReal(amount)
	end
end)

net.Receive('ClickerAddToItems', function(length, ply)
	local ply = net.ReadEntity()
	local itemTable = net.ReadTable()
	if IsValid(ply) then
		ply:Clicker_AddToItemsReal(itemTable[1], itemTable[2])
	end
end)

net.Receive('ClickerModifyStats', function(length, ply)
	local ply = net.ReadEntity()
	local itemTable = net.ReadTable()
	if IsValid(ply) then
		ply:Clicker_ModifyStatsReal(itemTable[1], itemTable[2])
	end
end)

net.Receive('ClickerForceSave', function(length, ply)
	ply:Clicker_SaveSettings()
end)

net.Receive('ClickerHighScores', function(length, ply)
	ply:Clicker_GetHighScores(net.ReadInt(8))
end)

net.Receive('ClickerResetItems', function(length, ply)
	local ply = net.ReadEntity()
	net.Start('ClickerResetItemsClient')
		net.WriteEntity(ply)
	net.Send(ply)
end)

net.Receive('ClickerAddToPoints', function(length, ply)
	local pointsToGive = tonumber(net.ReadString())
	ply:PS_GivePoints(pointsToGive)
end)

------------------------
--- Server Functions ---
------------------------
local metaPly = FindMetaTable('Player')
function metaPly:Clicker_SetCount(amount)
	if amount < 0 then
		amount = 0
	end
	net.Start("ClickerAddToCountClient")
		net.WriteEntity(self)
		net.WriteString(tostring(amount))
	net.Broadcast()
	self.Clicker_Count = amount
end

function metaPly:Clicker_AddToCountReal(amount)
	self:Clicker_SetCount(self:Clicker_GetCount() + amount)
end

function metaPly:Clicker_SetItems(items)
	net.Start("ClickerAddToItemsClient")
		net.WriteEntity(self)
		net.WriteTable(items)
	net.Broadcast()
	self.Clicker_Items = items
end

function metaPly:Clicker_AddToItemsReal(itemID, amount)
	local clickerItems = self:Clicker_GetItems()
	if !clickerItems[itemID] then
		clickerItems[itemID] = amount
	else
		clickerItems[itemID] = clickerItems[itemID] + amount
	end
	self:Clicker_SetItems(clickerItems)
end

function metaPly:Clicker_SetStats(stats)
	net.Start("ClickerModifyStatsClient")
		net.WriteEntity(self)
		net.WriteTable(stats)
	net.Broadcast()
	self.Clicker_Stats = stats
end

function metaPly:Clicker_ModifyStatsReal(statID, newValue)
	local clickerStats = self:Clicker_GetStats()
	for i, k in pairs(clickerStats) do
		if k.Name == statID then
			clickerStats* = {Name=k.Name,Value=newValue,Priority=k.Priority}
		end
	end
	self:Clicker_SetStats(clickerStats)
end

function metaPly:Clicker_LoadStats()
	-- This will allow me to add more stats in the future!
	local userStats
	userStats = sql.QueryValue("SELECT stats FROM clickertable WHERE steamid = '"..self:SteamID().."';")
	clickerStats = {}
	clickerStats[1] = {Name='Current Melons Owned',Value=0,Priority=1}
	clickerStats[2] = {Name='Current Melons Per-Second',Value=0,Priority=2}
	clickerStats[3] = {Name='Total Melons Produced',Value=0,Priority=3 }
	clickerStats[4] = {Name='Total Melons Produced (This Session)',Value=0,Priority=4}
	clickerStats[5] = {Name='Total Ever Melon Clicks',Value=0,Priority=5}
	clickerStats[6] = {Name='Total Items Owned',Value=0,Priority=6}
	clickerStats[7] = {Name='Total Points from Conversion',Value=0,Priority=7}
	if userStats == "empty" then
		userStats = clickerStats
	else
		userStats = util.JSONToTable(userStats)
		if not (#userStats == #clickerStats) then
			for i=#userStats+1, #clickerStats do
				userStats* = clickerStats* -- Add new stats
			end
		end
		for k, v in pairs(clickerStats) do
			if not (userStats[k].Name == v.Name) then
				userStats = clickerStats -- If their data is corrupt, reset them :(
			elseif not(userStats[k].Priority == v.Priority) then
				userStats[k].Priority = v.Priority -- Adjust to new priority
			end
		end
	end
	self:Clicker_SetStats(userStats)
end

function metaPly:Clicker_LoadSettings()
	local melons, items
	local steamID = self:SteamID()
	local name = self:Nick()
	local result = sql.Query("SELECT steamid, name, melons, items, stats FROM clickertable WHERE steamid = '"..steamID.."';")
	if not (result) then -- If a player needs to be created
		sql.Query("INSERT INTO clickertable ('steamid', 'name', 'melons', 'items', 'stats') VALUES ('"..steamID.."', '"..name.."', '0', '[]', 'empty');")
		result = sql.Query("SELECT steamid, name, melons, items, stats FROM clickertable WHERE steamid = '"..steamID.."';")
		if result then
			if clickerSettings.nonErrorSQLMessages then
				print("Melon Clicker SQL: Player "..name.."("..steamID..") has been created successfully!")
			end
		else
			print("Melon Clicker SQL: Player "..name.."("..steamID..") has failed to have been created!")
			print("Melon Clicker SQL: "..sql.LastError(result))
		end
		melons = 0
		items = {}
	else
		melons = tonumber(sql.QueryValue("SELECT melons FROM clickertable WHERE steamid = '"..steamID.."';"))
		items = util.JSONToTable(sql.QueryValue("SELECT items FROM clickertable WHERE steamid = '"..steamID.."';"))
	end
	self:Clicker_SetItems(items)
	self:Clicker_SetCount(melons)
	self:Clicker_LoadStats()
	self:sendNotification("Your settings have loaded successfully!")
	timer.Create( "ClickerAutoSave"..self:UniqueID(), clickerSettings.autoSaveTimerDelay, 0, function()
		if IsValid(self) then
			self:Clicker_SaveSettings()
		end
	end)
end
hook.Add( "PlayerInitialSpawn", "ClickerLoadSettings", function(ply) timer.Simple(1, function() ply:Clicker_LoadSettings() end) end)

function metaPly:Clicker_SaveSettings()
	local query
	local plyName = self:Nick()
	local steamID = self:SteamID()
	local clickerCount = tostring(self:Clicker_GetCount())
	local itemsList = util.TableToJSON(self:Clicker_GetItems())
	local statsList = util.TableToJSON(self:Clicker_GetStats())
	if not(sql.QueryValue("SELECT name FROM clickertable WHERE steamid = '"..steamID.."';") == plyName) then
		query = "UPDATE clickertable SET name = '"..plyName.."', melons = '"..clickerCount.."', items = '"..itemsList.."', stats = '"..statsList.."' WHERE steamid = '"..steamID.."';"
	else
		query = "UPDATE clickertable SET melons = '"..clickerCount.."', items = '"..itemsList.."', stats = '"..statsList.."' WHERE steamid = '"..steamID.."';"
	end
	sql.Query(query)
	self:sendNotification("Your settings have been saved successfully!")
end
hook.Add( "PlayerDisconnected", "ClickerSaveSettings", function(ply) if IsValid(ply) then ply:Clicker_SaveSettings() end end)

function metaPly:sendNotification(text)
	net.Start("ClickerNotify")
		net.WriteString(text)
	net.Send(self)
end

function metaPly:Clicker_GetHighScores(displayNo)
	local HsTable = {}
	local tmpTable = {}
	local melHS = {}
	local melHS = sql.Query("SELECT name, melons FROM clickertable ORDER BY melons DESC LIMIT "..displayNo..";")
	local tmpTable = sql.Query("SELECT name, stats FROM clickertable WHERE melons != 0;") -- If they have no melons, they're likely not got the highest stats
	if tmpTable then
		local insertTable = {}
		local finalInsertTable = {}
		for i, j in pairs({{"MMC", 5}, {"MPS", 2}, {"MPP", 7}}) do
			for k,v in pairs(tmpTable) do
				insertTable[k] = {name = v["name"], value = tonumber(util.JSONToTable(v["stats"])[j[2]]["Value"])}
			end
			table.SortByMember(insertTable, "value")
			local finalTable = {}
			for x=1, displayNo do
				finalTable[x] = insertTable[x]
			end
			HsTable[j[1]] = finalTable
		end
		HsTable["HMC"] = {}
		HsTable["HMC"][1] = {name = melHS[1]["name"], value = melHS[1]["melons"]}
	end
	net.Start("ClickerHighScoresClient")
		net.WriteTable(HsTable)
	net.Send(self)
end

hook.Add( "Initialize", "ClickerCheckTable", function()
	local query, result
	if not(sql.TableExists("clickertable")) then
		if not(sql.TableExists("clickertable")) then
			query = "CREATE TABLE clickertable (steamid varchar(64), name varchar(128), melons int, items text, stats text);"
			result = sql.Query(query)
			if (sql.TableExists("clickertable")) then
				print("Melon Clicker SQL: Table 'clickertable' has been created successfully!")
			else
				print("Melon Clicker SQL: An error has occurred! Table 'clickertable' has failed to been created!")
				print("Melon Clicker SQL: "..sql.LastError( result ))
			end
		end
	else
		if clickerSettings.nonErrorSQLMessages then
			print("Melon Clicker SQL: Table clickertable exists!")
		end
	end
	print("Melon Clicker SQL: Table has been loaded successfully!")
end)

timer.Simple(5, function()	
	hook.Add( "PlayerSay", "clickerChatCommand", function( ply, text, public )
		if ( string.lower(text) == string.lower(clickerSettings.openChatCommand) ) then
			ply:ConCommand( "ClickerChatCommand" )
			return ""
	    end
	end)
end)

I assume you got WMC from here: https://github.com/wyozi/wmc. If you really want to use that version you should grab the version from releases tab https://github.com/wyozi/wmc/releases.

The github version doesn’t function properly anymore though so you should probably use the new WMC in workshop http://steamcommunity.com/sharedfiles/filedetails/?id=426998109.

Regarding the crash; WMC has never caused me to crash and I don’t recall there being any code that COULD crash the server, so I really doubt it was my code.

We have purchased out a medium size gaming community and expanded our networks. The servers already had these files on there. I am not sure where the files came from, but I will attempt to update the files. Any other suggestions?

replace the respective functions with this:

[lua]
local function AddClient(fil)
if SERVER then AddCSLuaFile(’…/’ … fil) end
if CLIENT then include(’…/’ … fil) end
end

local function AddServer(fil)
if SERVER then include(’…/’ … fil) end
end

local function AddShared(fil)
include(’…/’ … fil)
AddCSLuaFile(’…/’ …fil)
end
[/lua]

And it should work.