• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Guild List

Xagul

deathzot.net
Joined
Jun 30, 2008
Messages
1,295
Solutions
3
Reaction score
1,041
Hello, thank you for taking a look at this request. I have been searching many forums and for some reason it seems as though no one has attempted making an in-game guild list. I think this would be a lot easier for players rather than having to open up a webpage to look up a guild. I was thinking something like this:

1. When saying !guilds you will see a list of all guild names on the server.

2. When saying !guilds guildname you will then see a member list for that guild.

The one concern that I have is the fact that It will have to be done with SQL Queries and I am concerned that once there are a large amount of guilds in the server using this command it might cause lag since its going to have to sort through a lot of guild/players. I would greatly appreciate any feedback concerning this problem and also if anyone would like to take a shot at creating this command it would be awesome.
 
TFS Crying Damson 0.4

I would imagine the base code would look something like this:
Code:
if param == "" then
	doShowTextDialog(cid, 2529, allguilds)
elseif param == "guildname" then
	doShowTextDialog(cid, 2529, guildmembers)
end

The only thing I am not sure how to do is get a list of all guilds and guild members for a specific guild name.
 
Last edited:
Code:
function onSay(cid, words, param, channel)
	if param == '' then
		local list = db.getResult("SELECT `name` FROM `guilds`;")
		if(list:getID() ~= -1) then
			local v = ''
			repeat
				v = v .. list:getDataString("name")  .. "\n"
			until not list:next()
			list:free()
			doShowTextDialog(cid, 2529, v)
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "There are no guilds on this server.")
		end
	else
		local id = getGuildId(param)
		if id then
			local list = db.getResult("SELECT `name` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = " .. id .. ");")
			if(list:getID() ~= -1) then
				local v = ''
				repeat
					v = v .. list:getDataString("name")  .. "\n"
				until not list:next()
				list:free()
				doShowTextDialog(cid, 2529, v)
			else
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "There are no players in this guild.")
			end
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This guild doesn't exist.")
		end
	end
	return true
end
 
Just wow :) absolutely amazing. I am going to try to get it to show:

Member Name [guild rank]

However I am so bad at sql queries so I might have to ask for your help again xD if you have the time. Thanks so much for this though I think many people will use it.


Edit:
I got it to show the rank ID but that only shows a number for obvious reasons and I cant quite figure out how to get it to show the rank "name" since the rank names are configurable in each individual guild.
 
Code:
function onSay(cid, words, param, channel)
	if param == '' then
		local list = db.getResult("SELECT `name` FROM `guilds`;")
		if(list:getID() ~= -1) then
			local v = ''
			repeat
				v = v .. list:getDataString("name")  .. "\n"
			until not list:next()
			list:free()
			doShowTextDialog(cid, 2529, v)
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "There are no guilds on this server.")
		end
	else
		local id = getGuildId(param)
		if id then
			local list = db.getResult("SELECT `name`, `rank_id` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = " .. id .. ");")
			if(list:getID() ~= -1) then
				local v = ''
				repeat
					local rank = db.getResult("SELECT `name` FROM `guild_ranks` WHERE `id` = " .. list:getDataInt("rank_id") .. " LIMIT 1;")
					v = v .. list:getDataString("name")  .. " [" .. rank:getDataString("name") .. "]\n"
					rank:free()
				until not list:next()
				list:free()
				doShowTextDialog(cid, 2529, v)
			else
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "There are no players in this guild.")
			end
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This guild doesn't exist.")
		end
	end
	return true
end
 
Amazing, thanks a ton :) I have already reped you for the first guild code so I will have to rep ya another time xD
 
Back
Top