Jump to content

I need some help | vol. 2


Image

Recommended Posts

Posted

That's because is not v [ index ], it's v [ "CharacterID" ], v [ "Skin" ] and so on.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You mean that the server loads the first character twice in the table?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

560x95_FFFFFF_FF9900_000000_000000.png]
Posted

Must be because:

data = mysql:fetchAssoc(query) 

Is returning only the first character.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

560x95_FFFFFF_FF9900_000000_000000.png]
Posted
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.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

[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

560x95_FFFFFF_FF9900_000000_000000.png]
Posted

Try this instead:

outputChatBox ( data [ i ] [ "Name" ] ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

[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

560x95_FFFFFF_FF9900_000000_000000.png]
Posted

I must know how your mysql resource works.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

560x95_FFFFFF_FF9900_000000_000000.png]
Posted

Just to make sure, you have a column called "Name" in your characters table, right?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

560x95_FFFFFF_FF9900_000000_000000.png]
Posted
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.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

So now it only outputs the second character only?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

560x95_FFFFFF_FF9900_000000_000000.png]

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