kyleflow 35 Report post Posted June 22, 2023 Hi guys, I've finally found a gameserver.exe that would make the code from the forum for crystals by mobs extension. For that I attached a gameserver.exe that already added by LuaSQL.dll in the link provided for 1.36 or 1.38 server files. https://drive.google.com/drive/folders/1KHu1Txlj1thwgbiUtiBEwYPFlgR2aBti?usp=sharing Moving on to the question, this is the coding for crystal by mobs from the forum. print("* Loading CrystalByMob Extension <init.lua>") --[[ IGS Crystal By Mob Extension made By Vasil pkoDev,Please do not claim or redistribute the credits :) *Requirements: -LuaSQL by Wrexor -TradeServer Program -TradeDB -SQL 2008 or higher *Configuration: I guess the example i gave is clear Just if you're going to use .\SQLEXPRESS , make it x2 dashes otherwise it will be as .SQLEXPRESS e.g : .\\SQLEXPRESS Just change the map that the function will run inside and the monster ID that will give the IGSP If encountering any bug or flaw or glitch,please contact me - Vasil --]] SQLConnector = {}; SQLConnector.sql = { host = "127.0.0.1\\SQLEXPRESS", user = "sa", pass = "Y87dc#$98", db = "TradeDB" }; CrystalByMobHook = GetExp_PKM GetExp_PKM = function( dead , atk , money ) CrystalByMobHook(dead,atk, money) local DeadMonster = GetChaID(dead) local accountName = GetActName(atk) local Money = Money local Rum = { }; Rum['Money'] = Money; if(GetChaMapName(atk) == "garner" or GetChaMapName(atk) == "crystal") then if(DeadMonster == 1526)then QueryAsync( SQLConnector.sql['host'], SQLConnector.sql['user'], SQLConnector.sql['pass'], "UPDATE "..SQLConnector.sql['db']..".dbo.AccountInfo SET Money = Money + 1 WHERE accName = '"..accountName.."'" ); BickerNotice( atk, "[IGSP]:You have obtained 1 IGS Crystal from "..GetChaDefaultName(dead) ) end end end Based on the coding, this bit does not declared the 'crystal' when checking for MapName. if(GetChaMapName(atk) == "garner" or GetChaMapName(atk) == "crystal") then So, how do I made that crystal stored all the maps name that I desired so that I don't have individually put the map name. I searched the example on internet but still unable to understand it well and when tested on the files, it did not detected the map name stored. Hope community can response about this. Thanks Quote Share this post Link to post Share on other sites
champ 147 Report post Posted June 22, 2023 If you want to apply this to all map, then you can simply remove this condition. Additionally, unrelated to your question, you’re not checking if “QueryAsync” call was successful before showing BickerNotice, so basically if the call did not go through for whatever reason, the user will still see a message saying they’ve received the crystals. Quote Share this post Link to post Share on other sites
kyleflow 35 Report post Posted June 22, 2023 1 hour ago, champ said: If you want to apply this to all map, then you can simply remove this condition. Additionally, unrelated to your question, you’re not checking if “QueryAsync” call was successful before showing BickerNotice, so basically if the call did not go through for whatever reason, the user will still see a message saying they’ve received the crystals. Why did I not see it that perspective before. Simply remove the conditions and it still should work right. Thanks a lot mate. But for learning purpose. Is there a way to make that map check works. Quote Share this post Link to post Share on other sites
champ 147 Report post Posted June 23, 2023 You can, I’ve not done any Lua code in top in a while, but you can create an array of all your maps that you want to alow and then loop through it in your code. Quote Share this post Link to post Share on other sites
Rogue 19 Report post Posted June 25, 2023 On 6/23/2023 at 10:11 PM, champ said: You can, I’ve not done any Lua code in top in a while, but you can create an array of all your maps that you want to alow and then loop through it in your code. Or without any loops: print("* Loading CrystalByMob Extension <init.lua>") --[[ IGS Crystal By Mob Extension made By Vasil pkoDev,Please do not claim or redistribute the credits :) *Requirements: -LuaSQL by Wrexor -TradeServer Program -TradeDB -SQL 2008 or higher *Configuration: I guess the example i gave is clear Just if you're going to use .\SQLEXPRESS , make it x2 dashes otherwise it will be as .SQLEXPRESS e.g : .\\SQLEXPRESS Just change the map that the function will run inside and the monster ID that will give the IGSP If encountering any bug or flaw or glitch,please contact me - Vasil --]] SQLConnector = {}; SQLConnector.sql = { host = "127.0.0.1\\SQLEXPRESS", user = "sa", pass = "Y87dc#$98", db = "TradeDB" }; CrystalByMobHook = GetExp_PKM local maps = { garner = true, crystal = true } GetExp_PKM = function( dead , atk , money ) CrystalByMobHook(dead,atk, money) local DeadMonster = GetChaID(dead) local accountName = GetActName(atk) local currentMap = GetChaMapName(atk) if maps[currentMap] then if DeadMonster == 1526 then QueryAsync( SQLConnector.sql['host'], SQLConnector.sql['user'], SQLConnector.sql['pass'], "UPDATE "..SQLConnector.sql['db']..".dbo.AccountInfo SET Money = Money + 1 WHERE accName = '"..accountName.."'" ); BickerNotice( atk, "[IGSP]: You have obtained 1 IGS Crystal from "..GetChaDefaultName(dead) ) end end end 2 Quote Share this post Link to post Share on other sites
Masuka00 54 Report post Posted March 12 (edited) It didn't work for me Edited March 12 by Masuka00 Quote ǤØĐ βŁ€ŞŞ ƤƗŘΔĆ¥ Share this post Link to post Share on other sites