Big Smoker Posted January 3, 2021 Share Posted January 3, 2021 Pessoal, preciso de uma ajuda com sistema que eu tenho no XML. Eu ja usei .db e o XML se comportou melhor, Quero saber como faço para optimizar essa função, pois sempre que alguem entra no servidor ele da um lag (pois ele vai buscar o serial no XML de cada conta). Quero saber o que posso usar para ele setar essas função so quando jogador tiver cadastrado no XML e nao acha esse LAG quando recarrega no XML addEventHandler("onPlayerLogin",getRootElement(),function(thePreviousAccount,theCurrentAccount) local xml = xmlLoadFile("Bases.xml") for i,groupp in pairs(xmlNodeGetChildren(xml)) do for i,member in ipairs(xmlNodeGetChildren(xmlFindChild(groupp,"AllowedPlayers",0)))do if xmlNodeGetAttribute(member,"Account") == getAccountName(getPlayerAccount(source)) then local NameBase = tostring(xmlNodeGetAttribute(groupp,"NomeBase")) local Account = tostring(xmlNodeGetAttribute(member,"Account")) local Rank = tostring(xmlNodeGetAttribute(member,"Rank")) local Joined = tostring(xmlNodeGetAttribute(member,"Joined")) setElementData(source,"BaseGroupName_"..NameBase,NameBase) setElementData(source,"BaseGroupAccount_"..NameBase,Account) setElementData(source,"BaseGroupRank_"..NameBase,Rank) setElementData(source,"BaseGroupJoined_"..NameBase,Joined) end end end xmlUnloadFile(xml) end) Link to comment
Boechat Posted January 4, 2021 Share Posted January 4, 2021 E se salvar esses atributos com setAccountData e carregá-los pro elemento (setElementData) quando logar? 1 Link to comment
Big Smoker Posted January 5, 2021 Author Share Posted January 5, 2021 Positivo, eu fiz isso muito obrigado pela dica. Deu trabalho para fazer mais deu certo OBRIGADO 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