Hey i was wondering how i would make say...10 images of the same thing. and remove them in a different order placed. Basically im making a farm/build mod for my server and when i make the tile(image) i want to remove it if im standing on it and i press a button in a menu. Here is the part im working with.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
if (Title == "Building Menu") then
		if (Button == 1) then
			menu(p,"Tiles, Black 'n' White, Remove Tile")
		end
	end
	
	if (Title == "Tiles") then
		if (Button == 1) then
			image("gfx/Az/Blacknwhite.bmp",player(p,"tilex")*32+16,player(p,"tiley")*32+16,0)
		end
		
		if (Button == 2) then
			freeimage(i[id])
			menu(p,"Tiles, Black 'n' White, Remove Tile")
		end
	end
	
end
Admin/mod comment
"lua Help" is a generic title and therefore pointless. fixed. never use generic titles please! Where do you get the from? I don't see anything being assigned to that table here...
In which order do you want them to be removed then? Randomly?
One tip: the image function returns the id of the created image. You need this id to remove the image, so store the id's in a table! the i[id] was nothing really. i was just testing something. and im wanting it so when the player stands on the image it will remove it. somewhat like a world builder. when you go to the menu it will let you place tiles in a plot you own. then if you click remove it will remove the tile your standing on.
edit: Is there maybe a way to remove a image under a players feet? Ive got all my script working but removing tiles If the latter is possible I'd be really keen on using that code as well. If anyone knows how to do this than I'd like to encourage you to write a piece of code since you'll help 2 people with it From the code you've given, I can tell you MAY have one error.
Most likely i[id] isn't defined, so I propose to try this
1
i[id]=image("gfx/Az/Blacknwhite.bmp",player(p,"tilex")*32+16,player(p,"tiley")*32+16,0)
Perhaps this Lua works.
1
2
3
4
5
6
7
8
9
10
11
12
13
images = {}
img = "gfx/cabbage.png"
if images==nil then images={} end
addhook("move","on_move")
function on_move(x,y,id)
	if player(x[34],y[22],"exists") then
		freeimage(id[i])
	elseif player(x[34],y[22],"exists") and serveraction2 then
		menu_farming(id)
_images[id] = [[i="..img..",x,y,200+i]] -- Add image
	end
end
Just randomly came up with something, I know it's wrong though but perhaps something can be used as reference. Unfortunally I have forgot how to make a menu, so yeah keep building the Lua... if you can. thanks guys im going to try both them
if i could bug you one more time id be pleased
i have this code here
1
if (player(p,"tilex")== 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28) then
and i have one for tiley
it was working perfectly when i first tested it and everything. the player bought the plot and if he was at a certain tile x it would see if he has at a certain tile y. after that, if he was it would draw a image(tile). its checking if the player is in one of them x tiles. can someone tell me how i ended up building out of the x :S i went to 0,0 and could still build