Cronoss Posted February 12, 2022 Share Posted February 12, 2022 (edited) I saw tutorials how to use a database for players, so I tried to save the player's character (Not only the account, I want to create a RP server) and this is what I see in PhpMyAdmin -> click This is the code i'm trying to make it work: function datosAgregar(thePlayer, nombre, sexo, edadPJ2) local addCharacter = exports.mysql:_Exec("insert into characters (name, gender, age) values (?,?,?)", nombre, sexo, edadPJ2) if (addCharacter) then iprint(" data saved ") else iprint(" error ") end end addEvent("datosAgregar", true) addEventHandler("datosAgregar", getRootElement(), datosAgregar) And the console prints me "data saved" with no error... This is the code that calls the event: addEventHandler("onClientGUIClick", btnContinuar, function() local nombre = guiGetText(name) local sexo = guiRadioButtonGetSelected(gender) local edadPJ = guiComboBoxGetSelected(edades) local edadPJ2 = guiComboBoxGetItemText(edades, edadPJ) if (edadPJ2=="") then outputChatBox("---", 255, 0, 0) else triggerServerEvent("datosAgregar", getLocalPlayer(), getLocalPlayer(), nombre, sexo, edadPJ2) guiSetVisible(ventanaPanelPJ, false) end end, false) What I'm doing wrong? Also, here is the parameters I'm using for the table in PhpMyAdmin: click me Edited February 12, 2022 by Cronoss Link to comment
Cronoss Posted February 13, 2022 Author Share Posted February 13, 2022 Uptade: I solved it by my own, but now I want to transfer the information from a table to another one, how could it be possible? I know i have to use dbquery but I can't figore out how to call the data from one side to the other side... (I want to save the account registered name as the owner of the character) 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