McFree Posted April 4, 2016 Share Posted April 4, 2016 Нужна помощь, не могу понять как получить таблицу Characters. Клиентский скрипт: Characters = { ChName = {}, ChLvl = {}, ChSkin = {}, ChHealth = {}, ChArmor = {}, ChMoney = {}, ChBank = {}, ChWeapons = {}, ChCreated = {}, ChLastLogin = {}, ChDeathTime = {}, CharCount = 0 } Characters = triggerServerEvent("loadCharacters", getRootElement(), UserID) Серверный скрипт: Characters = { ChName = {}, ChLvl = {}, ChSkin = {}, ChHealth = {}, ChArmor = {}, ChMoney = {}, ChBank = {}, ChWeapons = {}, ChCreated = {}, ChLastLogin = {}, ChDeathTime = {}, CharCount = 0 } function loadCharacters(UserID) if (client) then dbQuery( function(qh) -- результат в переменную result local result = dbPoll( qh, -1, true ) --если result имеет в себе что-то if result then for _, row in ipairs ( result ) do for column, value in pairs ( result ) do Characters.CharCount = row Characters.ChName[row] = value["Name"] Characters.ChLvl[row] = value["Lvl"] Characters.ChSkin[row] = value["Skin"] Characters.ChHealth[row] = value["Health"] Characters.ChArmor[row] = value["Armor"] Characters.ChMoney[row] = value["Money"] Characters.ChBank[row] = value["Bank"] Characters.ChWeapons[row] = value["Weapons"] Characters.ChCreated[row] = value["Created"] Characters.ChLastLogin[row] = value["LastLogin"] Characters.ChDeathTime[row] = value["DeathTime"] end end end return Characters end, SQL, "SELECT * FROM characters WHERE UserID = ?", UserID ) end end addEvent( "loadCharacters", true ) addEventHandler( "loadCharacters", root, loadCharacters) Как организовать передачу полученной таблицы из MySQL на клиентскую таблицу? 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