hello,
how i can save table in account data with json
and add rows in table and make it save
my try it's not working :
--server
addEventHandler("onResourceStart",resourceRoot,
function( )
for i,v in ipairs ( getElementsByType("player") ) do
local dd = getAccountData(getPlayerAccount(v),"SkinsT")
if dd == false then
setAccoountData(getPlayerAccount(v),"SkinsT", toJSON({"TT", "DF"}))
else
local s = fromJSON(dd)
table.insert(dd, s)
setAccoountData(getPlayerAccount(v),"SkinsT", toJSON(s))
end
end
end
)
addCommandHandler("df",
function( plr )
local dd = getAccountData(getPlayerAccount(plr),"SkinsT")
local s = fromJSON(dd)
triggerClientEvent(plr, "getSkins", plr, s )
end
)
--client
addEvent("getSkins",true)
addEventHandler("getSkins",root,
function( s )
guiGridListClear(myd)
for i,v in ipairs( s ) do
local row = guiGridListAddRow(myd)
guiGridListSetItemText(myd,row, 1, v,false,false)
end
end
)