local config = {

    players = {  --pozycje graczy
        {x=1022, y=1003, z=8, stackpos=253},
        {x=1022, y=1004, z=8, stackpos=253},
        {x=1022, y=1005, z=8, stackpos=253},
        {x=1022, y=1006, z=8, stackpos=253},
		
        {x=1023, y=1003, z=8, stackpos=253},
        {x=1023, y=1004, z=8, stackpos=253},
        {x=1023, y=1005, z=8, stackpos=253},
        {x=1023, y=1006, z=8, stackpos=253},
		
        {x=1024, y=1003, z=8, stackpos=253},
        {x=1024, y=1004, z=8, stackpos=253},
        {x=1024, y=1005, z=8, stackpos=253},
        {x=1024, y=1006, z=8, stackpos=253},
		
        {x=1020, y=1005, z=8, stackpos=253}},
		
    npos = {  --pozycje graczy po teleportowaniu
        {x=538, y=984, z=7},
        {x=538, y=985, z=7},
        {x=538, y=986, z=7},
		
        {x=539, y=984, z=7},
        {x=539, y=985, z=7},
        {x=539, y=986, z=7},
		
        {x=540, y=984, z=7},
        {x=540, y=985, z=7},
        {x=540, y=986, z=7},
		
        {x=541, y=984, z=7},
        {x=541, y=985, z=7},
        {x=541, y=986, z=7},
		
        {x=539, y=982, z=7}},
        
}

function onUse(cid, item, frompos, item2, topos)
    if item.itemid == 1945 then
        local tbl = {}
        for k, v in pairs(config.players) do
            local player = getThingfromPos(v)
            if(not isPlayer(player.uid)) then
                doPlayerSendCancel(cid, "You need 13 players for this quest.")
                return TRUE
            end
            table.insert(tbl, player.uid)
        end
        for i, v in ipairs(tbl) do
            doTeleportThing(v, config.npos[i])
            doSendMagicEffect(config.npos[i], 12)
            doSendAnimatedText(config.npos[i], "Go!", 192)
        end
		
		setGlobalStorageValue(6500, 0)
        return TRUE
    end

    return TRUE
end