Goddino 2 Posted May 13, 2021 Share Posted May 13, 2021 Hi community! I decided to write this topic because a friend of mine contacted me a little while ago informing me of a recently discovered bug with won that affects several private servers If you write "1.999" in the section "Won -> Yang" you will receive 199kk, about the double of its real value On my server the problem would have been much bigger as the won is worth 1kkk I'll post a hotfix that I did on the fly and it worked: Go to the server, in the quest path, open the won.lua quest Look for the following statement: local amount = input() is located in the first lines of the quest, under this instruction add the following: if string.find(amount, ".") then syschat("No punctuation marks allowed") return end Code translation: Check if there is a period in the string that the user entered (the player in our case) If the dot is present, end the quest by printing the message "No punctuation marks allowed" The bug could be fixed in many ways even more effective than this, but for something "on the fly" I give you this hotfix 2 Link to comment Share on other sites More sharing options...
Contributor MrQuin 6469 Posted May 13, 2021 Contributor Share Posted May 13, 2021 (edited) tonumber Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal 1 1 My only accounts are here and on M2D, Don't trust anyone else from other shitty sites. Link to comment Share on other sites More sharing options...
PetePeter 36 Posted May 13, 2021 Share Posted May 13, 2021 (edited) 1 hour ago, MrQuin said: tonumber tonumber will not remove the dot as it's a correct number (Even if it's a float) Edit: Use math.floor instead math.floor(4.1)) -> 4 math.floor(3.8)`) -> 3 Edited August 25, 2022 by Metin2 Dev Core X - External 2 Internal 2 Link to comment Share on other sites More sharing options...
Braxy 625 Posted May 13, 2021 Share Posted May 13, 2021 local inputPrice = tonumber(string.gsub(input(), "[^0-9]", "")) local realPrice = math.floor(inputPrice) There is no logic explanation for the math.floor since you only let people write numbers but you can let that be there just in case. As long as I'll be a threat for you , i will always be your target :3 Link to comment Share on other sites More sharing options...
Guest Anonymous Posted October 5, 2021 Share Posted October 5, 2021 On 5/13/2021 at 11:02 AM, Goddino said: Hi community! I decided to write this topic because a friend of mine contacted me a little while ago informing me of a recently discovered bug with won that affects several private servers If you write "1.999" in the section "Won -> Yang" you will receive 199kk, about the double of its real value On my server the problem would have been much bigger as the won is worth 1kkk I'll post a hotfix that I did on the fly and it worked: Go to the server, in the quest path, open the won.lua quest Look for the following statement: local amount = input() is located in the first lines of the quest, under this instruction add the following: if string.find(amount, ".") then syschat("No punctuation marks allowed") return end Code translation: Check if there is a period in the string that the user entered (the player in our case) If the dot is present, end the quest by printing the message "No punctuation marks allowed" The bug could be fixed in many ways even more effective than this, but for something "on the fly" I give you this hotfix This does not work as intended. Link to comment Share on other sites More sharing options...
Premium Speachless 766 Posted October 7, 2021 Premium Share Posted October 7, 2021 This is a copy paste message from stack. "If it's okay to accept a string that contains a number, tonumber(foo) will work, and will actually convert it to a "number" value internally. But if you need to know whether Lua considers it an actual number or not, rather than a string, use 'number' == type(foo) in your test conditions." Link to comment Share on other sites More sharing options...
Active Member Draveniou1 721 Posted October 7, 2021 Active Member Share Posted October 7, 2021 To make it complete, first download files that have this system and look for the files you downloaded and see ,,,, I always do this when I have a problem with a system Link to comment Share on other sites More sharing options...
Recommended Posts