syxx1337 Posted January 24, 2018 Posted January 24, 2018 Hello! So, I want to put +1 month from now to the mysql data but it's just insert current date (2018.01.24).. why?! date = string.format("%04d.%02d.%02d", time.year + 1900, time.month + 10, time.monthday ) dbExec(connection, "UPDATE Identity SET expires=? WHERE value = ?", date,itemValue)
DRW Posted January 24, 2018 Posted January 24, 2018 (edited) 3 hours ago, syxx1337 said: Hello! So, I want to put +1 month from now to the mysql data but it's just insert current date (2018.01.24).. why?! date = string.format("%04d.%02d.%02d", time.year + 1900, time.month + 10, time.monthday ) dbExec(connection, "UPDATE Identity SET expires=? WHERE value = ?", date,itemValue) Because the month range is 0-11 (It does not count months like that, it calculates months passed since January, so from January to February a month passes, then February is 1, from January to December, 11 months pass, so December is 11). Your script actually works since the month 1 is February. Edited January 24, 2018 by MadnessReloaded Proud owner and developer of ZNEXT: Aftermath. Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience. Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. Español, Pусский, Türk, عربى, Polski, Português IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB
syxx1337 Posted January 24, 2018 Author Posted January 24, 2018 7 hours ago, MadnessReloaded said: Because the month range is 0-11 (It does not count months like that, it calculates months passed since January, so from January to February a month passes, then February is 1, from January to December, 11 months pass, so December is 11). Your script actually works since the month 1 is February. Thanks for your reply, but then how can I add +1 month from now?
DRW Posted January 24, 2018 Posted January 24, 2018 Just now, syxx1337 said: Thanks for your reply, but then how can I add +1 month from now? Month + 1 Proud owner and developer of ZNEXT: Aftermath. Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience. Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. Español, Pусский, Türk, عربى, Polski, Português IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB
kieran Posted January 24, 2018 Posted January 24, 2018 (edited) See where you have time.month Add this bit of code where you want to add +1 time.month = (tonumber(time.month)) + 1 --This should do time.month = the month converted to a number plus one Edited January 24, 2018 by kieran
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now