Jump to content

destroyElement


^iiEcoo'x_)

Recommended Posts

 

Hello

He says I have a line in this!

destroyElement

addEventHandler("onClientGUIClick", resourceRoot, 
function() 
if source == gridroom then 
local row = guiGridListGetSelectedItem(gridroom) 
local Text = guiGridListGetItemText(gridroom, row, clm) 
if Text == "1" then 
destroyElement ( grid4545 ) 
destroyElement ( gridplr3 )
destroyElement ( gridplr2 )
destroyElement ( gridplr4 )
destroyElement ( gridplr5 )
gridplr = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
clmp = guiGridListAddColumn(gridplr, "Players ", 0.9)
for i,v in ipairs(getElementsByType("player")) do
if ( getElementData ( v,'data' ) == true  ) then
local plrrom = guiGridListAddRow(gridplr)
guiGridListSetItemText(gridplr,plrrom,clmp,getPlayerName(v),false,false)
elseif Text == "2" then 
destroyElement ( grid4545 ) 
destroyElement ( gridplr )
destroyElement ( gridplr3 )
destroyElement ( gridplr4 )
destroyElement ( gridplr5 )
gridplr2 = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
clmp2 = guiGridListAddColumn(gridplr2, "Players ", 0.9)
for i,v in ipairs(getElementsByType("player")) do
if ( getElementData ( v,'data2' ) == true  ) then
local plrrom2 = guiGridListAddRow(gridplr2)
guiGridListSetItemText(gridplr2,plrrom2,clmp2,getPlayerName(v),false,false)
elseif Text == 3" then 
destroyElement ( grid4545 ) 
destroyElement ( gridplr )
destroyElement ( gridplr2 )
destroyElement ( gridplr4 )
destroyElement ( gridplr5 )
gridplr3 = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
clmp3 = guiGridListAddColumn(gridplr3, "Players ", 0.9)
for i,v in ipairs(getElementsByType("player")) do
if ( getElementData ( v,'data3' ) == true  ) then
local plrrom3 = guiGridListAddRow(gridplr3)
guiGridListSetItemText(gridplr3,plrrom3,clmp3,getPlayerName(v),false,false)

elseif Text == "4" then 

destroyElement ( grid4545 ) 
destroyElement ( gridplr )
destroyElement ( gridplr2 )
destroyElement ( gridplr3 )
destroyElement ( gridplr5 )
gridplr4 = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
clmp4 = guiGridListAddColumn(gridplr4, "Players ", 0.9)
for i,v in ipairs(getElementsByType("player")) do
if ( getElementData ( v,'data4' ) == true  ) then
local plrrom4 = guiGridListAddRow(gridplr4)
guiGridListSetItemText(gridplr4,plrrom4,clmp4,getPlayerName(v),false,false)

elseif Text == "5" then 

destroyElement ( grid4545 ) 
destroyElement ( gridplr )
destroyElement ( gridplr2 )
destroyElement ( gridplr4 )
destroyElement ( gridplr3 )
gridplr5 = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
clmp5 = guiGridListAddColumn(gridplr5, "Players ", 0.9)
for i,v in ipairs(getElementsByType("player")) do
if ( getElementData ( v,'data5' ) == true  ) then
local plrrom5 = guiGridListAddRow(gridplr5)
guiGridListSetItemText(gridplr5,plrrom5,clmp5,getPlayerName(v),false,false)
end
end
end
end
end
end
end
end
end
end
end
end
end
) 

 

Link to comment

I must do something but it did not work

addEventHandler("onClientGUIClick", resourceRoot, 
function() 
if source == gridroom then 
local row = guiGridListGetSelectedItem(gridroom) 
local Text = guiGridListGetItemText(gridroom, row, clm) 
if Text == "*[ #_iMr,[E]coo RooM ]" then 
if isElement(grid4545) or isElement(gridplr3) or isElement(gridplr4) or isElement(gridplr2) or isElement(gridplr5) then
destroyElement ( grid4545 ) 
destroyElement ( gridplr3 )
destroyElement ( gridplr2 )
destroyElement ( gridplr4 )
destroyElement ( gridplr5 )
gridplr = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
clmp = guiGridListAddColumn(gridplr, "Players In RooM", 0.9)
for i,v in ipairs(getElementsByType("player")) do
if ( getElementData ( v,'data' ) == true  ) then
local plrrom = guiGridListAddRow(gridplr)
guiGridListSetItemText(gridplr,plrrom,clmp,getPlayerName(v),false,false)
elseif Text == "*[ NoName RooM ]" then 
if isElement(grid4545) or isElement(gridplr3) or isElement(gridplr4) or isElement(gridplr) or isElement(gridplr5) then
destroyElement ( grid4545 ) 
destroyElement ( gridplr )
destroyElement ( gridplr3 )
destroyElement ( gridplr4 )
destroyElement ( gridplr5 )
gridplr2 = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
clmp2 = guiGridListAddColumn(gridplr2, "Players In RooM", 0.9)
for i,v in ipairs(getElementsByType("player")) do
if ( getElementData ( v,'data2' ) == true  ) then
local plrrom2 = guiGridListAddRow(gridplr2)
guiGridListSetItemText(gridplr2,plrrom2,clmp2,getPlayerName(v),false,false)
elseif Text == "[2 2] غرفة للشخصين" then 
if isElement(grid4545) or isElement(gridplr) or isElement(gridplr4) or isElement(gridplr2) or isElement(gridplr5) then
destroyElement ( grid4545 ) 
destroyElement ( gridplr )
destroyElement ( gridplr2 )
destroyElement ( gridplr4 )
destroyElement ( gridplr5 )
gridplr3 = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
clmp3 = guiGridListAddColumn(gridplr3, "Players In RooM", 0.9)
for i,v in ipairs(getElementsByType("player")) do
if ( getElementData ( v,'data3' ) == true  ) then
local plrrom3 = guiGridListAddRow(gridplr3)
guiGridListSetItemText(gridplr3,plrrom3,clmp3,getPlayerName(v),false,false)

elseif Text == "[3 3] غرفة للثلاث اشخاص" then 
if isElement(grid4545) or isElement(gridplr3) or isElement(gridplr) or isElement(gridplr2) or isElement(gridplr5) then
destroyElement ( grid4545 ) 
destroyElement ( gridplr )
destroyElement ( gridplr2 )
destroyElement ( gridplr3 )
destroyElement ( gridplr5 )
gridplr4 = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
clmp4 = guiGridListAddColumn(gridplr4, "Players In RooM", 0.9)
for i,v in ipairs(getElementsByType("player")) do
if ( getElementData ( v,'data4' ) == true  ) then
local plrrom4 = guiGridListAddRow(gridplr4)
guiGridListSetItemText(gridplr4,plrrom4,clmp4,getPlayerName(v),false,false)

elseif Text == "[4 4] غرفة للاربع اشخاص" then 
if isElement(grid4545) or isElement(gridplr3) or isElement(gridplr4) or isElement(gridplr2) or isElement(gridplr) then
destroyElement ( grid4545 ) 
destroyElement ( gridplr )
destroyElement ( gridplr2 )
destroyElement ( gridplr4 )
destroyElement ( gridplr3 )
gridplr5 = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
clmp5 = guiGridListAddColumn(gridplr5, "Players In RooM", 0.9)
for i,v in ipairs(getElementsByType("player")) do
if ( getElementData ( v,'data5' ) == true  ) then
local plrrom5 = guiGridListAddRow(gridplr5)
guiGridListSetItemText(gridplr5,plrrom5,clmp5,getPlayerName(v),false,false)
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
) 

 

Link to comment
addEventHandler("onClientGUIClick", resourceRoot, 
	function() 
		if source == gridroom then 
			local row = guiGridListGetSelectedItem(gridroom) 
			local Text = guiGridListGetItemText(gridroom, row, clm) 
			if Text == "*[ #_iMr,[E]coo RooM ]" then 
				if isElement(grid4545) or isElement(gridplr3) or isElement(gridplr4) or isElement(gridplr2) or isElement(gridplr5) then
					destroyElement ( grid4545 ) 
					destroyElement ( gridplr3 )
					destroyElement ( gridplr2 )
					destroyElement ( gridplr4 )
					destroyElement ( gridplr5 )
					gridplr = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
					clmp = guiGridListAddColumn(gridplr, "Players In RooM", 0.9)
					for i,v in ipairs(getElementsByType("player")) do
						if ( getElementData ( v,'data' ) == true  ) then
							local plrrom = guiGridListAddRow(gridplr)
							guiGridListSetItemText(gridplr,plrrom,clmp,getPlayerName(v),false,false)
						elseif Text == "*[ NoName RooM ]" then 
							if isElement(grid4545) or isElement(gridplr3) or isElement(gridplr4) or isElement(gridplr) or isElement(gridplr5) then
								destroyElement ( grid4545 ) 
								destroyElement ( gridplr )
								destroyElement ( gridplr3 )
								destroyElement ( gridplr4 )
								destroyElement ( gridplr5 )
								gridplr2 = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
								clmp2 = guiGridListAddColumn(gridplr2, "Players In RooM", 0.9)
								for i,v in ipairs(getElementsByType("player")) do
									if ( getElementData ( v,'data2' ) == true  ) then
										local plrrom2 = guiGridListAddRow(gridplr2)
										guiGridListSetItemText(gridplr2,plrrom2,clmp2,getPlayerName(v),false,false)
									elseif Text == "[2 2] غرفة للشخصين" then 
										if isElement(grid4545) or isElement(gridplr) or isElement(gridplr4) or isElement(gridplr2) or isElement(gridplr5) then
											destroyElement ( grid4545 ) 
											destroyElement ( gridplr )
											destroyElement ( gridplr2 )
											destroyElement ( gridplr4 )
											destroyElement ( gridplr5 )
											gridplr3 = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
											clmp3 = guiGridListAddColumn(gridplr3, "Players In RooM", 0.9)
											for i,v in ipairs(getElementsByType("player")) do
												if ( getElementData ( v,'data3' ) == true  ) then
													local plrrom3 = guiGridListAddRow(gridplr3)
													guiGridListSetItemText(gridplr3,plrrom3,clmp3,getPlayerName(v),false,false)
												elseif Text == "[3 3] غرفة للثلاث اشخاص" then 
													if isElement(grid4545) or isElement(gridplr3) or isElement(gridplr) or isElement(gridplr2) or isElement(gridplr5) then
														destroyElement ( grid4545 ) 
														destroyElement ( gridplr )
														destroyElement ( gridplr2 )
														destroyElement ( gridplr3 )
														destroyElement ( gridplr5 )
														gridplr4 = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
														clmp4 = guiGridListAddColumn(gridplr4, "Players In RooM", 0.9)
														for i,v in ipairs(getElementsByType("player")) do
															if ( getElementData ( v,'data4' ) == true  ) then
																local plrrom4 = guiGridListAddRow(gridplr4)
																guiGridListSetItemText(gridplr4,plrrom4,clmp4,getPlayerName(v),false,false)
																
																elseif Text == "[4 4] غرفة للاربع اشخاص" then 
																	if isElement(grid4545) or isElement(gridplr3) or isElement(gridplr4) or isElement(gridplr2) or isElement(gridplr) then
																		destroyElement ( grid4545 ) 
																		destroyElement ( gridplr )
																		destroyElement ( gridplr2 )
																		destroyElement ( gridplr4 )
																		destroyElement ( gridplr3 )
																		gridplr5 = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
																		clmp5 = guiGridListAddColumn(gridplr5, "Players In RooM", 0.9)
																		for i,v in ipairs(getElementsByType("player")) do
																			if ( getElementData ( v,'data5' ) == true  ) then
																				local plrrom5 = guiGridListAddRow(gridplr5)
																				guiGridListSetItemText(gridplr5,plrrom5,clmp5,getPlayerName(v),false,false)
																			end
																		end
																	end
																end
															end
														end
													end
												end
											end
										end
									end
								end
							end
						end
					end
				end
			end
)

and for sure i made errors in tabulation... i don't think a correction is necessary here, nor is necessary to find the problem: there's a BIG problem before, which is also probably the cause of the fact the script isn't working. I will have more time tomorrow, in the meantime:

  1. use indentation, it solves so many issues and helps readability. The FIRST thing i do, and i think everyone should do, is to indentate when correcting a non-correctly indentated script (sry for bad eng)
  2. "fix" the loops, they are "overlapped" if i see right

I may have done some errors, otherwise the function is not closed as some ends are missing.

Sorry for every error i could have made, i'm tired at the moment.

Link to comment
addEventHandler("onClientGUIClick", resourceRoot, 
function() 
if source == gridroom then 
local row = guiGridListGetSelectedItem(gridroom) 
local Text = guiGridListGetItemText(gridroom, row, clm) 
if Text == "1" then 
if isElement(grid4545) then  destroyElement(grid4545) end
if isElement(gridplr3) then  destroyElement(gridplr3) end
if isElement(gridplr2) then  destroyElement(gridplr2) end
if isElement(gridplr4) then  destroyElement(gridplr4) end
if isElement(gridplr5) then  destroyElement(gridplr5) end
gridplr = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
clmp = guiGridListAddColumn(gridplr, "Players ", 0.9)
for i,v in ipairs(getElementsByType("player")) do
if ( getElementData ( v,'data' ) == true  ) then
local plrrom = guiGridListAddRow(gridplr)
guiGridListSetItemText(gridplr,plrrom,clmp,getPlayerName(v),false,false)
end
end
end
elseif Text == "2" then 
if isElement(grid4545) then  destroyElement(grid4545) end
if isElement(gridplr3) then  destroyElement(gridplr3) end
if isElement(gridplr) then  destroyElement(gridplr) end
if isElement(gridplr2) then  destroyElement(gridplr2) end
if isElement(gridplr4) then  destroyElement(gridplr4) end
if isElement(gridplr5) then  destroyElement(gridplr5) end
gridplr2 = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
clmp2 = guiGridListAddColumn(gridplr2, "Players ", 0.9)
for i,v in ipairs(getElementsByType("player")) do
if ( getElementData ( v,'data2' ) == true  ) then
local plrrom2 = guiGridListAddRow(gridplr2)
guiGridListSetItemText(gridplr2,plrrom2,clmp2,getPlayerName(v),false,false)
end
end
elseif Text == "3" then 
if isElement(grid4545) then  destroyElement(grid4545) end
if isElement(gridplr) then  destroyElement(gridplr) end
if isElement(gridplr2) then  destroyElement(gridplr2) end
if isElement(gridplr4) then  destroyElement(gridplr4) end
if isElement(gridplr5) then  destroyElement(gridplr5) end
gridplr3 = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
clmp3 = guiGridListAddColumn(gridplr3, "Players ", 0.9)
for i,v in ipairs(getElementsByType("player")) do
if ( getElementData ( v,'data3' ) == true  ) then
local plrrom3 = guiGridListAddRow(gridplr3)
guiGridListSetItemText(gridplr3,plrrom3,clmp3,getPlayerName(v),false,false)
end
end
elseif Text == "4" then 
if isElement(grid4545) then  destroyElement(grid4545) end
if isElement(gridplr) then  destroyElement(gridplr) end
if isElement(gridplr3) then  destroyElement(gridplr3) end
if isElement(gridplr2) then  destroyElement(gridplr2) end
if isElement(gridplr4) then  destroyElement(gridplr4) end
if isElement(gridplr5) then  destroyElement(gridplr5) end
gridplr4 = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
clmp4 = guiGridListAddColumn(gridplr4, "Players ", 0.9)
for i,v in ipairs(getElementsByType("player")) do
if ( getElementData ( v,'data4' ) == true  ) then
local plrrom4 = guiGridListAddRow(gridplr4)
guiGridListSetItemText(gridplr4,plrrom4,clmp4,getPlayerName(v),false,false)
end
end
elseif Text == "5" then 
if isElement(grid4545) then  destroyElement(grid4545) end
if isElement(gridplr) then  destroyElement(gridplr) end
if isElement(gridplr3) then  destroyElement(gridplr3) end
if isElement(gridplr2) then  destroyElement(gridplr2) end
if isElement(gridplr4) then  destroyElement(gridplr4) end
gridplr5 = guiCreateGridList(582, 60, 265, 240, false, teamspeak)
clmp5 = guiGridListAddColumn(gridplr5, "Players ", 0.9)
for i,v in ipairs(getElementsByType("player")) do
if ( getElementData ( v,'data5' ) == true  ) then
local plrrom5 = guiGridListAddRow(gridplr5)
guiGridListSetItemText(gridplr5,plrrom5,clmp5,getPlayerName(v),false,false)
end
end
end
end
) 

 

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