Người chơi chỉ có thể phá khối ngoài các khu vực được nhập trong bảng TabAreaid. Nếu người chơi phá khối ở trong các khu vực, hành động đào sẽ bị vô hiệu hoá.
Người chơi chỉ có thể phá khối trong các khu vực được nhập trong bảng TabAreaid. Nếu người chơi phá khối ở ngoài các khu vực, hành động đào sẽ bị vô hiệu hoá.
local TabAreaid = { {{x=35, y=6, z=18}, {x=39, y=12, z=27}}, {{x=40, y=6, z=18}, {x=44, y=12, z=27}} }
for id, pos in pairs(TabAreaid) do TabAreaid[id] = select(2, Area:createAreaRectByRange(pos[1], pos[2])) end
local function scanArea(x, y, z) for _, areaid in pairs(TabAreaid) do if Area:posInArea({x=x, y=y, z=z}, areaid) == 0 then return true end end return false end
if scanArea(e.x, e.y, e.z) then
Mô tả: Kiểm tra toạ độ khối (e.x, e.y, e.z) bằng cách gọi scanArea.
Chú ý: Kịch bản cần bổ sung các giá trị tọa độ cần thiết vào bảng TabAreaid để hoạt động
local TabAreaid = { {{x= , y= , z= },{x= , y= , z= }}, {{x= , y= , z= },{x= , y= , z= }}, ... } for id,pos in pairs(TabAreaid) do TabAreaid[id] = select(2,Area:createAreaRectByRange(pos[1],pos[2])) end local function scanArea(x,y,z) for _,areaid in pairs(TabAreaid) do if Area:posInArea({x=x, y=y, z=z}, areaid) == 0 then return true end end return false end local function digb(e) if scanArea(e.x, e.y, e.z) then -- Xác định được vị trí khối đã đào nằm trong nhóm khu vực Player:setActionAttrState(e.eventobjid, 8, false) else Player:setActionAttrState(e.eventobjid, 8, true) end end ScriptSupportEvent:registerEvent('Block.Dig.Begin', digb)
local TabAreaid = { {{x=35, y=6, z=18},{x=39, y=12, z=27}}, {{x=40, y=6, z=18},{x=44, y=12, z=27}} } for id,pos in pairs(TabAreaid) do TabAreaid[id] = select(2,Area:createAreaRectByRange(pos[1],pos[2])) end local function scanArea(x,y,z) for _,areaid in pairs(TabAreaid) do if Area:posInArea({x=x, y=y, z=z}, areaid) == 0 then return true end end return false end local function digb(e) if scanArea(e.x, e.y, e.z) then -- Xác định được vị trí khối đã đào nằm trong nhóm khu vực Player:setActionAttrState(e.eventobjid, 8, true) else Player:setActionAttrState(e.eventobjid, 8, false) end end ScriptSupportEvent:registerEvent('Block.Dig.Begin', digb)
— Cre:Nguyễn Khánh 2025/02/28 09:59
Nếu bạn có bất kỳ câu hỏi nào về Chế Độ DEV Nâng Cao, vui lòng tham gia
Mini World Developer Việt Nam chính thức của chúng tôi