trajik Posted August 9, 2010 Share Posted August 9, 2010 I understand the basic concepts of lua, however I am in a bit of a bind when it comes to tables. In my server I have a button that creates a character but when it is complete the information is logged in my MySQL db but I don't know how I could use that information to make that same button spawn the created character, I believe if I use a table I could use that to achieve my goal...could anyone help me out? Link to comment
The_Ex Posted August 9, 2010 Share Posted August 9, 2010 http://lua-users.org/wiki/TablesTutorial Hope this help. Link to comment
trajik Posted August 9, 2010 Author Share Posted August 9, 2010 yeah thank you! I understand it now but now how could I use this to achieve my goal as stated above? Link to comment
50p Posted August 10, 2010 Share Posted August 10, 2010 You triggerServerEvent with the character data and you store it in a DB but before you store it, you check if you've already stored data for this character, if there is data already then use it in different functions like spawnPlayer. The only table you'll use is the table you get back from MySQL query or you won't even use a table at all.. Link to comment
trajik Posted August 10, 2010 Author Share Posted August 10, 2010 okay, so I made a script that has a scripted character selection screen. It has one button and if your a first time user to the sever it sends you to another screen to create your character. After the player clicks finish to finish creating his character how would I go about making that same button he clicked on to create the character, to spawn the character he just created? Basically I'm asking how can I change a function of a button when I acquire new information? Link to comment
LonelyRoad Posted August 11, 2010 Share Posted August 11, 2010 Basically I'm asking how can I change a function of a button when I acquire new information? Call a MySQL query and store the (boolean?) output to a variable, then use an if statement to check the value of the variable, basically you need to ask the DB if the character name exists, if it does then you assign one function to the button, if it doesn't you assign the other. 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