Jump to content

can someone further explain tables in lua?


trajik

Recommended Posts

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

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

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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...