• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Error with who are enemies on login (necroots fix)....

Xeikh

詠春 ☯
Joined
Oct 23, 2009
Messages
724
Reaction score
17
http://otland.net/f82/war-system-who-your-enemies-onlogin-fixed-necroots-146901/


Hello, im using that system but i have this error:



data/creaturescripts/scripts/onWar.lua:3: attempt to concatenate local 'guild' (a boolean value)

heres my script:

LUA:
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
		if (v.guildFrags < v.limit and v.enemyFrags < v.limit) then
			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
	end
 
	if (warString ~= "") then 
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, warString .. ".")
	end
end

Can please someone help me? :3
 
Last edited:
LUA:
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 `status` = 1 and (`guild_id` = "..getPlayerGuildId(cid).." or  `enemy_id` = "..getPlayerGuildId(cid).. ")  ;")
warString = ""
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)
 
 
 
	for k, v in pairs(fightingGuilds) do
 
		if (v.guildFrags  < v.limit and v.enemyFrags < v.limit  ) then
			if (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
	end
 
end
 
if (warString ~= "") then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, warString .. ".")
end
 
login.lua ... Im going to check it o:

there's nothing about layouts, etc... the problem is with the layout... :/
looks like it need pedestal or dont works.. ¬¬
 
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 `status` = 1 and (`guild_id` = "..getPlayerGuildId(cid).." or `enemy_id` = "..getPlayerGuildId(cid).. ") ;")
warString = ""
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 = {}
fightingGuilds.name = enemyName
fightingGuilds.guildFrags = guildFrags
fightingGuilds.enemyFrags = enemyFrags
fightingGuilds.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)



for k, v in pairs(fightingGuilds) do

if (v.guildFrags < v.limit and v.enemyFrags < v.limit ) then
if (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
end

end

if (warString ~= "") then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, warString .. ".")
end


This work nice in my server.
 
Back
Top