• 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!

CreatureEvent [War System] Who are your enemies onLogin

sorry double post, is possible help me?

so that when the war ends frags are erased and the message of guild war.
 
try
Code:
local guild, enemy, guildFrags, enemyFrags = getPlayerGuildId(cid)
local fightingGuilds = {}
local tmp = db.getResult("SELECT `guild_id`, `enemy_id`, `guild_kills`, `enemy_kills`, `frags` FROM `guild_wars` WHERE `guild_id` = "..guild.." OR `enemy_id` = "..guild.." AND `status` = 1;")
if tmp:getID() ~= -1 then
	i = 1
	repeat
		if tmp:getDataInt("guild_id") == guild then
			enemy = tmp:getDataInt("enemy_id")
			guildFrags = tmp:getDataInt("guild_kills")
			enemyFrags = tmp:getDataInt("enemy_kills")
		else
			enemy = tmp:getDataInt("guild_id")
			guildFrags = tmp:getDataInt("enemy_kills")
			enemyFrags = tmp:getDataInt("guild_kills")
		end
		local enemyName, _tmp = "", db.getResult("SELECT `name` FROM `guilds` WHERE `id` = " .. enemy)
		if(_tmp:getID() ~= -1) then
			enemyName = _tmp:getDataString("name")
			_tmp:free()
 
		end
 
		fightingGuilds[i] = {}
		fightingGuilds[i].name = enemyName
		fightingGuilds[i].guildFrags = guildFrags
		fightingGuilds[i].enemyFrags = enemyFrags
		fightingGuilds[i].limit = tmp:getDataInt("frags")
 
		i = i + 1
	until not(tmp:next())
	tmp:free()
 
	table.sort(fightingGuilds, function (a, b)
		return (a.name < b.name)
	end)
 
	local warString
 
	for k, v in pairs(fightingGuilds) do
		[B][COLOR="#FF0000"]if  (v.guildFrags == v.limit  or v.enemyFrags == v.limit ) then 
			warString = ""
			break
		end[/COLOR][/B]
		if not warString then
			warString = "Your guild is currently in war with the " .. v.name .. " (" .. v.guildFrags .. ":" .. v.enemyFrags .. " frags, limit ".. v.limit ..")"
		else
			warString = warString .. " and with the " .. v.name .. " (" .. v.guildFrags .. ":" .. v.enemyFrags.." frags, limit ".. v.limit .. ")"
		end
	end
	
	[B][COLOR="#FF0000"]if (warString ~= "") then 
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, warString .. ".")
	end[/COLOR][/B]
end
 
I will try it out when Im at home later. I'll update this post if it's working or not. :)
 
I tested with 3 different guilds. Each of them were in war against eachother. So a total of 3 wars.

The winning guild just showed that they were in battle with one guild so that's a improvement! But the guild who lost had 2 guild wars but when losing both disappear.
 
Last edited:
Back
Top