Big Smoker Posted September 30, 2020 Share Posted September 30, 2020 (edited) Boa Tarde, Estou enfretando um problema em atualizar uma tabela criada pelo Quando eu Adciono o elemento dentro dessa Tabela funciona porem quando eu removo ela, ela nao atualiza. Eu to fazendo uma tabela de player vou enviar fotos, mais o unico problema é atualizar essa tabela que aparece no grilist, ela ja foi removida do banco de dados mais ela continua aparecendo no grilist. FUNÇÃO .server Edited September 30, 2020 by felipebaidoloko Link to comment
Other Languages Moderators Lord Henry Posted September 30, 2020 Other Languages Moderators Share Posted September 30, 2020 Códigos ilegíveis. Link to comment
Big Smoker Posted September 30, 2020 Author Share Posted September 30, 2020 Members 3 266 posts Posted 5 hours ago (edited) Boa Tarde, Estou enfretando um problema em atualizar uma tabela criada pelo table.insert(theMemberInfos2,{memberName,nameRank,memberAccountName,memberRank,memberJoined}) Quando eu Adciono o elemento dentro dessa Tabela funciona porem quando eu removo ela, ela nao atualiza. Eu to fazendo uma tabela de player vou enviar fotos, mais o unico problema é atualizar essa tabela que aparece no grilist, ela ja foi removida do banco de dados mais ela continua aparecendo no grilist. FUNÇÃO .server function BaRefreshPlayers(ownerAccount) outputChatBox("refresh") local theMembers33 = {} local theMemberInfos2 = {} local xml = xmlLoadFile("Bases.xml") for i,node in pairs(xmlNodeGetChildren(xml)) do if xmlNodeGetAttribute(node,"ownerAccount") == ownerAccount then for i,memberNode in pairs(xmlNodeGetChildren(xmlFindChild(node,"AllowedPlayers",0))) do local memberAccountName = xmlNodeGetAttribute(memberNode,"Account") local memberAccount = getAccount(memberAccountName) if memberAccount then local memberName = "Offline" if getAccountPlayer(memberAccount) then memberName = getPlayerName(getAccountPlayer(memberAccount)) end local nameRank = xmlNodeGetAttribute(memberNode,"Name") local memberRank = xmlNodeGetAttribute(memberNode,"Rank") local memberJoined = xmlNodeGetAttribute(memberNode,"Joined") table.insert(theMemberInfos2,{memberName,nameRank,memberAccountName,memberRank,memberJoined}) if getAccountPlayer(memberAccount) then table.insert(theMembers33,getAccountPlayer(memberAccount)) end end end end end for i,member in pairs(theMembers33)do triggerClientEvent(member,"BrefreshPlayers2",member,theMemberInfos2) end xmlUnloadFile(xml) end ------------------------------------- -- FUNÇÃO DE KIKAR O JOGADOR addEvent("BKickPlayer",true) addEventHandler("BKickPlayer",getRootElement(),function(donos,playerAccount) players4 = getAccountName(getPlayerAccount(donos)) local xml = xmlLoadFile("Bases.xml") for i,node in pairs(xmlNodeGetChildren(xml)) do if xmlNodeGetAttribute(node,"ownerAccount") == players4 then for i,member in pairs(xmlNodeGetChildren(xmlFindChild(node,"AllowedPlayers",0))) do if xmlNodeGetAttribute(member,"Account") == playerAccount then -- if xmlNodeGetAttribute(member,"Rank") == "Founder" then -- alertGroup("You can not remove the Founder!",source) -- else xmlDestroyNode(member) if getAccountPlayer(getAccount(playerAccount)) then local player = getAccountPlayer(getAccount(playerAccount)) setElementData(player,"BaseGroupAccount",false) setElementData(player,"BaseGroupRank",false) setElementData(player,"BaseGroupJoined",false) BaRefreshPlayers(playerAccount) outputChatBox("Jogador removido",source) end -- end end end end end xmlSaveFile(xml) xmlUnloadFile(xml) end) ELE REMOVE O JOGADOR DO XML porem a grilist nao atualiza (tabela) Link to comment
Blaack Posted October 1, 2020 Share Posted October 1, 2020 1 hour ago, felipebaidoloko said: Members 3 266 posts Posted 5 hours ago (edited) Boa Tarde, Estou enfretando um problema em atualizar uma tabela criada pelo table.insert(theMemberInfos2,{memberName,nameRank,memberAccountName,memberRank,memberJoined}) Quando eu Adciono o elemento dentro dessa Tabela funciona porem quando eu removo ela, ela nao atualiza. Eu to fazendo uma tabela de player vou enviar fotos, mais o unico problema é atualizar essa tabela que aparece no grilist, ela ja foi removida do banco de dados mais ela continua aparecendo no grilist. FUNÇÃO .server function BaRefreshPlayers(ownerAccount) outputChatBox("refresh") local theMembers33 = {} local theMemberInfos2 = {} local xml = xmlLoadFile("Bases.xml") for i,node in pairs(xmlNodeGetChildren(xml)) do if xmlNodeGetAttribute(node,"ownerAccount") == ownerAccount then for i,memberNode in pairs(xmlNodeGetChildren(xmlFindChild(node,"AllowedPlayers",0))) do local memberAccountName = xmlNodeGetAttribute(memberNode,"Account") local memberAccount = getAccount(memberAccountName) if memberAccount then local memberName = "Offline" if getAccountPlayer(memberAccount) then memberName = getPlayerName(getAccountPlayer(memberAccount)) end local nameRank = xmlNodeGetAttribute(memberNode,"Name") local memberRank = xmlNodeGetAttribute(memberNode,"Rank") local memberJoined = xmlNodeGetAttribute(memberNode,"Joined") table.insert(theMemberInfos2,{memberName,nameRank,memberAccountName,memberRank,memberJoined}) if getAccountPlayer(memberAccount) then table.insert(theMembers33,getAccountPlayer(memberAccount)) end end end end end for i,member in pairs(theMembers33)do triggerClientEvent(member,"BrefreshPlayers2",member,theMemberInfos2) end xmlUnloadFile(xml) end ------------------------------------- -- FUNÇÃO DE KIKAR O JOGADOR addEvent("BKickPlayer",true) addEventHandler("BKickPlayer",getRootElement(),function(donos,playerAccount) players4 = getAccountName(getPlayerAccount(donos)) local xml = xmlLoadFile("Bases.xml") for i,node in pairs(xmlNodeGetChildren(xml)) do if xmlNodeGetAttribute(node,"ownerAccount") == players4 then for i,member in pairs(xmlNodeGetChildren(xmlFindChild(node,"AllowedPlayers",0))) do if xmlNodeGetAttribute(member,"Account") == playerAccount then -- if xmlNodeGetAttribute(member,"Rank") == "Founder" then -- alertGroup("You can not remove the Founder!",source) -- else xmlDestroyNode(member) if getAccountPlayer(getAccount(playerAccount)) then local player = getAccountPlayer(getAccount(playerAccount)) setElementData(player,"BaseGroupAccount",false) setElementData(player,"BaseGroupRank",false) setElementData(player,"BaseGroupJoined",false) BaRefreshPlayers(playerAccount) outputChatBox("Jogador removido",source) end -- end end end end end xmlSaveFile(xml) xmlUnloadFile(xml) end) ELE REMOVE O JOGADOR DO XML porem a grilist nao atualiza (tabela) Código incompleto, mande como voce adiciona eles na grid quando ela abre! Link to comment
Big Smoker Posted October 1, 2020 Author Share Posted October 1, 2020 nao tem como pois se nao tenho que lhe passar a resource toda, por causa do XML que salva e seta nele. Unico problema que enfrento é que quando deleta o jogador a grilist nao deleta ela 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