function onModalWindow(player, modalWindowId, buttonId, choiceId)
if modalWindowId ~= 1 or buttonId == 2 then
return false
end
if choiceId == 1 then -- steel
if buttonId == 1 then
local modalSteel = ModalWindow(2, "Crafting Steel", "Select the equipment:")
modalSteel:addChoice(1, "Steel Helmet")
modalSteel:addChoice(2, "Steel Armor")
modalSteel:addChoice(3, "Steel Legs")
modalSteel:addChoice(4, "Steel Boots")
modalSteel:addButton(1, "Select")
modalSteel:setDefaultEnterButton(1)
modalSteel:addButton(2, "Cancel")
modalSteel:setDefaultEscapeButton(2)
modalSteel:sendToPlayer(player)
end
elseif choiceId == 2 then -- bronze
if buttonId == 1 then
local modalBronze = ModalWindow(3, "Crafting Bronze", "Select the equipment:")
modalBronze:addChoice(1, "Bronze Helmet")
modalBronze:addChoice(2, "Bronze Armor")
modalBronze:addChoice(3, "Bronze Legs")
modalBronze:addChoice(4, "Bronze Boots")
modalBronze:addButton(1, "Select")
modalBronze:setDefaultEnterButton(1)
modalBronze:addButton(2, "Cancel")
modalBronze:setDefaultEscapeButton(2)
modalBronze:sendToPlayer(player)
end
elseif choiceId == 3 then -- leather
if buttonId == 1 then
local modalLeather = ModalWindow(4, "Crafting Leather", "Select the equipment:")
modalLeather:addChoice(1, "Leather Helmet")
modalLeather:addChoice(2, "Leather Armor")
modalLeather:addChoice(3, "Leather Legs")
modalLeather:addChoice(4, "Leather Boots")
modalLeather:addButton(1, "Select")
modalLeather:setDefaultEnterButton(1)
modalLeather:addButton(2, "Cancel")
modalLeather:setDefaultEscapeButton(2)
modalLeather:sendToPlayer(player)
end
elseif choiceId == 4 then -- iron
if buttonId == 1 then
local modalIron = ModalWindow(5, "Crafting Iron", "Select the equipment:")
modalIron:addChoice(1, "Iron Helmet")
modalIron:addChoice(2, "Iron Armor")
modalIron:addChoice(3, "Iron Legs")
modalIron:addChoice(4, "Iron Boots")
modalIron:addButton(1, "Select")
modalIron:setDefaultEnterButton(1)
modalIron:addButton(2, "Cancel")
modalIron:setDefaultEscapeButton(2)
modalIron:sendToPlayer(player)
end
end
return true
end