fairyoggy Posted June 25, 2019 Share Posted June 25, 2019 I need to write a function. That would work just like with a standard id in internal.db I mean There is a window with a button and label And when the button is pressed in the label appears figure "0001" when you press the second time "0002" and so on up to 9999 When the number 9999 arrives, the countdown begins anew 0001 And all this should be saved. Can you help me? Link to comment
Moderators IIYAMA Posted July 2, 2019 Moderators Share Posted July 2, 2019 (edited) Have you considered using a XML file? If you are not using a database, but only something to generate id's for later use, XML would be the quickest to set-up something like that. https://wiki.multitheftauto.com/wiki/XmlCreateFile @slapz0r Edited July 2, 2019 by IIYAMA Link to comment
fairyoggy Posted July 2, 2019 Author Share Posted July 2, 2019 2 minutes ago, IIYAMA said: Have you considered using a XML file? If you are not using a database, but only something to generate id's for later use, XML would be the quickest to set-up something like that. https://wiki.multitheftauto.com/wiki/XmlCreateFile @slapz0r It will be used in db. I need to understand how to generate id this way(in the first post) Link to comment
Moderators IIYAMA Posted July 2, 2019 Moderators Share Posted July 2, 2019 9 minutes ago, slapz0r said: It will be used in db. I need to understand how to generate id this way(in the first post) This is column specification for auto increment ID's when new items are added. ID int NOT NULL AUTO_INCREMENT This does not reset, as DB ID are not suppose to be reset. That is asking for trouble So make sure you understand your own question very well! Link to comment
fairyoggy Posted July 2, 2019 Author Share Posted July 2, 2019 1 minute ago, IIYAMA said: This is column specification for auto increment ID's when new items are added. ID int NOT NULL AUTO_INCREMENT This does not reset, as DB ID are not suppose to be reset. That is asking for trouble So make sure you understand your own question very well! And should not be reset. All right. It is necessary to make generation like that: 0001, 0002, 0003 and so on until 9999 These numbers will get the prefix "A" A 0001 A 0002 New numbers after 9999 will be 0001 0002 0003 and so on until 9999 but with new prefix "B" B 0001 B 0002 Something like that I would like to do Link to comment
Moderators IIYAMA Posted July 2, 2019 Moderators Share Posted July 2, 2019 2 minutes ago, slapz0r said: And should not be reset. All right. It is necessary to make generation like that: 0001, 0002, 0003 and so on until 9999 These numbers will get the prefix "A" A 0001 A 0002 New numbers after 9999 will be 0001 0002 0003 and so on until 9999 but with new prefix "B" B 0001 B 0002 Something like that I would like to do The 0's is something you should do with Lua. id's are counting up: 1, 2, 3, 4, 5 etc. Those prefixes should also be done by Lua. Link to comment
fairyoggy Posted July 2, 2019 Author Share Posted July 2, 2019 2 minutes ago, IIYAMA said: The 0's is something you should do with Lua. id's are counting up: 1, 2, 3, 4, 5 etc. Those prefixes should also be done by Lua. In this topic, I would like to understand how I can create an id generation in this way. I understand that this is about creating a new custom id. Link to comment
Moderators IIYAMA Posted July 3, 2019 Moderators Share Posted July 3, 2019 10 hours ago, slapz0r said: In this topic, I would like to understand how I can create an id generation in this way. I understand that this is about creating a new custom id. You got your answer on my second post. Now give it a try. Configure the column `id` and insert an item. 1 Link to comment
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