Script: http://unrealsoftware.de/files_show.php?file=9757
I'm not good at lua so dont blame me
edited 1×, last 05.07.15 05:10:14 am
menus = { [1] = {x = 88, y = 99, str = "Title,button 1,button 2"}, [2] = {x = 89, y = 98, str = "Title B,button 1,button 2"} } addhook("movetile","yey") function yey(id,x,y) 	for k,v in pairs (menus) do 		if x == v.x and y == v.y then 			menu(id,v.str) 		end 	end end
addhook("serveraction" , "lol") function lol(id,action) 	if action==1 then 		menu(id,"Shop,Buy spec clothes,Buy extra weapons,Health potions"); 	end end addhook("menu" , "menu1") function menu1(id,title,button) 	if (title=="Shop") then 		if button==1 then 			menu(id,"Buy spec clothes,Police|1000$,Bandit|900$,Lolzor|1200$"); 		elseif button==2 then 			menu(id,"Buy extra weapons,Laser|5000$,Flamethrower|4500$,Rocket Launcher|4000$"); 		elseif button==3 then 			menu(id,"Health potions,Heal potion +25hp|500$,Heal potion +50hp|1000$,Heal potion +75hp|1500$,Heal potion +100hp|2000$") 		end 	elseif (title=="Buy spec clothes") then 		if button==1 then 			if (player(id,"money")>=1000) then 				parse("setmoney "..id.." "..player(id,"money")-1000); 				freeimage(id); 				id=image("gfx/shop_clothes_and_guns/police.bmp",10,10,200+id); 				msg2(id,"©000255255You bought Police Skin for 1000$"); 			else 				msg2(id,"©255000000Not enough money!") 			end 		elseif button==2 then 			if (player(id,"money")>=900) then 				parse("setmoney "..id.." "..player(id,"money")-900); 				msg2(id,"©000255255You bought Bandit Skin for 900$"); 				freeimage(id); 				id=image("gfx/shop_clothes_and_guns/bandit.bmp",10,10,200+id); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		elseif button==3 then 			if (player(id,"money")>=1200) then 				parse("setmoney "..id.." "..player(id,"money")-1200); 				msg2(id,"©000255255You bought Lolzor Skin for 1200$"); 				freeimage(id); 				id=image("gfx/shop_clothes_and_guns/lolzor.bmp",10,10,200+id); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		end 	elseif (title=="Buy extra weapons") then 		if button==1 then 			if (player(id,"money")>=5000) then 				parse("setmoney "..id.." "..player(id,"money")-5000); 				parse("equip "..id.." 45"); 				msg2(id,"©000255255You bought Lasergun for 5000$"); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		elseif button==2 then 			if (player(id,"money")>=4500) then 				parse("setmoney "..id.." "..player(id,"money")-4500); 				parse("equip "..id.." 46"); 				msg2(id,"©000255255You bought Flamethrower for 4500$"); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		elseif button==3 then 			if (player(id,"money")>=4000) then 				parse("setmoney "..id.." "..player(id,"money")-4000); 				parse("equip "..id.." 48"); 				msg2(id,"©000255255You bought Rocket Launcher for 4000$"); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		end 	elseif (title=="Health potions") then 		if button==1 then 			if (player(id,"money")>=500) then 				parse("setmoney "..id.." "..player(id,"money")-500); 				parse("sethealth "..id.." "..player(id,"health")+25); 				msg2(id,"©000255255You bought health potion for 500$"); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		elseif button==2 then 			if (player(id,"money")>=1000) then 				parse("setmoney "..id.." "..player(id,"money")-1000); 				parse("sethealth "..id.." "..player(id,"health")+50); 				msg2(id,"©000255255You bought health potion for 1000$"); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		elseif button==3 then 			if (player(id,"money")>=1500) then 				parse("setmoney "..id.." "..player(id,"money")-1500); 				parse("sethealth "..id.." "..player(id,"health")+75); 				msg2(id,"©000255255You bought health potion for 1500$"); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		elseif button==4 then 			if (player(id,"money")>=2000) then 				parse("setmoney "..id.." "..player(id,"money")-2000); 				parse("sethealth "..id.." "..player(id,"health")+100); 				msg2(id,"©000255255You bought health potion for 2000$"); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		end 	end end addhook("join" , "admin") function admin(id,usgn) 	if (usgn==15565) then 		freeimage(id); 		id=image("gfx/shop_clothes_and_guns/admin.bmp",0,0,200+id); 	end end -- STUFF YOU MAY WANT TO CONSIDER -- -- You don't have to put semicolon after each command. Lua can parse commands just fine without semicolons -- You may want to change argument names into sth shorter but still understandable (t for title, b for button and so on) -- You're overwriting the player ID (a number) into an image. That shouldn't be done as it can cause problems if ur using id elsewhere. -- You can't just add new arguments to hooks and think that they're magically going to work. Like in join hook the 'usgn' parameter will never be given. -- TAB YOUR CODE -- Free your images on leaving
img = {} menus = { [1] = {x = 123, y = 123, str = "Buy spec clothes,Police|1000$,Bandit|900$,Lolzor|1200$"}, [2] = {x = 321, y = 321, str = "Buy extra weapons,Laser|5000$,Flamethrower|4500$,Rocket Launcher|4000$"}, [2] = {x = 13, y = 37, str = "Health potions,Heal potion +25hp|500$,Heal potion +50hp|1000$,Heal potion +75hp|1500$,Heal potion +100hp|2000$"} } addhook("movetile","yey") function yey(id,x,y) for k,v in pairs (menus) do if x == v.x and y == v.y then menu(id,v.str) end end end addhook("serveraction", "lol") function lol(id,action) 	if action==1 then 		menu(id,"Shop,Buy spec clothes,Buy extra weapons,Health potions"); 	end end addhook("menu", "menu1") function menu1(id,title,button) 	--[[if (title=="Shop") then 		if button==1 then 			menu(id,"Buy spec clothes,Police|1000$,Bandit|900$,Lolzor|1200$"); 		elseif button==2 then 			menu(id,"Buy extra weapons,Laser|5000$,Flamethrower|4500$,Rocket Launcher|4000$"); 		elseif button==3 then 			menu(id,"Health potions,Heal potion +25hp|500$,Heal potion +50hp|1000$,Heal potion +75hp|1500$,Heal potion +100hp|2000$") 		end -- ~ ~ ~ No longer needed because the menus will be open when you step on tiles you define ~ ~ ~ 	else]]if (title=="Buy spec clothes") then 		if button==1 then 			if (player(id,"money")>=1000) then 				parse("setmoney "..id.." "..player(id,"money")-1000); 				freeimage(img[id]); 				img[id] = image("gfx/shop_clothes_and_guns/police.bmp",10,10,200+id); 				msg2(id,"©000255255You bought Police Skin for 1000$"); 			else 				msg2(id,"©255000000Not enough money!") 			end 		elseif button==2 then 			if (player(id,"money")>=900) then 				parse("setmoney "..id.." "..player(id,"money")-900); 				msg2(id,"©000255255You bought Bandit Skin for 900$"); 				freeimage(img[id]); 				img[id] = image("gfx/shop_clothes_and_guns/bandit.bmp",10,10,200+id); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		elseif button==3 then 			if (player(id,"money")>=1200) then 				parse("setmoney "..id.." "..player(id,"money")-1200); 				msg2(id,"©000255255You bought Lolzor Skin for 1200$"); 				freeimage(img[id]); 				img[id] = image("gfx/shop_clothes_and_guns/lolzor.bmp",10,10,200+id); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		end 	elseif (title=="Buy extra weapons") then 		if button==1 then 			if (player(id,"money")>=5000) then 				parse("setmoney "..id.." "..player(id,"money")-5000); 				parse("equip "..id.." 45"); 				msg2(id,"©000255255You bought Lasergun for 5000$"); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		elseif button==2 then 			if (player(id,"money")>=4500) then 				parse("setmoney "..id.." "..player(id,"money")-4500); 				parse("equip "..id.." 46"); 				msg2(id,"©000255255You bought Flamethrower for 4500$"); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		elseif button==3 then 			if (player(id,"money")>=4000) then 				parse("setmoney "..id.." "..player(id,"money")-4000); 				parse("equip "..id.." 48"); 				msg2(id,"©000255255You bought Rocket Launcher for 4000$"); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		end 	elseif (title=="Health potions") then 		if button==1 then 			if (player(id,"money")>=500) then 				parse("setmoney "..id.." "..player(id,"money")-500); 				parse("sethealth "..id.." "..player(id,"health")+25); 				msg2(id,"©000255255You bought health potion for 500$"); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		elseif button==2 then 			if (player(id,"money")>=1000) then 				parse("setmoney "..id.." "..player(id,"money")-1000); 				parse("sethealth "..id.." "..player(id,"health")+50); 				msg2(id,"©000255255You bought health potion for 1000$"); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		elseif button==3 then 			if (player(id,"money")>=1500) then 				parse("setmoney "..id.." "..player(id,"money")-1500); 				parse("sethealth "..id.." "..player(id,"health")+75); 				msg2(id,"©000255255You bought health potion for 1500$"); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		elseif button==4 then 			if (player(id,"money")>=2000) then 				parse("setmoney "..id.." "..player(id,"money")-2000); 				parse("sethealth "..id.." "..player(id,"health")+100); 				msg2(id,"©000255255You bought health potion for 2000$"); 			else 				msg2(id,"©255000000Not enough money!"); 			end 		end 	end end addhook("join" , "admin") function admin(id) 	if player(id,"usgn")==15565 then 		freeimage(img[id]); 		img[id] = image("gfx/shop_clothes_and_guns/admin.bmp",0,0,200+id); 	end end -- STUFF YOU MAY WANT TO CONSIDER -- -- You don't have to put semicolon after each command. Lua can parse commands just fine without semicolons -- You may want to change argument names into sth shorter but still understandable (t for title, b for button and so on) -- You're overwriting the player ID (a number) into an image. That shouldn't be done as it can cause problems if ur using id elsewhere. -- You can't just add new arguments to hooks and think that they're magically going to work. Like in join hook the 'usgn' parameter will never be given. -- TAB YOUR CODE -- Free your images on leaving
img = {} menus = { [1] = {x = 123, y = 123, str = "Buy spec clothes,Police|1000$,Bandit|900$,Lolzor|1200$"}, [2] = {x = 321, y = 321, str = "Buy extra weapons,Laser|5000$,Flamethrower|4500$,Rocket Launcher|4000$"}, [2] = {x = 13, y = 37, str = "Health potions,Heal potion +25hp|500$,Heal potion +50hp|1000$,Heal potion +75hp|1500$,Heal potion +100hp|2000$"} } purchases = { ["Buy spec clothes"] = { [1] = {price = 1000, path = "gfx/shop_clothes_and_guns/police.bmp", itemname = "Police Skin"}, [2] = {price = 900, path = "gfx/shop_clothes_and_guns/bandit.bmp", itemname = "Bandit Skin"}, [3] = {price = 1200, path = "gfx/shop_clothes_and_guns/lolzor.bmp", itemname = "Lolzor Skin"}} ["Buy extra weapons"] = { [1] = {price = 5000, itemid = 45, itemname = "Laser"}, [2] = {price = 4500, itemid = 46, itemname = "Flamethrower"}, [3] = {price = 4000, itemid = 48, itemname = "Rocket Launcher"}} ["Health potions"] = { [1] = {price = 500, heal = 25}, [2] = {price = 1000, heal = 50}, [3] = {price = 1500, heal = 75}, [4] = {price = 2000, heal = 100}} } addhook("movetile","yey") function yey(id,x,y) for k,v in pairs (menus) do if x == v.x and y == v.y then menu(id,v.str) end end end addhook("serveraction", "lol") function lol(id,action) 	if action==1 then 		menu(id,"Shop,Buy spec clothes,Buy extra weapons,Health potions"); 	end end addhook("menu", "menu_hook") function menu_hook(id,t,b) 	for k,v in pairs (purchases) do 		if k == t then 			if player(id,"money")>=purchases[k][b].price then 				parse("setmoney "..id.." "..player(id,"money")-purchases[k][b].price) 				if purchases[k][b].path then 					if img[id] ~= nil then 						freeimage(img[id]) 						img[id] = nil 					end 					img[id] = image(purchases[k][b].path,10,10,200+id) 				end 				if purchases[k][b].itemid then 					parse("equip "..id.." "..purchases[k][b].itemid) 				end 				if purchases[k][b].heal then 					parse("sethealth "..id.." "..player(id,"health")+purchases[k][b].heal) 				end 				if purchases[k][b].itemname then 					msg2(id,"\169000255255You bought "..purchases[k][b].itemname.." for "..purchases[k][b].price) 				else 					msg2(id,"\169000255255You bought health potion for "..purchases[k][b].price) 				end 			else 				msg2(id,"\169255000000Not enough money!") 			end 			break 		end 	end end addhook("join" , "admin") function admin(id) 	if player(id,"usgn")==15565 then 		if img[id] ~= nil then 			freeimage(img[id]) 			img[id] = nil 		end 		freeimage(img[id]); 		img[id] = image("gfx/shop_clothes_and_guns/admin.bmp",0,0,200+id); 	end end addhook("leave","leave_hook") function leave_hook(id) 	if img[id] ~= nil then 		freeimage(img[id]) 		img[id] = nil 	end end -- STUFF YOU MAY WANT TO CONSIDER -- -- You don't have to put semicolon after each command. Lua can parse commands just fine without semicolons -- You may want to change argument names into sth shorter but still understandable (t for title, b for button and so on) -- You're overwriting the player ID (a number) into an image. That shouldn't be done as it can cause problems if ur using id elsewhere. -- You can't just add new arguments to hooks and think that they're magically going to work. Like in join hook the 'usgn' parameter will never be given. -- TAB YOUR CODE -- Free your images on leaving
img = {} menus = { [1] = {x = 1, y = 1, str = "Buy spec clothes,Police|1000$,Bandit|900$,Lolzor|1200$"}, [2] = {x = 2, y = 2, str = "Buy extra weapons,Laser|5000$,Flamethrower|4500$,Rocket Launcher|4000$"}, [2] = {x = 3, y = 3, str = "Health potions,Heal potion +25hp|500$,Heal potion +50hp|1000$,Heal potion +75hp|1500$,Heal potion +100hp|2000$"} } purchases = { ["Buy spec clothes"] = { [1] = {price = 1000, path = "gfx/shop_clothes_and_guns/police.bmp", itemname = "Police Skin"}, [2] = {price = 900, path = "gfx/shop_clothes_and_guns/bandit.bmp", itemname = "Bandit Skin"}, [3] = {price = 1200, path = "gfx/shop_clothes_and_guns/lolzor.bmp", itemname = "Lolzor Skin"}}, ["Buy extra weapons"] = { [1] = {price = 5000, itemid = 45, itemname = "Laser"}, [2] = {price = 4500, itemid = 46, itemname = "Flamethrower"}, [3] = {price = 4000, itemid = 48, itemname = "Rocket Launcher"}}, ["Health potions"] = { [1] = {price = 500, heal = 25}, [2] = {price = 1000, heal = 50}, [3] = {price = 1500, heal = 75}, [4] = {price = 2000, heal = 100}} } addhook("movetile","yey") function yey(id,x,y) for k,v in pairs (menus) do if x == v.x and y == v.y then menu(id,v.str) end end end addhook("serveraction", "lol") function lol(id,action) if action==1 then menu(id,"Shop,Buy spec clothes,Buy extra weapons,Health potions"); end end addhook("menu", "menu_hook") function menu_hook(id,t,b) for k,v in pairs (purchases) do if k == t then if player(id,"money")>=purchases[k][b].price then parse("setmoney "..id.." "..player(id,"money")-purchases[k][b].price) if purchases[k][b].path then if img[id] ~= nil then freeimage(img[id]) img[id] = nil end img[id] = image(purchases[k][b].path,10,10,200+id) end if purchases[k][b].itemid then parse("equip "..id.." "..purchases[k][b].itemid) end if purchases[k][b].heal then parse("sethealth "..id.." "..player(id,"health")+purchases[k][b].heal) end if purchases[k][b].itemname then msg2(id,"\169000255255You bought "..purchases[k][b].itemname.." for "..purchases[k][b].price) else msg2(id,"\169000255255You bought health potion for "..purchases[k][b].price) end else msg2(id,"\169255000000Not enough money!") end break end end end addhook("join" , "admin") function admin(id) if player(id,"usgn")==15565 then if img[id] ~= nil then freeimage(img[id]) img[id] = nil end freeimage(img[id]); img[id] = image("gfx/shop_clothes_and_guns/admin.bmp",0,0,200+id); end end addhook("leave","leave_hook") function leave_hook(id) if img[id] ~= nil then freeimage(img[id]) img[id] = nil end end -- STUFF YOU MAY WANT TO CONSIDER -- -- You don't have to put semicolon after each command. Lua can parse commands just fine without semicolons -- You may want to change argument names into sth shorter but still understandable (t for title, b for button and so on) -- You're overwriting the player ID (a number) into an image. That shouldn't be done as it can cause problems if ur using id elsewhere. -- You can't just add new arguments to hooks and think that they're magically going to work. Like in join hook the 'usgn' parameter will never be given. -- TAB YOUR CODE -- Free your images on leaving