Hello,
I'd like to create a database-similar system for code system
So, i'd like to do it like that :
[QUOTE]Enabled - Code - Claimed by - Gift
1 - {code} - {empty} - {VIP 3 DAYS}
0 - {code} - {nickname} - {VIP 7 DAYS}[/QUOTE]
1 = enabled, 0 = already claimed
but, the problem, i did the grahic part, but i do not know how to finish this system to be honest
Here's my graphic part :
[url]http://i.imgur.com/apFa0BD.png[/url]
If the code entered in the textbox is false, then it shows an error message, otherwise, it shows a success message with the gift attached to the code
i have a text file with all the code like that :
[QUOTE]#code1#
#code2#
#code3#
...
#codeX#[/QUOTE]
So, i'd just need help to get the 'database' and i'll can resolve my problem
i searched on internet but didn't understood much with that empty tables (t = {})
PS : Error and sucess messages are already done
Thanks in advance !
Tao(u)s
You put the codes inside a table, loop through them and set if they're used or not. something like
[code]
local codes = {}
codes["yourcodehere"] = 1
codes["yourcodehere2"] = 1
codes["yourcodehere3"] = 1
codes["yourcodehere4"] = 0
[/code]
And then save the codes to a SERVERSIDE text file in the database, with util.TableToJSON(), and the input group simply checks if the given code in the table is 1 or 0, and if 0, simply put an error there, I wont give you the full code, because you shall learn, I told you the simplest way to do so.
[QUOTE=whitestar;49618629]You put the codes inside a table, loop through them and set if they're used or not. something like
[code]
local codes = {}
codes["yourcodehere"] = 1
codes["yourcodehere2"] = 1
codes["yourcodehere3"] = 1
codes["yourcodehere4"] = 0
[/code]
And then save the codes to a SERVERSIDE text file in the database, with util.TableToJSON(), and the input group simply checks if the given code in the table is 1 or 0, and if 0, simply put an error there, I wont give you the full code, because you shall learn, I told you the simplest way to do so.[/QUOTE]
Thanks you very much ! Gonna try like that !
I need help again, i tried so many way, it don't works q_q
When i enter a good code (i didn't used the table atm, just a test in a value check of the textbox)
it works, and when i enter a wrong code, the label just write in the previous label
[url]http://i.imgur.com/bcNxycq.png[/url]
i tried .show()/hide(), Visible=false/true
but nothing works q_q
I'm a newbie in lua ._.
(I know that the label2 write on label1, as they are 2 differents labels and same with the images but i don't know how to fix it (show/hide) )
and, how to read in the json table ?
Thanks in advance ! :smile:
look in the wiki, its SetVisible(bool).
Sorry, you need to Log In to post a reply to this thread.