Xeon 67 Report post Posted June 6, 2016 @Wrexor asked me to release this, since somehow it seems like somebody got there hands on it, so it cant be sold. First off you need to compile this DLL in Visual Studio 2015, Download CFF Explorer Suite, Open your gameserver in CFF Explorer. Goto import adder Click "Modules -> Add" Locate the .dll Under exported functions click on "?ExportedFunction@@Y" , Click import by name. uncheck "Rebuild with OFTs" Click "Rebuild import table" Then save file. .DLL / Source code credits to @Wrexor LuaSql.rar 12 1 Quote Share this post Link to post Share on other sites
Jelly 0 Report post Posted June 11, 2016 when u do that how to use it? Quote Share this post Link to post Share on other sites
V3ct0r 2,117 Report post Posted July 8, 2016 @Xeon, @Wrexor Hello! Do you can write a small guide how to compile it and what functions we can use in server LUA? With examples 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
Vasil 71 Report post Posted July 8, 2016 Just now, V3ct0r said: @Xeon, @Wrexor Hello! Do you can write a small guide how to compile it and what functions we can use in server LUA? With examples Isn't is with CFF Explorer? Quote Share this post Link to post Share on other sites
Wrexor 61 Report post Posted July 8, 2016 3 hours ago, Dimitrov said: Isn't is with CFF Explorer? Thats only for adding DLL to gameserver, still have to register new functions. Quote Share this post Link to post Share on other sites
Verax 7 Report post Posted July 14, 2016 I love you Xeon Quote Share this post Link to post Share on other sites
MonkeyCode 453 Report post Posted July 15, 2016 On 7/8/2016 at 5:30 AM, V3ct0r said: @Xeon, @Wrexor Hello! Do you can write a small guide how to compile it and what functions we can use in server LUA? With examples For documentation: LUA_ARG_ERROR = 10 SQL_SUCCESS = 0 SQL_SUCCESS_WITH_INFO = 1 SQL_ERROR = -1 SQL_INVALID_HANDLE = -2 SQL_NO_DATA = 100 ************************************************************************************************** connect function Summary: Establishes connection to SQL Server driver. Syntax: LuaSql("connect", host, username, password) Arguments: host - SQL Server address username - SQL Server username password - SQL Server password Returns: 1 on success, 0 on failure, connection handle id on success else LUA_ARG_ERROR, SQL_ERROR, or SQL_INVALID_HANDLE. ************************************************************************************************** query function Summary: Submits SQL statement Syntax: LuaSql("query", connHandleId, query) Arguments: connHandleId - Connection handle id. query - Query string Returns: 1 on success, 0 on failure, statement handle id on success else LUA_ARG_ERROR, SQL_ERROR, or SQL_INVALID_HANDLE. ************************************************************************************************** fetch function Summary: Fetches the next rowset of data from the result set and returns data for all columns. Syntax: LuaSql("fetch", connHandleId, stmtHandleId) Arguments: connHandleId - Connection handle id. stmtHandleId - Statement handle id. Returns: rowset on success else LUA_ARG_ERROR, SQL_NO_DATA, SQL_ERROR, or SQL_INVALID_HANDLE. ************************************************************************************************** freehandle function Summary: Frees resources associated with a specific statement handle. Syntax: LuaSql("freehandle", connHandleId, stmtHandleId) Arguments: connHandleId - Connection handle id. stmtHandleId - Statement handle id. Returns: LUA_ARG_ERROR, SQL_SUCCESS, SQL_ERROR, or SQL_INVALID_HANDLE. ************************************************************************************************** close function Summary: Closes the connection and frees resources associated with a specific connection handle Syntax: LuaSql("close", handleId) Arguments: handleId - Connection handle id. Returns: LUA_ARG_ERROR, SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE. ************************************************************************************************** QueryAsyn Summary: Executes query asynchrounously Syntax: QueryAsyn(host, user, pass, query) Arguments: host - SQL Server address username - SQL Server username password - SQL Server password query - Query string ************************************************************************************************** 1 Quote Share this post Link to post Share on other sites
GustavoHMA 15 Report post Posted July 15, 2016 (edited) 1) If you do not use the MSSQL 2000 when inserting the host using double backslashes. Example: local host = 'PCNAME-PC\\SQLEXPRESS' 2) The paths of LuaSQL and ExecuteQueryAsync functions are not sufficient to add the functions to be performed on Lua files. PushPatch(&LuaSql, (PBYTE)0x5A5FD2); PushPatch(&ExecuteQueryAsync, (PBYTE)0x5A5EFE); Edited July 15, 2016 by GustavoHMA Quote Share this post Link to post Share on other sites
Vasil 71 Report post Posted August 28, 2016 Love you Xeon dis is so cool . Quote Share this post Link to post Share on other sites
Guest Report post Posted August 28, 2016 1 hour ago, Vasil said: Love you Xeon dis is so cool . Was made by Wrexor in case you didn't know, Xeon has only released it. Quote Share this post Link to post Share on other sites
Vasil 71 Report post Posted August 28, 2016 Ik XD. Ok i love you too Wrexor Quote Share this post Link to post Share on other sites
Masuka00 54 Report post Posted October 12, 2016 (edited) I got this error And if i add the missing file i get this I am using Windows Server 2012 R2, do i need to install a extra files? Edited October 12, 2016 by Covadola 1 Quote ǤØĐ βŁ€ŞŞ ƤƗŘΔĆ¥ Share this post Link to post Share on other sites
Wrexor 61 Report post Posted October 12, 2016 26 minutes ago, Covadola said: I got this error And if i add the missing file i get this I am using Windows Server 2012 R2, do i need to install a extra files? Ill upload new version which will include that file later today. 3 Quote Share this post Link to post Share on other sites
Wrexor 61 Report post Posted October 12, 2016 In link below there is an updated version of LuaSQL which should include all required files and its also registering lua functions automatically so after you compile or just copy already compiled dll just follow attaching guide in the first post on this topic. If you want to compile yourself be sure to select correct configuration depending on your server version, currently only 1.36 and 1.38 are supported. If someone wants a different version send me a pm. https://www.dropbox.com/s/3byhodvw2z26ef8/LuaSQL2.rar?dl=0 5 Quote Share this post Link to post Share on other sites
Giampy 2 Report post Posted October 12, 2016 1 hour ago, Wrexor said: In link below there is an updated version of LuaSQL which should include all required files and its also registering lua functions automatically so after you compile or just copy already compiled dll just follow attaching guide in the first post on this topic. If you want to compile yourself be sure to select correct configuration depending on your server version, currently only 1.36 and 1.38 are supported. If someone wants a different version send me a pm. https://www.dropbox.com/s/3byhodvw2z26ef8/LuaSQL2.rar?dl=0 I think could be a nice idea release it for all existing server versions (1.x - 2.x) Quote Share this post Link to post Share on other sites
Wrexor 61 Report post Posted October 12, 2016 11 minutes ago, Giampy said: I think could be a nice idea release it for all existing server versions (1.x - 2.x) I would do that but problem is that every gameserver has functions at a different location and I have to manually find them. If someone wants this to work on gameserver which currently isnt supported he can send me his gameserver.exe and I will add it. 1 Quote Share this post Link to post Share on other sites
Angelix 374 Report post Posted January 17, 2017 On 10/12/2016 at 2:35 PM, Wrexor said: I would do that but problem is that every gameserver has functions at a different location and I have to manually find them. If someone wants this to work on gameserver which currently isnt supported he can send me his gameserver.exe and I will add it. Can you update this to work on a v2.x GameServer? If so, I can send you my GS via PM. Quote Share this post Link to post Share on other sites
Wrexor 61 Report post Posted January 17, 2017 6 hours ago, Angelix said: Can you update this to work on a v2.x GameServer? If so, I can send you my GS via PM. I already updated it but there is a problem with v2.x gameservers. I have to edit your gameserver to load dll in a different way. Upload it so I can edit it. Quote Share this post Link to post Share on other sites
Angelix 374 Report post Posted January 17, 2017 41 minutes ago, Wrexor said: I already updated it but there is a problem with v2.x gameservers. I have to edit your gameserver to load dll in a different way. Upload it so I can edit it. Here is my GS, thanks! https://www.dropbox.com/s/6wo366g0e4ppu7g/GameServer.rar?dl=0 Quote Share this post Link to post Share on other sites
Wrexor 61 Report post Posted January 17, 2017 1 hour ago, Angelix said: Here is my GS, thanks! https://www.dropbox.com/s/6wo366g0e4ppu7g/GameServer.rar?dl=0 Try this https://www.dropbox.com/s/skxjjewuldf87if/angelix.zip?dl=0 1 Quote Share this post Link to post Share on other sites
Angelix 374 Report post Posted January 17, 2017 13 hours ago, Wrexor said: Try this https://www.dropbox.com/s/skxjjewuldf87if/angelix.zip?dl=0 Seems to work fine, thanks! The DLL shows up when loading GS and I was able to do this: function CheckConnection() if LuaSQL("connect", SQL.GameDB.Host, SQL.GameDB.User, SQL.GameDB.Password) == 1 then print("Connection successful!") else print("Connection failed!") end end CheckConnection() The result is a successful connection! Now I have to learn a bit of SQL, haha. Quote Share this post Link to post Share on other sites
Angelix 374 Report post Posted January 17, 2017 Quick question: How would I go on about getting an account ID based on a player's name? I would have to use the "LuaSQL("fetch", connection, statement)", but how do I use that? Quote Share this post Link to post Share on other sites
Wrexor 61 Report post Posted January 18, 2017 11 hours ago, Angelix said: Quick question: How would I go on about getting an account ID based on a player's name? I would have to use the "LuaSQL("fetch", connection, statement)", but how do I use that? First you have to make a connection to the SQL Server. LuaSQL will return 2 values when connecting, first value is true/false which depends if connection was successful or not, second value is handle id on successful connection or error number if it was unsuccessful. success, handle = LuaSQL("connect", host, username, password) If connection succeeded then you can query the SQL Server. First argument is handle returned when connecting to SQL Server, second arguments is the SQL Query which would in your case be "SELECT act_id FROM character WHERE cha_name = '" . player_name . "'". Again you get 2 returns values which are similar to previous return values, first indicates success/failure, second is handle id on success and error number on failure. success, query = LuaSQL("query", handle, query) If query succeded you can fetch data. First argument is connection handle id returned when connecting to SQL Server, second argument is query handle id returned when executing query. Here you only get 1 return value which is type 'table' if command succeded otherwise it's type 'number' which corresponds to error number. data = LuaSQL("fetch", handle, query) If everything went ok you should be able to see account ID in data variable. After this you should also free query handle by calling LuaSQL with "freehandle" argument. success = LuaSql("freehandle", handle, query) You can find other information in post by @KONG here. Quote Share this post Link to post Share on other sites
Angelix 374 Report post Posted January 19, 2017 (edited) @Wrexor that helped a lot! I didn't quite understand KONG's explanation and I though the functions only returned one value, that's where I was wrong since I didn't quite get the return of two values. Now with that and your help, I was able to get my account name. function GetAccountName() print("--------------------------------------------------") local String = "SELECT act_name FROM GameDB.dbo.account WHERE act_id IN (SELECT act_id FROM GameDB.dbo.character WHERE cha_name = 'Angelix')" local Connect, ConnectID = LuaSQL("connect", SQL.GameDB.Host, SQL.GameDB.User, SQL.GameDB.Password) if Connect == SQL_SUCCESS_WITH_INFO then print("Successful connection.") local Success, Query = LuaSQL("query", ConnectID, String) if Success == SQL_SUCCESS_WITH_INFO then print("Successful query.") local Data = LuaSQL("fetch", ConnectID, Query) print("Account Name = "..Data["act_name"]) LuaSQL("freehandle", ConnectID, Query) LuaSQL("close", ConnectID) return end end print("--------------------------------------------------") end GetAccountName() Which for testing purposes resulted this on GS console. Thanks a lot on both of you for the explanations and Vector since I got the query command from him on another thread since I have zero knowledge of SQL, hahah. Edited January 19, 2017 by Angelix Quote Share this post Link to post Share on other sites
Kraken 6 Report post Posted January 30, 2017 Help also with my gamserver.exe. pls https://ufile.io/82df6 Quote Share this post Link to post Share on other sites