Jump to content

ATUALIZAR TABELA


Recommended Posts

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 by felipebaidoloko
Link to comment
  • Members
  •  3
  • 266 posts
  •  

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
1 hour ago, felipebaidoloko said:
  • Members
  •  3
  • 266 posts
 
  •  

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

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