Ximboliex 85 Report post Posted June 19, 2017 (edited) function GetGuildID2(Player) local Name = GetChaDefaultName(Player) local String = "SELECT guild_id FROM GameDB.dbo.character WHERE cha_name = '"..Name.."'" local Connect, ConnectID = LuaSQL("connect", SQL.GameDB.Host, SQL.GameDB.User, SQL.GameDB.Password) if Connect == SQL_SUCCESS_WITH_INFO then local Success, Query = LuaSQL("query", ConnectID, String) if Success == SQL_SUCCESS_WITH_INFO then local Data = LuaSQL("fetch", ConnectID, Query) LuaSQL("freehandle", ConnectID, Query) LuaSQL("close", ConnectID) return Data["guild_id"] end end end function GuildLeaderID(Player) local Guild_ID = GetGuildID2(Player) local String = "SELECT leader_id FROM GameDB.dbo.guild WHERE name = '"..GuildID.."'" local Connect, ConnectID = LuaSQL("connect", SQL.AccServer.Host, SQL.AccServer.User, SQL.AccServer.Password) if Connect == SQL_SUCCESS_WITH_INFO then local Success, Query = LuaSQL("query", ConnectID, String) if Success == SQL_SUCCESS_WITH_INFO then local Data = LuaSQL("fetch", ConnectID, Query) LuaSQL("freehandle", ConnectID, Query) LuaSQL("close", ConnectID) return Data["leader_id"] end end end function GetChaGuildLeaderID(Player) local leader = GetLeaderID(Player) local cha_id = GetChaID(Player) if leader == cha_id then return 1 else LG("LuaSqlErr", "GetLeaderID Failed", "\n") return 0 end end **UPTADE** Edited June 19, 2017 by Ximboliex 2 Quote Share this post Link to post Share on other sites
iZae 55 Report post Posted June 19, 2017 I'm lost, is this a question or a release? haha Quote Share this post Link to post Share on other sites
Ximboliex 85 Report post Posted June 19, 2017 Release Quote Share this post Link to post Share on other sites
Simon 76 Report post Posted June 19, 2017 36 minutes ago, Ximboliex said: Release You posted it on QnA section. Quote Share this post Link to post Share on other sites
V3ct0r 2,117 Report post Posted June 19, 2017 Thank you @Ximboliex for useful release! The topic has been moved to Server Releases section. 1 Quote Some useful links / Полезные ссылки Tips for making a topic in 'Questions & Help' / Рекомендации по созданию тем в разделе "Помощь" Server Advertising Section Rules / Правила раздела "Реклама серверов" Available e-mail domains for registration / Допустимые e-mail домены для регистрации User groups / Группы пользователей User ranks / Звания пользователей "Broken" pictures on the forum / "Битые" изображения на форуме Beware of scammers! / Осторожно, мошенники! My developments / Мои разработки Mods for client and server / Моды для клиента и сервера PKOdev.NET website for Tales of Pirates Server / PKOdev.NET веб-обвязка для сервера Пиратии I do not provide any help in private messages and outside the forum. Use 'Questions & Help' section please. Thank you for understanding! Я не оказываю какую-либо помощь в личных сообщениях и вне форума. Пожалуйста, используйте раздел "Пиратия: Помощь". Благодарю за понимание! Share this post Link to post Share on other sites
Riizq 7 Report post Posted June 19, 2017 Please guide us senpai, on how to use this. For newbies like me, have no idea what to do. Quote Share this post Link to post Share on other sites
iZae 55 Report post Posted June 19, 2017 (edited) 19 minutes ago, Riizq said: Please guide us senpai, on how to use this. For newbies like me, have no idea what to do. Make sure you have LuaSql dll set on your files, and inside functions.lua set the value of the following variables: SQL.GameDB.Host, SQL.GameDB.User, SQL.GameDB.Password, SQL.AccServer.Host, SQL.AccServer.User, SQL.AccServer.Password and paste the script ximboliex released Then just call the functions: GetGuildID2(Player) will return the GUILD ID of a player and function GetChaGuildLeader(Player) will return the id of the leader of that guild Edited June 19, 2017 by iZae typo 2 Quote Share this post Link to post Share on other sites
Simon 76 Report post Posted June 19, 2017 I believe Wrexor released before in discord LUASQL V2.0 which registers every function without the person intervention and works way much better than the ones released by Xeon here. Quote Share this post Link to post Share on other sites
Ximboliex 85 Report post Posted June 19, 2017 (edited) --UPDATE POST-- Edited June 19, 2017 by Ximboliex Quote Share this post Link to post Share on other sites
Wrexor 61 Report post Posted June 19, 2017 3 hours ago, Sk3let0n said: I believe Wrexor released before in discord LUASQL V2.0 which registers every function without the person intervention and works way much better than the ones released by Xeon here. Quote Share this post Link to post Share on other sites
mkhzaleh 131 Report post Posted March 6, 2019 (edited) hey !~ you can use this only tho ------------ get guild leader id -- function GuildLeaderID(Player) local Guild_ID = GetChaGuildID(Player) local String = "SELECT leader_id FROM GameDB.dbo.guild WHERE guild_id = '"..Guild_ID.."'" local Connect, ConnectID = LuaSQL("connect", SQL.GameDB.Host, SQL.GameDB.User, SQL.GameDB.Password) if Connect == SQL_SUCCESS_WITH_INFO then local Success, Query = LuaSQL("query", ConnectID, String) if Success == SQL_SUCCESS_WITH_INFO then local Data = LuaSQL("fetch", ConnectID, Query) LuaSQL("freehandle", ConnectID, Query) LuaSQL("close", ConnectID) return Data["leader_id"] end end end -- example -- function getgleaderids(player) local leaderid = GuildLeaderID(player) local guildid = GetChaGuildID(player) local guildname = GetGuildName(guildid) Notice("Guild id["..guildid..'] Guild Name['..guildname..'] leader is['..leaderid.."]") end Edited March 6, 2019 by mkhzaleh 1 Quote Share this post Link to post Share on other sites