Theogony Script

One of Nori’s unreleased scripts.
http://www.garrysmod.org/img/?t=dll&id=95414

Released by order of Nori.

Their are no mysql tables :frowning:

So make them, it’s not that hard.

Norimeku LOL

http://amscdn.btrll.com/production/759/eharmony300x250_2.gif


(User was banned for this post ("Spam" - Greeman))

Has anybody tested this out yet?

I got up to creating a character, but got this error when I clicked accept


theogony/gamemode/init.lua:63: bad argument #1 to 'oldescape' (string expected, got number)


Could be because of me not having tables. If anyone can create some that would be awesome.

His function for creating the tables by default was never started :<

Yeah I could to that stage aswell

Angreh, I don’t want a broked game mode…

Well in more seriousness. Even though Nori, kuromeku, and that other guy are great coders, Nori should not have left this unpolished. For this reason, people without in depth knowledge of MySql will be frustrated with the hassle. I KNOW this is a great game mode, but really? It doesn’t work without someone coming along and fixing it. FIX IT NORI, FIX IT NAO ;-;

Now if did that, that would make this useful for everyone. We wouldn’t want to do hat now would we. Then all of these random servers start popping up with this.

“There’s nothing wrong with this script, the only problem is that you don’t have the MySQL tables. This gamemode is 100% working.”

From Nori

I could probably make the tables if someone told me what needed to be done. ( what all tables are about I mean. )

[editline]03:12PM[/editline]

Also:


print("Starting Theo")
	print("Connecting to MySQL")
	theo.connect();
	
	print("Creating MySQL tables if they do not exist");
	theo.createmysqltables();
	

?


function theo.createmysqltables() -- yeah you guys are fucked.
	
	return; -- bla
	
end

He never did the function.

I see.

Yes you do ;3

It requires the (“tmysql”) Plugin
Code:
[lua]
tmysql.oldescape = tmysql.escape
function tmysql.escape(val)
if val == nil then
print(“TMYSQL ESCAPE GOT A NIL VALUE!”)
return nil
end
return tmysql.oldescape(val)
end

local sql_host = “localhost”
local sql_user = “root”
local sql_pass = “”
local sql_db = “”
local sql_port = 3306
local sql_conn = 1
local sql_threads = 1
[/lua]

Also
[lua]
local mats = file.Find("…/gamemodes/theogony/content/materials/factions/*");
for k,v in pairs(mats) do
resource.AddFile(“materials/factions/” … v);
end

function theo.createmysqltables() – yeah you guys are fucked.

return; -- bla

end

function theo.connect()
tmysql.initialize(sql_host,sql_user,sql_pass,sql_db,sql_port,sql_conn,sql_threads)
end

function theo.start()

print("Starting Theo")
print("Connecting to MySQL")
theo.connect();

print("Creating MySQL tables if they do not exist");
theo.createmysqltables();

local function ReceiveBasicConfig(res, stat, id)
	print("Loaded " .. #res .. " configuration values")
	theo.config = {}
	for k,v in pairs(res) do
		theo.config[v[1]] = v[2]
	end

	local function ReceiveFactionClass(res, stat, id)
		for k,v in pairs(res) do
			if v[3] == "1" then -- Faction/class is enabled.
				if v[2] == "1" then -- Faction
					AddCSLuaFile("theogony/gamemode/factions/"..v[1].."/client.lua")
					table.insert(theo.faction._load, v[1]);
				else
					AddCSLuaFile("theogony/gamemode/classes/"..v[1].."/client.lua")
					table.insert(theo.class._load, v[1]);
				end
			end
		end
		print("Got " .. #(theo.faction._load) .. " factions, " .. #(theo.class._load) .. " classes");
		
		local function ReceiveAdmins(res, stat, id)
			local new = {};
			for k,v in pairs(res) do -- Change table formatting
				new[v[1]] = string.Explode(",", v[2]);
			end
			
			theo.admin.admins = new;
			print("Loaded " .. table.Count(new) .. " admins.");
			
			local function ReceiveProperties(res, stat, id)
				theo.doors.ParseProperties(res);
				print("Loaded " .. #res .. " properties.");
				
				local function ReceiveDoors(res, stat, id)
					theo.doors.ParseDoors(res);
					print("Loaded " .. #res .. " doors.");
					
					local function ReceiveItems(res, stat, id)
						for k,v in pairs(res) do
							if v[2] == "1" then -- Item is enabled
								AddCSLuaFile("theogony/gamemode/items/"..v[1].."/client.lua");
								table.insert(theo.items._load, v[1]);
							end
						end
						print("Loaded " .. #res .. " items.");
						
						local function ReceiveTooltrust(res, stat, id)
							local new = {};
							print("Loaded " .. #res .. " tooltrust access entries");
							for k,v in pairs(res) do -- Change table formatting
								new[v[1]] = string.Explode(",", v[2]);
							end
							
							theo.ToolTrustAccess = new;
							-- Go to next step of init
							theo.faction.begin();
						end

						print("Loading tooltrust access..");
						tmysql.query("SELECT steamid, tools FROM tooltrust", ReceiveTooltrust, 2)
					end
					print("Loading items..");
					tmysql.query("SELECT * FROM items", ReceiveItems, 2);
				end
				print("Loading doors..");
				tmysql.query("SELECT * FROM doors WHERE `map`='" .. game.GetMap() .. "';", ReceiveDoors, 2);
			end
			print("Loading properties..");
			tmysql.query("SELECT * FROM properties WHERE `map`='" .. game.GetMap() .. "';", ReceiveProperties, 2);
			
		end
		print("Loading admins..");
		tmysql.query("SELECT * FROM admin", ReceiveAdmins, 2);
		
	end
	
	print("Loading faction and class list..");
	tmysql.query("SELECT * FROM factionclass", ReceiveFactionClass, 2);
end
print("Loading configuration..")
tmysql.query("SELECT * FROM config", ReceiveBasicConfig, 2)

end
[/lua]

You need to edit init.lua and you have to make the tables :slight_smile:

Good luck.

“Okay, basically everything in the gamemode is configured from the MySQL tables. Look through the different functions and see the data that it gets and then recreate the tables. The entire gamemode will not work until you get all the tables done, so it’s a little bit difficult but the tables aren’t complex at all.” -Nori

I’m interested in seeing this. I’m working on creating them. When I finish, I’ll release them if it’s okay.

Very okay, alot of people will love you for doing it.

If anything it keeps idiots from hosting a good gamemode.