Image Posted November 24, 2012 Posted November 24, 2012 (edited) - Edited November 27, 2012 by Guest Head Developer of SeeMTA Founder and Head Developer of SAS-Network ]
Castillo Posted November 24, 2012 Posted November 24, 2012 That's because is not v [ index ], it's v [ "CharacterID" ], v [ "Skin" ] and so on. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Image Posted November 25, 2012 Author Posted November 25, 2012 (edited) - Edited November 27, 2012 by Guest Head Developer of SeeMTA Founder and Head Developer of SAS-Network ]
Castillo Posted November 25, 2012 Posted November 25, 2012 You mean that the server loads the first character twice in the table? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Image Posted November 25, 2012 Author Posted November 25, 2012 You mean that the server loads the first character twice in the table? Yes. When there are x characters in the database, the server loads the first character x times in the table. Head Developer of SeeMTA Founder and Head Developer of SAS-Network ]
Castillo Posted November 25, 2012 Posted November 25, 2012 Must be because: data = mysql:fetchAssoc(query) Is returning only the first character. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Image Posted November 25, 2012 Author Posted November 25, 2012 Must be because: data = mysql:fetchAssoc(query) Is returning only the first character. How can i load all characters? Head Developer of SeeMTA Founder and Head Developer of SAS-Network ]
Castillo Posted November 25, 2012 Posted November 25, 2012 local data = mysql:fetchRow(query) local query = mysql:query("SELECT * FROM `Characters` WHERE `AccountID` = '" .. data[1] .. "'") if (mysql:numRows(query) > 0) then local data = mysql:fetchAssoc(query) local peds = {} local rows = mysql:numRows(query) for i = 0, rows do outputChatBox ( query [ i ] [ "Name" ] ) peds[v] = {} peds[v]["CharacterID"] = data["CharacterID"] peds[v]["AccountID"] = data["AccountID"] peds[v]["Name"] = data["Name"] peds[v]["Gender"] = data["Gender"] peds[v]["Age"] = data["Age"] peds[v]["Skin"] = data["Skin"] peds[v]["PosX"] = data["PosX"] peds[v]["PosY"] = data["PosY"] peds[v]["PosZ"] = data["PosZ"] peds[v]["Dimension"] = data["Dimension"] peds[v]["Interior"] = data["Interior"] peds[v]["Health"] = data["Health"] peds[v]["Armour"] = data["Armour"] end triggerClientEvent(thePlayer, "onSuccessLogin", getRootElement(), peds) logIn(thePlayer, account, password) exports.box:showBoxS(thePlayer,"info","Sikeresen bejelentkeztél.") else See if it outputs all your character names to the chat. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Image Posted November 25, 2012 Author Posted November 25, 2012 [2012-11-25 17:51:15] ERROR: account_manager\s_account_functions.lua:54: attempt to index local 'query' (a number value) with outputConsole ( peds [ i ] [ "Name" ] ) Christopher Christopher There is 2 characters in the database. Christopher and Christopher2 Head Developer of SeeMTA Founder and Head Developer of SAS-Network ]
Castillo Posted November 25, 2012 Posted November 25, 2012 Try this instead: outputChatBox ( data [ i ] [ "Name" ] ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Image Posted November 25, 2012 Author Posted November 25, 2012 [2012-11-25 17:50:11] ERROR: account_manager\s_account_functions.lua:54: attempt to index field '?' (a nil value) I've already tried it. Head Developer of SeeMTA Founder and Head Developer of SAS-Network ]
Castillo Posted November 25, 2012 Posted November 25, 2012 I must know how your mysql resource works. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Image Posted November 25, 2012 Author Posted November 25, 2012 (edited) - Edited November 27, 2012 by Guest Head Developer of SeeMTA Founder and Head Developer of SAS-Network ]
Castillo Posted November 25, 2012 Posted November 25, 2012 local data = mysql:fetchRow(query) local query = mysql:query("SELECT * FROM `Characters` WHERE `AccountID` = '" .. data[1] .. "'") if (mysql:numRows(query) > 0) then local data = mysql:fetchAssoc(query) for index, char in pairs ( data ) do outputChatBox ( index ..": ".. char [ "Name" ] ) end local peds = {} local rows = mysql:numRows(query) for i = 0, rows do peds[v] = {} peds[v]["CharacterID"] = data["CharacterID"] peds[v]["AccountID"] = data["AccountID"] peds[v]["Name"] = data["Name"] peds[v]["Gender"] = data["Gender"] peds[v]["Age"] = data["Age"] peds[v]["Skin"] = data["Skin"] peds[v]["PosX"] = data["PosX"] peds[v]["PosY"] = data["PosY"] peds[v]["PosZ"] = data["PosZ"] peds[v]["Dimension"] = data["Dimension"] peds[v]["Interior"] = data["Interior"] peds[v]["Health"] = data["Health"] peds[v]["Armour"] = data["Armour"] end triggerClientEvent(thePlayer, "onSuccessLogin", getRootElement(), peds) logIn(thePlayer, account, password) exports.box:showBoxS(thePlayer,"info","Sikeresen bejelentkeztél.") else See what does it output. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Image Posted November 25, 2012 Author Posted November 25, 2012 Nothing. No output. Head Developer of SeeMTA Founder and Head Developer of SAS-Network ]
Castillo Posted November 25, 2012 Posted November 25, 2012 Copy it again. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Image Posted November 25, 2012 Author Posted November 25, 2012 [2012-11-25 18:54:33] ERROR: account_manager\s_account_functions.lua:38: attempt to concatenate field 'Name' (a nil value) Head Developer of SeeMTA Founder and Head Developer of SAS-Network ]
Castillo Posted November 25, 2012 Posted November 25, 2012 Just to make sure, you have a column called "Name" in your characters table, right? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Image Posted November 25, 2012 Author Posted November 25, 2012 Just to make sure, you have a column called "Name" in your characters table, right? Yes. Head Developer of SeeMTA Founder and Head Developer of SAS-Network ]
Castillo Posted November 25, 2012 Posted November 25, 2012 local data = mysql:fetchRow(query) local query = mysql:query("SELECT * FROM `Characters` WHERE `AccountID` = '" .. data[1] .. "'") if (mysql:numRows(query) > 0) then local data = mysql:fetchAssoc(query) while true do local char = mysql:fetchAssoc ( query ) if ( not char ) then break end outputChatBox ( char [ "Name" ] ) end local peds = {} local rows = mysql:numRows(query) for i = 0, rows do peds[v] = {} peds[v]["CharacterID"] = data["CharacterID"] peds[v]["AccountID"] = data["AccountID"] peds[v]["Name"] = data["Name"] peds[v]["Gender"] = data["Gender"] peds[v]["Age"] = data["Age"] peds[v]["Skin"] = data["Skin"] peds[v]["PosX"] = data["PosX"] peds[v]["PosY"] = data["PosY"] peds[v]["PosZ"] = data["PosZ"] peds[v]["Dimension"] = data["Dimension"] peds[v]["Interior"] = data["Interior"] peds[v]["Health"] = data["Health"] peds[v]["Armour"] = data["Armour"] end triggerClientEvent(thePlayer, "onSuccessLogin", getRootElement(), peds) logIn(thePlayer, account, password) exports.box:showBoxS(thePlayer,"info","Sikeresen bejelentkeztél.") else San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Image Posted November 25, 2012 Author Posted November 25, 2012 Christopher2 Head Developer of SeeMTA Founder and Head Developer of SAS-Network ]
Castillo Posted November 25, 2012 Posted November 25, 2012 So now it only outputs the second character only? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Image Posted November 25, 2012 Author Posted November 25, 2012 Yes. Head Developer of SeeMTA Founder and Head Developer of SAS-Network ]
Castillo Posted November 25, 2012 Posted November 25, 2012 local data = mysql:fetchRow(query) local query = mysql:query("SELECT * FROM `Characters` WHERE `AccountID` = '" .. data[1] .. "'") local rows = mysql:numRows(query) if (rows > 0) then local data = mysql:fetchAssoc(query) local peds = {} for result, row in pairs ( mysql:rowsAssoc ( query ) ) do outputChatBox ( row [ "Name" ] ) end for i = 0, rows do peds[i] = {} peds[i]["CharacterID"] = data["CharacterID"] peds[i]["AccountID"] = data["AccountID"] peds[i]["Name"] = data["Name"] peds[i]["Gender"] = data["Gender"] peds[i]["Age"] = data["Age"] peds[i]["Skin"] = data["Skin"] peds[i]["PosX"] = data["PosX"] peds[i]["PosY"] = data["PosY"] peds[i]["PosZ"] = data["PosZ"] peds[i]["Dimension"] = data["Dimension"] peds[i]["Interior"] = data["Interior"] peds[i]["Health"] = data["Health"] peds[i]["Armour"] = data["Armour"] end triggerClientEvent(thePlayer, "onSuccessLogin", getRootElement(), peds) logIn(thePlayer, account, password) exports.box:showBoxS(thePlayer,"info","Sikeresen bejelentkeztél.") else San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Image Posted November 25, 2012 Author Posted November 25, 2012 [2012-11-25 19:31:50] ERROR: account_manager\s_account_functions.lua:39: attempt to call a number value Line 39: for result, row in mysql:rowsAssoc ( query ) do Head Developer of SeeMTA Founder and Head Developer of SAS-Network ]
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