[Error] CityRP

Hello, I got this error :frowning:


[ERROR] gamemodes/cityrp/gamemode/core/libraries/sh_plugin.lua:11: table index is nil
  1. register - gamemodes/cityrp/gamemode/core/libraries/sh_plugin.lua:11
   2. unknown - gamemodes/cityrp/gamemode/core/plugins/propsave/sv_init.lua:166
    3. include - [C]:-1
     4. unknown - gamemodes/cityrp/gamemode/sh_init.lua:131
      5. include - [C]:-1
       6. unknown - gamemodes/cityrp/gamemode/init.lua:21


Can someone help me?

Some usefull things:
sh_plugin:



cityrp.plugin = {};
cityrp.plugin.stored = {};

-- Register a new plugin.
function cityrp.plugin.register(plugin)
	cityrp.plugin.stored[plugin.name] = plugin;
end;

-- Call a function for all plugins.
function cityrp.plugin.call(name, ...)
	for k, v in pairs(cityrp.plugin.stored) do
		if (type(v[name]) == "function") then
			local success, message = pcall( v[name], unpack({...}) )
			
			-- Check to see if we did not success.
			if (!success) then Msg(message.."
"); end;
		end;
	end;
end;

-- Get a plugin by it's name.
function cityrp.plugin.get(name) return cityrp.plugin.stored[name]; end;


gamemodes/cityrp/gamemode/core/plugins/propsave/sv_init.lua:


local disabled = false;

if (disabled) then
	return;
end

--if(FLServer != "build") then
--	return;
--end

if(!file.Exists("cityrp/plugins/propsave/"..FLServer.."/", "DATA")) then
	file.CreateDir("cityrp/plugins/propsave/"..FLServer.."/")
end;

local PLUGIN = {};

-- Create a variable to store the plugin for the shared file.
PLUGIN_SHARED = PLUGIN
include("sh_init.lua")
AddCSLuaFile("sh_init.lua")

cityrp.propsave = {}
cityrp.propsave.proptable = {}

function cityrp.propsave.loadprops(player)
	local filename = string.gsub(player:SteamID(), ":", "_")..".txt";
	if file.Exists("cityrp/plugins/propsave/"..FLServer.."/"..filename, "DATA") then
		cityrp.propsave.proptable[player:SteamID()] = util.JSONToTable(file.Read("cityrp/plugins/propsave/"..FLServer.."/"..filename, "DATA"))
		if(cityrp.propsave.proptable[player:SteamID()] && #cityrp.propsave.proptable[player:SteamID()] > 0) then
			player:Notify("You have saved props, use /restoreprops to restore, this will get overridden if you spawn more props!")
		end;
	end;
end;
hook.Add("PlayerInitialized", "propsaveinit", cityrp.propsave.loadprops);
	
function cityrp.propsave.otherpropinarea(pos, player)
	local ent = ents.FindInSphere(pos, 10)
	local found = false
	for _, v in pairs(ent) do 
		if IsValid(v:GetNWEntity("OwnerObj")) and (v:GetNWEntity("OwnerObj") != player) then 
			found = true
		end
	end
end
			
function cityrp.propsave.restoreProps(player)
	if !cityrp.propsave.proptable[player:SteamID()] then 
		player:Notify("Sorry, no prop session has been found for you!", 1)
		return 
	elseif player.proprestored then 
		player:Notify("You have already restored your props!", 1)
		return
	else
		local props = cityrp.propsave.proptable[player:SteamID()]
		for _, v in pairs(props) do
			local model, pos, ang, color, material = v.model, v.pos, v.ang, v.color, v.material
			if !model || !pos || !ang then player:ChatPrint("Failed to spawn it!") return end
			if hook.Call("PlayerSpawnProp", GAMEMODE, player, v.model) then 
				if !cityrp.propsave.otherpropinarea(pos, player) then
					local tprop = ents.Create("prop_physics")
					tprop:SetModel(model)
					tprop:SetPos(pos)
					tprop:SetAngles(ang)
					
					if color then 
						tprop:SetColor(color)
					end
					
					if material then 
						tprop:SetMaterial(material)
					end
					tprop:Spawn()
					local tpropp = tprop:GetPhysicsObject()
					if IsValid(tpropp) then 
						tprop:GetPhysicsObject():EnableMotion(false)
						if (tprop:GetPhysicsObject():IsPenetrating()) then 
							tprop:SetCollisionGroup(COLLISION_GROUP_DEBRIS)
						end
					end
					
					SPropProtection.PlayerMakePropOwner(player, tprop)
					
					hook.Call("PlayerSpawnedProp", GAMEMODE, player, model, tprop)
					
				else
					player:Notify("There is another prop in the area of the prop attempting to spawn!", 1)
				end
			end
		end
		player:Notify("Successfully restored last prop session!")
		player.proprestored = true
	end
end

function cityrp.propsave.deleteProps(player)
	cityrp.propsave.proptable[player:SteamID()] = nil
	cityrp.propsave.writePropTable(player:SteamID())
	player:Notify("Successfully cleared prop sessions!")
end

function cityrp.propsave.saveProps(player, force)
	--if cityrp.propsave.proptable[player:SteamID()] and !force then
	--	player:Notify("You already have a prop session saved, use /clearprops to delete it.", 1)
	--	return
	--end
	local plypt = {};
	for _, v in pairs(ents.FindByClass("prop_physics")) do 
		if IsValid(v:GetNWEntity("OwnerObj")) and (v:GetNWEntity("OwnerObj") == player) then
			local pri = {}
			pri.model = v:GetModel()
			pri.pos = v:GetPos()
			pri.ang = v:GetAngles()
			pri.color = v:GetColor()
			pri.material = v:GetMaterial()
			table.insert(plypt, pri)
		end
	end
	if(#plypt > 0) then
		if(cityrp.propsave.proptable[player:SteamID()] != plypt) then
			cityrp.propsave.proptable[player:SteamID()] = plypt
			cityrp.propsave.writePropTable(player:SteamID())
			player:Notify("Prop session saved, "..#plypt.." props found!")
		end;
	else
		if(FLServer == "build") then
			player:Notify("Prop session not saved, No props found!")
		end;
	end;
end

timer.Create("cityrp_saveprops", 60 * 5, 0, function()
	for _,v in pairs(player.GetAll()) do 
		cityrp.propsave.saveProps(v, true)
	end
end)

function cityrp.propsave.writePropTable(steamid)
	local filename = string.gsub(steamid, ":", "_")..".txt";
	file.Write("cityrp/plugins/propsave/"..FLServer.."/"..filename, util.TableToJSON(cityrp.propsave.proptable[steamid]))
end

cityrp.command.add("saveprops", "b", 0, function(player)
	player._propsave_cooldown = player._propsave_cooldown or CurTime()
	if (player._propsave_cooldown > CurTime()) then 
		player:Notify("You need to wait another "..cityrp.formattime(player._propsave_cooldown - CurTime()).."(s) to save your props!", 1)
		return
	end
	cityrp.propsave.saveProps(player)
	player._propsave_cooldown = player._propsave_cooldown + 300
end, "commands", "", "Save your current spawned props.")

cityrp.command.add("restoreprops", "b", 0, function(player)
	cityrp.propsave.restoreProps(player)
end, "commands", "", "Restore props from your last session.")

cityrp.command.add("clearprops", "b", 0, function(player)
	cityrp.propsave.deleteProps(player)
end, "commands", "", "Deletes your last prop session.")
	
-- Register the plugin.
cityrp.plugin.register(PLUGIN);

gamemodes/cityrp/gamemode/sh_init.lua:123-131:



local disabledPlugins = {}
local _, fold = file.Find(GMFOLDER.."/gamemode/core/plugins/*", "LUA")
-- Loop through plugins and include them.
for k, v in pairs( fold ) do
	if (v != "." and v != "..") then
		if table.HasValue(disabledPlugins, string.lower(v)) then return end
		if (SERVER) then
			if ( file.Exists(GMFOLDER.."/gamemode/core/plugins/"..v.."/sv_init.lua", "LUA") ) then
				include("core/plugins/"..v.."/sv_init.lua");
			end;

gamemodes/cityrp/gamemode/init.lua:20-21:


-- Include the shared gamemode file.
include("sh_init.lua");

http://forum.facepunch.com/showthread.php?t=1546458

Not a good awnser.

He literally linked you the fixed gamemode you little shit, perhaps consider reading instead of mouthing off.

Merry Christmas.

That’s not even the same gamemode.

This.

I was saying to use it instead. There is not enough context in the code for us to aptly assist you with it.

Wait 1 min updating the topic with more information

[editline]25th December 2016[/editline]

Updated

The plugin defined in sv_init doesn’t have a name key. Really, I’m not sure what that plugin is for since it doesn’t actually get any information get sent in with it.

Deleted the plugin. Fixed the problem.
The plugin saved props when the server crashed.