SGYJBHS_InstanceID = SGYJBHS_InstanceID or 1 SGYJBHS_Gate = SGYJBHS_Gate or {} SGYJBHS_Gate[1] = SGYJBHS_Gate[1] or 0 SGYJBHS_Gate[2] = SGYJBHS_Gate[2] or 0 SGYJBHS_Gate[3] = SGYJBHS_Gate[3] or 0 SGYJBHS_From = SGYJBHS_From or {} local function onTimerMin(_actID) local curhour = tonumber(os.date("%H")) local curmin = tonumber(os.date("%M")) if curmin == 50 then local mappoint = {} mappoint[3424072488] = { x = 1094, y = 3920, z = 1421 } mappoint[3424072232] = { x = 578, y = 12973, z = 1976 } mappoint[3424075048] = { x = 1618, y = 11498, z = 2082 } SGYJBHS_Gate[1] = map.MapCreateColCreature(3424072488, -1, 5610003, mappoint[3424072488].x, mappoint[3424072488].y, mappoint[3424072488].z) local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 101, 440108) msg.AddMsgEvent(MsgID, 9, mappoint[3424072488].x) msg.AddMsgEvent(MsgID, 9, mappoint[3424072488].z) msg.AddMsgEvent(MsgID, 9, 60 - curmin) msg.DispatchMapMsgEvent(MsgID, 3424072488, -1) SGYJBHS_Gate[2] = map.MapCreateColCreature(3424072232, -1, 5610003, mappoint[3424072232].x, mappoint[3424072232].y, mappoint[3424072232].z) MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 101, 440108) msg.AddMsgEvent(MsgID, 9, mappoint[3424072232].x) msg.AddMsgEvent(MsgID, 9, mappoint[3424072232].z) msg.AddMsgEvent(MsgID, 9, 60 - curmin) msg.DispatchMapMsgEvent(MsgID, 3424072232, -1) SGYJBHS_Gate[3] = map.MapCreateColCreature(3424075048, -1, 5610003, mappoint[3424075048].x, mappoint[3424075048].y, mappoint[3424075048].z) MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 101, 440108) msg.AddMsgEvent(MsgID, 9, mappoint[3424075048].x) msg.AddMsgEvent(MsgID, 9, mappoint[3424075048].z) msg.AddMsgEvent(MsgID, 9, 60 - curmin) msg.DispatchMapMsgEvent(MsgID, 3424075048, -1) SGYJBHS_InstanceID = 100000 + SGYJBHS_InstanceID % 100000 + 1 map.CreateInstance(3373740328, SGYJBHS_InstanceID % 100000) Tani_table = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 } Trec_table = { 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56 } Tyao_table = { 57, 58, 59, 60, 61, 62, 63, 64, 65, 66 } Tcre1_table = { 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106 } Tcre2_table = { 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161 } SGYJBHS_From = {} elseif (curmin == 53 or curmin == 56) and SGYJBHS_InstanceID > 10000 then local mappoint = {} mappoint[3424072488] = { x = 1094, y = 3920, z = 1421 } mappoint[3424072232] = { x = 578, y = 12973, z = 1976 } mappoint[3424075048] = { x = 1618, y = 11498, z = 2082 } local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 101, 440108) msg.AddMsgEvent(MsgID, 9, mappoint[3424072488].x) msg.AddMsgEvent(MsgID, 9, mappoint[3424072488].z) msg.AddMsgEvent(MsgID, 9, 60 - curmin) msg.DispatchMapMsgEvent(MsgID, 3424072488, -1) MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 101, 440108) msg.AddMsgEvent(MsgID, 9, mappoint[3424072232].x) msg.AddMsgEvent(MsgID, 9, mappoint[3424072232].z) msg.AddMsgEvent(MsgID, 9, 60 - curmin) msg.DispatchMapMsgEvent(MsgID, 3424072232, -1) MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID, 101, 440108) msg.AddMsgEvent(MsgID, 9, mappoint[3424075048].x) msg.AddMsgEvent(MsgID, 9, mappoint[3424075048].z) msg.AddMsgEvent(MsgID, 9, 60 - curmin) msg.DispatchMapMsgEvent(MsgID, 3424075048, -1) elseif curmin == 0 then if SGYJBHS_Gate[1] ~= nil and SGYJBHS_Gate[1] ~= 0 then map.MapDeleteCreature(3424072488, -1, SGYJBHS_Gate[1]) SGYJBHS_Gate[1] = 0 end if SGYJBHS_Gate[2] ~= nil and SGYJBHS_Gate[2] ~= 0 then map.MapDeleteCreature(3424072232, -1, SGYJBHS_Gate[2]) SGYJBHS_Gate[2] = 0 end if SGYJBHS_Gate[3] ~= nil and SGYJBHS_Gate[3] ~= 0 then map.MapDeleteCreature(3424075048, -1, SGYJBHS_Gate[3]) SGYJBHS_Gate[3] = 0 end elseif curmin == 30 and SGYJBHS_InstanceID > 10000 then -- Получаем всех игроков в инстансе и выкидываем их перед удалением local instanceID = SGYJBHS_InstanceID % 100000 local RoleTbl = map.GetMapAllRoleID(3373740328, instanceID) if RoleTbl ~= nil then for _, v in pairs(RoleTbl) do if v ~= nil and v ~= 0 then -- Проверяем, что игрок действительно в этом инстансе local playerMap, playerInstance = role.GetRoleMapID(v) if playerMap == 3373740328 and playerInstance == instanceID then -- Определяем координаты выхода (используем SGYJBHS_From если есть, иначе стандартные) local exitMapID = 3424072488 local exitX = 1094 local exitY = 3920 local exitZ = 1421 if SGYJBHS_From ~= nil and SGYJBHS_From[v] ~= nil then local mappoint = {} mappoint[3424072488] = { x = 1094, y = 3920, z = 1421 } mappoint[3424072232] = { x = 574, y = 12973, z = 1974 } mappoint[3424075048] = { x = 1618, y = 11498, z = 2082 } exitMapID = SGYJBHS_From[v] if mappoint[exitMapID] ~= nil then exitX = mappoint[exitMapID].x exitY = mappoint[exitMapID].y exitZ = mappoint[exitMapID].z end end -- Выкидываем на безопасную карту выхода role.RoleGotoNewMap(3373740328, instanceID, v, exitMapID, exitX, exitY, exitZ) end end end end map.DeleteInstance(3373740328, SGYJBHS_InstanceID % 100000) SGYJBHS_From = {} end end return { onTimerMin = onTimerMin, }