Please follow the Support rules
#1. Use a clear yet descriptive title with your problem and keep it objective!
http://otland.net/f16/need-help-ask-properly-correctly-18402/
I will change the title for you this time.
Use this link for your problem.
http://otland.net/f132/guild-war-request-rep-28263/#post284667
function guildExists(guildId)
if(type(guildId) ~= 'number') then
return FALSE, error("luaGuildExists: number expected for 'guildId' (got " .. type(guildId) .. ")", 2)
end
local res = db.getResult("SELECT `id` FROM `guilds` WHERE `id` = " .. guildId)
if(res:getID() ~= LUA_ERROR) then
res:free()
return TRUE
end
return FALSE
end
function isGuildInWar(guildId)
if(guildExists(guildId) == TRUE) then
return FALSE
end
return FALSE
end
function getGuildIdByName(name)
if(type(name) ~= 'string') then
return FALSE, error("luaGetGuildIdByName: string expected for 'name' (got " .. type(name) .. ")", 2)
end
local res = db.getResult("SELECT `id` FROM `guilds` WHERE `name` = " .. db.escapeString(name))
if(res:getID() ~= LUA_ERROR) then
local id = res:getDataInt "id"
res:free()
return id
end
return FALSE
end
function getGuildLeaderRank(guildId)
if(guildExists(guildId) == FALSE) then
return FALSE
end
local res = db.getResult("SELECT `name` FROM `guild_ranks` WHERE `guild_id` = " .. guildId .. " ORDER BY level DESC LIMIT 1;")
local leaderId = res:getDataString "name"
res:free()
return leaderId
end
function getGuildWarId(guildId, status)
if(type(status) ~= 'number') then
return FALSE, error("luaGetGuildWarId: number expected for 'status' (got " .. type(status) .. ")", 2)
elseif(guildExists(guildId) == FALSE) then
return FALSE
end
local res = db.getResult("SELECT `war_id` FROM `guilds` WHERE `id` = " .. guildId .. ", `war_status` = " .. status)
if(res:getID() ~= LUA_ERROR) then
local warId = res:getDataInt "war_id"
res:free()
return warId
end
return FALSE
end
function setGuildWarId(guildId, warId, status)
if(type(status) ~= 'number') then
return FALSE, error("luaSetGuildWarId: number expected for 'status' (got " .. type(status) .. ")", 2)
elseif(guildExists(guildId) == FALSE or guildExists(warId) == FALSE) then
return FALSE
end
local res = db.executeQuery("UPDATE `guilds` SET `war_id` = " .. warId .. ", `war_status` = " .. status .. " WHERE `id` = " .. guildId)
return TRUE
end
function isInGuildWar(cid, player)
local guildId = getPlayerGuildId(cid)
if(guildId ~= FALSE) then
return FALSE
end
return FALSE
end
is your mistake.. "no such file or directory".
checks that the name of the file that one finds in the first folder (where the config.lua is) has the correct name (GuildWar.lua)
function guildExists(guildId)
if(type(guildId) ~= 'number') then
return FALSE, error("luaGuildExists: number expected for 'guildId' (got " .. type(guildId) .. ")", 2)
end
local res = db.getResult("SELECT `id` FROM `guilds` WHERE `id` = " .. guildId)
if(res:getID() ~= LUA_ERROR) then
res:free()
return TRUE
end
return FALSE
end
function isGuildInWar(guildId)
if(guildExists(guildId) == TRUE) then
return FALSE
end
return FALSE
end
function getGuildIdByName(name)
if(type(name) ~= 'string') then
return FALSE, error("luaGetGuildIdByName: string expected for 'name' (got " .. type(name) .. ")", 2)
end
local res = db.getResult("SELECT `id` FROM `guilds` WHERE `name` = " .. db.escapeString(name))
if(res:getID() ~= LUA_ERROR) then
local id = res:getDataInt "id"
res:free()
return id
end
return FALSE
end
function getGuildLeaderRank(guildId)
if(guildExists(guildId) == FALSE) then
return FALSE
end
local res = db.getResult("SELECT `name` FROM `guild_ranks` WHERE `guild_id` = " .. guildId .. " ORDER BY level DESC LIMIT 1;")
local leaderId = res:getDataString "name"
res:free()
return leaderId
end
function getGuildWarId(guildId, status)
if(type(status) ~= 'number') then
return FALSE, error("luaGetGuildWarId: number expected for 'status' (got " .. type(status) .. ")", 2)
elseif(guildExists(guildId) == FALSE) then
return FALSE
end
local res = db.getResult("SELECT `war_id` FROM `guilds` WHERE `id` = " .. guildId .. ", `war_status` = " .. status)
if(res:getID() ~= LUA_ERROR) then
local warId = res:getDataInt "war_id"
res:free()
return warId
end
return FALSE
end
function setGuildWarId(guildId, warId, status)
if(type(status) ~= 'number') then
return FALSE, error("luaSetGuildWarId: number expected for 'status' (got " .. type(status) .. ")", 2)
elseif(guildExists(guildId) == FALSE or guildExists(warId) == FALSE) then
return FALSE
end
local res = db.executeQuery("UPDATE `guilds` SET `war_id` = " .. warId .. ", `war_status` = " .. status .. " WHERE `id` = " .. guildId)
return TRUE
end
function isInGuildWar(cid, player)
local guildId = getPlayerGuildId(cid)
if(guildId ~= FALSE) then
return FALSE
end
return FALSE
end