-------permission_lists--------
admin_list = {1040799583, 1263630601, 1068228215, 1116858435, 1098717948, 1062292351, 1276739681, 1173901672, 1144292080, 1274757845, 1265405225}
give_list = {1040799583, 1263630601, 1068228215, 1116858435, 1098717948, 1062292351, 1276739681, 1173901672, 1144292080, 1274757845, 1265405225}
tp_list = {1040799583, 1263630601, 1068228215, 1116858435, 1098717948, 1062292351, 1276739681, 1173901672, 1144292080, 1274757845, 1265405225}
kill_list = {1040799583, 1263630601, 1068228215, 1116858435, 1098717948, 1062292351, 1276739681, 1173901672, 1144292080, 1274757845, 1265405225}
--------variables--------
version = "13/12/23 19:32:07"
command_prefix = "/"
testing = {}
creature_list = {}
OrgPlayerName = {}
max_creature = 1500
get_id_block, get_id_creature = {}, {}
_, world_time = World:getHours()
ECoords, area_start_pos, area_end_pos = nil, nil, nil
auto_kill_mob = false
riding_item = 11810
increase_data_item, decrease_data_item, get_data_item = 11209, 11329, 11593
----------------
function getAttrName(attr_type)
local attr_list = {
attr1 = "Máu Tối Đa" ,
attr2 = "Máu Hiện Tại" ,
attr3 = "Tốc Độ Hồi Máu" ,
attr4 = "Số Mạng" ,
attr5 = "Độ Đói Tối Đa" ,
attr6 = "Độ Đói Hiện Tại" ,
attr7 = "Oxy Tối Đa" ,
attr8 = "Oxy Hiện Tại" ,
attr9 = "Tốc Độ Phục Hồi Oxy" ,
attr10 = "Tốc Độ Di Chuyển" ,
attr11 = "Tốc Độ Chạy" ,
attr12 = "Tốc Độ Ẩn Thân" ,
attr13 = "Tốc Độ Bơi" ,
attr14 = "Lực Nhảy" ,
attr15 = "\"Trống\"" ,
attr16 = "Tỉ Lệ Né Đòn" ,
attr17 = "Tấn Công Cận Chiến" ,
attr18 = "Tấn Công Tầm Xa" ,
attr19 = "Phòng Thủ Cận Chiến" ,
attr20 = "Phòng Thủ Tầm Xa" ,
attr21 = "Kích Thước Cơ Thể" ,
attr22 = "Điểm Số" ,
attr23 = "Sao" ,
attr24 = "\"Trống\"" ,
attr25 = "\"Trống\"" ,
attr26 = "Kinh Nghiệm Hiện Tại" ,
attr27 = "Cấp Độ Hiện Tại" ,
attr28 = "Thể Lực Hiện Tại" ,
attr29 = "Thể Lực Tối Đa" ,
attr30 = "Tốc Độ Phục Hồi Thể Lực" ,
}
return attr_list["attr" .. attr_type]
end
----------------
function getAttrStateName(state_type)
local state_list = {
state1 = "Di Chuyển" ,
state2 = "Đặt Khối" ,
state4 = "Tương Tác Khối" ,
state8 = "Phá Vỡ Khối" ,
state16 = "Sử Dụng Vật Phẩm" ,
state32 = "Tấn Công" ,
state64 = "Bị Tấn Công" ,
state128 = "Bị Tiêu Diệt" ,
state256 = "Nhặt Vật Phẩm" ,
state512 = "Rơi Vật Phẩm Khi Chết" ,
state1024 = "Điều Khiển Phương Tiện" ,
state2048 = "Thả Vật Phẩm" ,
}
return state_list["state" .. state_type]
end
----------------
function getEdgeCoordinates(x, y, z, x1, y1, z1)
local coordinates = {}
local stepX, stepY, stepZ = 1, 1, 1
if x1 < x then stepX = -1 end
if y1 < y then stepY = -1 end
if z1 < z then stepZ = -1 end
for i = x, x1, stepX do
table.insert(coordinates, {i, y, z})
table.insert(coordinates, {i, y1, z})
table.insert(coordinates, {i, y, z1})
table.insert(coordinates, {i, y1, z1})
end
for j = y, y1, stepY do
table.insert(coordinates, {x, j, z})
table.insert(coordinates, {x1, j, z})
table.insert(coordinates, {x, j, z1})
table.insert(coordinates, {x1, j, z1})
end
for k = z, z1, stepZ do
table.insert(coordinates, {x, y, k})
table.insert(coordinates, {x, y1, k})
table.insert(coordinates, {x1, y, k})
table.insert(coordinates, {x1, y1, k})
end
local unique_coords = {}
for _, coord in ipairs(coordinates) do
if not unique_coords[coord[1] .. ',' .. coord[2] .. ',' .. coord[3]] then
table.insert(unique_coords, coord)
unique_coords[coord[1] .. ',' .. coord[2] .. ',' .. coord[3]] = true
end
end
return unique_coords
end
----------------
function getAllCoordinates(x, y, z, x1, y1, z1)
local coordinates = {}
local stepX, stepY, stepZ = 1, 1, 1
if x1 < x then stepX = -1 end
if y1 < y then stepY = -1 end
if z1 < z then stepZ = -1 end
for i = x, x1, stepX do
for j = y, y1, stepY do
for k = z, z1, stepZ do
table.insert(coordinates, {i, j, k})
end
end
end
return coordinates
end
----------------
function getType(content)
local lencontent = #content
if string.sub(content, 1, 8) == "@e[type=" and string.sub(content, lencontent, lencontent) == "]" then
type_kill = string.sub(content, 9, lencontent - 1)
end
return type_kill
end
----------------
function getBoxDimensions(x, y, z, x1, y1, z1)
local length = math.abs(x1 - x) + 1
local width = math.abs(y1 - y) + 1
local height = math.abs(z1 - z) + 1
return length, width, height
end
----------------
function splitString(inputString, delimiter, check_type)
local result = {}
local run = true
for substring in string.gmatch(inputString, "[^" .. delimiter .. "]+") do
if tonumber(substring) == nil and check_type == "number" then
run = false
break
end
table.insert(result, substring)
end
return run, result
end
local function find_in(ar, value)
local found = false
local index = 1
for i, element in ipairs(ar) do
if element == tonumber(value) then
found = true
break
end
index = index + 1
end
return index, found
end
----------------
local function true_id(num)
local stringnum = tostring(num)
if #stringnum < 10 then
return tonumber(stringnum) + 10^9
else
return tonumber(stringnum)
end
end
----------------
local function split(text)
local ar = {}
local run = true
local i = 1
for word in text:gmatch("%S+") do
if tonumber(word) == nil and i >= 2 then
run = false
end
table.insert(ar, word)
i = i + 1
end
return run, ar
end
----------------
local function commandChat(event)
local org_text = event.content
local _, org_ar = split(org_text)
local sk = event.eventobjid
if string.sub(org_ar[1], 1, #command_prefix) == command_prefix then
local text = string.lower(org_text)
local run, ar = split(text)
ar[1] = string.sub(ar[1], #command_prefix + 1, #ar[1])
if ar[1] == "give" or ar[1] == "g" then
local _, check_give = find_in(give_list, sk)
local _, check_sk = find_in(admin_list, sk)
if check_give then
if #ar == 1 then
Chat:sendSystemMsg("Cú pháp lệnh gửi vật phẩm:", sk)
Chat:sendSystemMsg("1. #cf7d1c8/g [id vật phẩm]", sk)
Chat:sendSystemMsg("2. #cf7d1c8/g [id vật phẩm] [số lượng]", sk)
if check_sk then
Chat:sendSystemMsg("Cú pháp lệnh gửi vật phẩm dành cho admin:", sk)
Chat:sendSystemMsg("1. #cf7d1c8/g [uid người chơi] [id vật phẩm]", sk)
Chat:sendSystemMsg("2. #cf7d1c8/g [uid người chơi] [id vật phẩm] [số lượng]", sk)
Chat:sendSystemMsg("3. #cf7d1c8/g add [uid người chơi]", sk)
Chat:sendSystemMsg("4. #cf7d1c8/g del [uid người chơi]", sk)
end
else
local _, sk_name = Player:getNickname(sk)
if ar[2] ~= "add" and ar[2] ~= "del" then
local multi_give = false
local give_error = {run = {player = false, item = false, player_leaved = false, num = false}, num = false, data = false}
local give_arg = {player_id = sk, player_name = sk_name, item = nil, item_name = nil, num = 1}
if tonumber(ar[2]) or ar[2] == "@a" or ar[2] == "@a-s" then
if #ar == 2 then
if ar[2] ~= "@a" and ar[2] ~= "@a-s" then
local player_id = true_id(ar[2])
local _, player_name = Player:getNickname(player_id)
if (not player_name) and OrgPlayerName["p" .. player_id] then
give_error.run.player_leaved = true
give_arg.player_id = player_id
else
local item_id = tonumber(ar[2])
give_arg.item = item_id
local _, item_name = Item:getItemName(item_id)
if item_name then
give_arg.item_name = item_name
else
give_error.run.item = true
end
end
else
give_error.num = true
end
else
if tonumber(ar[3]) then
if #ar == 3 then
if ar[2] ~= "@a" and ar[2] ~= "@a-s" then
local player_id = true_id(ar[2])
local _, player_name = Player:getNickname(player_id)
local item_id = tonumber(ar[3])
if player_name then
give_arg.player_id = player_id
give_arg.player_name = player_name
give_arg.item = item_id
local _, item_name = Item:getItemName(item_id)
if item_name then
give_arg.item_name = item_name
else
give_error.run.item = true
end
else
if OrgPlayerName["p" .. player_id] then
give_error.run.player_leaved = true
give_arg.player_id = player_id
else
item_id = tonumber(ar[2])
give_arg.item = item_id
local _, item_name = Item:getItemName(item_id)
if item_name then
give_arg.item_name = item_name
give_arg.num = tonumber(ar[3])
if give_arg.num < 1 then give_error.run.num = true end
else
give_error.run.item = true
end
end
end
else
if ar[2] == "@a" or ar[2] == "@a-s" then
multi_give = true
local item_id = tonumber(ar[3])
give_arg.item = item_id
local _, item_name = Item:getItemName(item_id)
if item_name then
give_arg.item_name = item_name
else
give_error.run.item = true
end
end
end
else
if tonumber(ar[4]) then
if #ar == 4 then
if ar[2] ~= "@a" and ar[2] ~= "@a-s" then
local player_id = true_id(ar[2])
give_arg.player_id = player_id
local _, player_name = Player:getNickname(player_id)
if player_name then
give_arg.player_name = player_name
local item_id = tonumber(ar[3])
give_arg.item = item_id
local _, item_name = Item:getItemName(item_id)
if item_name then
give_arg.item_name = item_name
give_arg.num = tonumber(ar[4])
if give_arg.num < 1 then give_error.run.num = true end
else
give_error.run.item = true
end
else
if OrgPlayerName["p" .. player_id] then
give_error.run.player_leaved = true
else
give_error.run.player = true
end
end
else
if ar[2] == "@a" or ar[2] == "@a-s" then
multi_give = true
local item_id = tonumber(ar[3])
give_arg.item = item_id
local _, item_name = Item:getItemName(item_id)
if item_name then
give_arg.item_name = item_name
give_arg.num = tonumber(ar[4])
if give_arg.num < 1 then give_error.run.num = true end
else
give_error.run.item = true
end
end
end
else
give_error.num = true
end
else
give_error.data = true
end
end
else
give_error.data = true
end
end
else
give_error.data = true
end
if not give_error.data then
if not give_error.num then
if not give_error.run.player_leaved then
if not give_error.run.player then
if not give_error.run.item then
if not give_error.run.num then
if give_arg.player_id == sk then
if not multi_give then
local give_res, give_num = Backpack:addItem(sk, give_arg.item, give_arg.num)
if give_res ~= 0 then
Chat:sendSystemMsg("#RTúi bạn đã đầy hoặc vật phẩm #Y" .. give_arg.item_name .. "#R không thể lấy", sk)
else
if give_num == 0 then
Chat:sendSystemMsg("#RTúi của bạn đã đầy", sk)
else
Chat:sendSystemMsg("#GĐã gửi #Y" .. give_num .. " " .. give_arg.item_name .. "#G cho bạn", sk)
end
end
else
local _, room_num, player_ar = World:getAllPlayers(-1)
if room_num == 1 and ar[2] == "@a-s" then
Chat:sendSystemMsg("#RTrong phòng chỉ có 1 người", sk)
else
if ar[2] == "@a" then
Backpack:addItem(sk, give_arg.item, give_arg.num)
end
for _, player_id in ipairs(player_ar) do
if player_id == sk then
--
else
local _, give_num = Backpack:addItem(player_id, give_arg.item, give_arg.num)
if give_num == 0 then
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#n#G đã gửi #Y" .. give_arg.num .. " " .. give_arg.item_name .. "#G cho #cFFA500mọi người#R nhưng túi của bạn đã đầy", player_id)
else
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#n#G đã gửi #Y" .. give_arg.num .. " " .. give_arg.item_name .. "#G cho #cFFA500mọi người", player_id)
end
end
end
Chat:sendSystemMsg("#GBạn đã gửi #Y" .. give_arg.num .. " " .. give_arg.item_name .. "#G cho #cFFA500mọi người", sk)
end
end
else
if check_sk then
local give_res, give_num = Backpack:addItem(give_arg.player_id, give_arg.item, give_arg.num)
if give_res ~= 0 then
Chat:sendSystemMsg("#RTúi của #cFFA500" .. give_arg.player_name .. "#n#R đã đầy hoặc vật phẩm #Y" .. give_arg.item_name .. "#R không thể lấy", sk)
else
if give_num == 0 then
Chat:sendSystemMsg("#RTúi của #cFFA500" .. give_arg.player_name .. "#n#R đã đầy", sk)
else
Chat:sendSystemMsg("#GĐã gửi #Y" .. give_num .. " " .. give_arg.item_name .. "#G cho #cFFA500" .. give_arg.player_name, sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#n#G đã gửi #Y" .. give_num .. " " .. give_arg.item_name .. "#G cho bạn", give_arg.player_id)
end
end
else
Chat:sendSystemMsg("#RĐây là lệnh chỉ dành cho admin", sk)
end
end
else
Chat:sendSystemMsg("#RSố lượng vật phẩm không hợp lệ ( #Y" .. give_arg.num .. "#R )", sk)
end
else
Chat:sendSystemMsg("#RID vật phẩm #Y" .. give_arg.item .. "#R không tồn tại", sk)
end
else
Chat:sendSystemMsg("#RUID #cFFA500" .. give_arg.player_id .. "#R không tồn tại", sk)
end
else
Chat:sendSystemMsg("#RNgười chơi #cFFA500" .. OrgPlayerName["p" .. give_arg.player_id] .. "#R đã rời phòng", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
if check_sk then
if ar[2] == "add" then
if #ar == 2 then
Chat:sendSystemMsg("Cú pháp lệnh thêm quyền give:", sk)
Chat:sendSystemMsg("#cf7d1c8/g add [uid người chơi]", sk)
elseif #ar == 3 then
if tonumber(ar[3]) then
local player_id = true_id(ar[3])
if player_id ~= sk then
local _, player_name = Player:getNickname(player_id)
if player_name then
local _, check_admin = find_in(admin_list, player_id)
if not check_admin then
local _, checkin_give = find_in(give_list, player_id)
if not checkin_give then
table.insert(give_list, player_id)
Chat:sendSystemMsg("#GBạn đã thêm quyền dùng #B/give#G cho #cFFA500" .. player_name, sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#n#G đã thêm quyền dùng #B/give#G cho bạn", player_id)
else
Chat:sendSystemMsg("#RNgười này đã có quyền dùng #B/give", sk)
end
else
Chat:sendSystemMsg("#RBạn không thể thêm quyền cho admin khác", sk)
end
else
Chat:sendSystemMsg("#RUID #cFFA500" .. player_id .. "#R không tồn tại", sk)
end
else
Chat:sendSystemMsg("#RBạn không thể thêm quyền cho chính mình", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
else
if #ar == 2 then
Chat:sendSystemMsg("Cú pháp lệnh xóa quyền give:", sk)
Chat:sendSystemMsg("#cf7d1c8/g del [uid người chơi]", sk)
elseif #ar == 3 then
if tonumber(ar[3]) then
local player_id = true_id(ar[3])
if player_id ~= sk then
local _, player_name = Player:getNickname(player_id)
if player_name then
local _, check_admin = find_in(admin_list, player_id)
if not check_admin then
local give_index, checkin_give = find_in(give_list, player_id)
if checkin_give then
table.remove(give_list, give_index)
Chat:sendSystemMsg("#GBạn đã xóa quyền dùng #B/give#G cho #cFFA500" .. player_name, sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#n#G đã xóa quyền dùng #B/give#G của bạn", player_id)
else
Chat:sendSystemMsg("#RNgười này chưa có quyền dùng #B/give", sk)
end
else
Chat:sendSystemMsg("#RBạn không thể xóa quyền của admin khác", sk)
end
else
Chat:sendSystemMsg("#RUID #cFFA500" .. player_id .. "#R không tồn tại", sk)
end
else
Chat:sendSystemMsg("#RBạn không thể xóa quyền của chính mình", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
end
else
Chat:sendSystemMsg("#RĐây là lệnh chỉ dành cho admin", sk)
end
end
end
else
Chat:sendSystemMsg("#RBạn không có quyền sử dụng #B\"/give\"#n", sk)
end
elseif ar[1] == "id" then
local res, check_sk = find_in(give_list, sk)
if check_sk then
if #ar == 1 then
local res, item_id = Player:getCurToolID(sk)
local res, item_name = Item:getItemName(item_id)
if item_name == nil then
Chat:sendSystemMsg("#RBạn không có vật phẩm nào trên tay", sk)
else
Chat:sendSystemMsg("#Y" .. item_name .. "#n / #GItem ID: #Y" .. item_id, sk)
end
elseif #ar == 2 then
if ar[2] == "block" then
get_id_block["p"..sk] = true
Chat:sendSystemMsg("#GĐã kích hoạt lệnh, hãy #L#Bclick#n #Gvào block để lấy id", sk)
elseif ar[2] == "creature" then
get_id_creature["p"..sk] = true
Chat:sendSystemMsg("#GĐã kích hoạt lệnh, hãy #L#Bclick#n #Gvào sinh vật để lấy id", sk)
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
else
Chat:sendSystemMsg("#RBạn không có quyền sử dụng #B\"/id\"#n", sk)
end
elseif ar[1] == "kill" then
local res, check_sk = find_in(kill_list, sk)
if check_sk then
if run then
if #ar == 2 then
player_id = true_id(ar[2])
if player_id == sk then
Actor:killSelf(sk)
Chat:sendSystemMsg("#ce32957Bạn đã tiêu diệt chính mình", sk)
else
local res, player_name = Player:getNickname(player_id)
if player_name == nil then
Chat:sendSystemMsg("#RUID #cFFA500" .. player_id .. "#R không tồn tại", sk)
else
local res, sk_name = Player:getNickname(sk)
Actor:killSelf(player_id)
Chat:sendSystemMsg("#ce32957Bạn đã tiêu diệt người chơi #cFFA500" .. player_name, sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#ce32957 đã tiêu diệt bạn", player_id)
end
end
else
local kill_ar = {}
for i = 2, #ar do
player_id = true_id(ar[i])
local res, check_mass_kill = find_in(kill_ar, player_id)
if check_mass_kill then
Chat:sendSystemMsg("#RUID #cFFA500" .. player_id .. "#R đã bị lặp", sk)
else
if player_id == sk then
Actor:killSelf(sk)
Chat:sendSystemMsg("#ce32957Bạn đã tiêu diệt chính mình", sk)
table.insert(kill_ar, sk)
else
local res, player_name = Player:getNickname(player_id)
if player_name == nil then
Chat:sendSystemMsg("#RUID #cFFA500" .. player_id .. "#R không tồn tại", sk)
else
local res, sk_name = Player:getNickname(sk)
Actor:killSelf(player_id)
Chat:sendSystemMsg("#ce32957Bạn đã tiêu diệt người chơi #cFFA500" .. player_name, sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#ce32957 đã tiêu diệt bạn", player_id)
table.insert(kill_ar, player_id)
end
end
end
end
end
else
if #ar == 2 then
if ar[2] == "@s" then
Actor:killSelf(sk)
Chat:sendSystemMsg("#ce32957Bạn đã tiêu diệt chính mình", sk)
elseif ar[2] == "@a" then
local res, num, kill_ar = World:getAllPlayers(1)
for res, player_id in pairs(kill_ar) do
Actor:killSelf(player_id)
end
Chat:sendSystemMsg("#ce32957Tất cả người chơi đã bị tiêu diệt")
elseif string.sub(ar[2], 1, 2) == "@e" then
local type_kill = getType(ar[2])
if ar[2] == "@e" then
for res, creature_id in pairs(creature_list) do
Actor:killSelf(creature_id)
end
creature_list = {}
local res, num, kill_ar = World:getAllPlayers(1)
for res, player_id in pairs(kill_ar) do
Actor:killSelf(player_id)
end
Chat:sendSystemMsg("#ce32957Tất cả người chơi và sinh vật đã bị tiêu diệt")
elseif type_kill then
if type_kill == "player" or type_kill == "p" then
local res, num, kill_ar = World:getAllPlayers(1)
for res, player_id in pairs(kill_ar) do
Actor:killSelf(player_id)
end
Chat:sendSystemMsg("#ce32957Tất cả người chơi đã bị tiêu diệt")
elseif type_kill == "all" or type_kill == "a" then
for res, creature_id in pairs(creature_list) do
Actor:killSelf(creature_id)
end
creature_list = {}
local res, num, kill_ar = World:getAllPlayers(1)
for res, player_id in pairs(kill_ar) do
Actor:killSelf(player_id)
end
Chat:sendSystemMsg("#ce32957Tất cả người chơi và sinh vật đã bị tiêu diệt")
elseif type_kill == "mob" or type_kill == "m" then
for res, creature_id in pairs(creature_list) do
Actor:killSelf(creature_id)
end
creature_list = {}
Chat:sendSystemMsg("#ce32957Tất cả sinh vật đã bị tiêu diệt")
elseif tonumber(type_kill) then
local player_id = true_id(tonumber(type_kill))
if player_id == sk then
Actor:killSelf(sk)
Chat:sendSystemMsg("#ce32957Bạn đã tiêu diệt chính mình", sk)
else
local res, player_name = Player:getNickname(player_id)
if player_name == nil then
Chat:sendSystemMsg("#RUID #cFFA500" .. player_id .. "#R không tồn tại", sk)
else
local res, sk_name = Player:getNickname(sk)
Actor:killSelf(player_id)
Chat:sendSystemMsg("#ce32957Bạn đã tiêu diệt người chơi #cFFA500" .. player_name, sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#ce32957 đã tiêu diệt bạn", player_id)
end
end
elseif type_kill ~= nil then
local kill_run, kill_ar = splitString(type_kill, ",", "number")
for i = 1, #kill_ar do
player_id = true_id(kill_ar[i])
local res, check_mass_kill = find_in(kill_ar, player_id)
if check_mass_kill then
Chat:sendSystemMsg("#RUID #cFFA500" .. player_id .. "#R đã bị lặp", sk)
else
if player_id == sk then
Actor:killSelf(sk)
Chat:sendSystemMsg("#ce32957Bạn đã tiêu diệt chính mình", sk)
table.insert(kill_ar, sk)
else
local res, player_name = Player:getNickname(player_id)
if player_name == nil then
Chat:sendSystemMsg("#RUID #cFFA500" .. player_id .. "#R không tồn tại", sk)
else
local res, sk_name = Player:getNickname(sk)
Actor:killSelf(player_id)
Chat:sendSystemMsg("#ce32957Bạn đã tiêu diệt người chơi #cFFA500" .. player_name, sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#ce32957 đã tiêu diệt bạn", player_id)
table.insert(kill_ar, player_id)
end
end
end
end
end
end
elseif ar[2] == "@a-s" then
local res, player_alive, kill_ar = World:getAllPlayers(1)
local res, num, all_player = World:getAllPlayers(-1)
local res, val = Player:getAttr(sk, 2)
if val ~= 0 then
player_alive = player_alive - 1
end
if num > 1 then
if player_alive >= 1 then
local res, sk_name = Player:getNickname(sk)
for res, player_id in pairs(kill_ar) do
if player_id == sk then
--
else
Actor:killSelf(player_id)
end
end
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#ce32957 đã tiêu diệt tất cả người chơi")
else
Chat:sendSystemMsg("#RTất cả người chơi đã chết, không có ai để tiêu diệt", sk)
end
else
Chat:sendSystemMsg("#RTrong phòng chỉ có 1 mình bạn, không có ai để tiêu diệt", sk)
end
elseif ar[2] == "@p" then
local res, player_alive, kill_ar = World:getAllPlayers(1)
local res, num, all_player = World:getAllPlayers(-1)
if num > 1 then
local i, sk_in_ar = find_in(kill_ar, sk)
if sk_in_ar then
table.remove(kill_ar, i)
end
if #kill_ar == 0 then
Chat:sendSystemMsg("#RTất cả người chơi đã chết, không có ai để tiêu diệt", sk)
elseif #kill_ar == 1 then
local kill_choice = kill_ar[1]
local res, kill_choice_name = Player:getNickname(kill_choice)
local res, sk_name = Player:getNickname(sk)
Actor:killSelf(kill_choice)
Chat:sendSystemMsg("#ce32957Trong phạm vi gần nhất, bạn đã tiêu diệt #cFFA500" .. kill_choice_name, sk)
Chat:sendSystemMsg("#ce32957Trong phạm vi gần nhất, #cFFA500" .. sk_name .. "#ce32957 đã tiêu diệt bạn", kill_choice)
else
local dis_ar = {}
local res, x0, y0, z0 = Player:getAimPos(sk)
for res, player_id in ipairs(kill_ar) do
local res, x1, y1, z1 = Player:getAimPos(player_id)
local dis = distance(x0, y0, z0, x, y, z)
table.insert(dis_ar, dis)
end
local min_index, min_dis = min_element(dis_ar)
local kill_choice = kill_ar[min_index]
local res, kill_choice_name = Player:getNickname(kill_choice)
local res, sk_name = Player:getNickname(sk)
Actor:killSelf(kill_choice)
Chat:sendSystemMsg("#ce32957Trong phạm vi gần nhất, bạn đã tiêu diệt #cFFA500" .. kill_choice_name, sk)
Chat:sendSystemMsg("#ce32957Trong phạm vi gần nhất, #cFFA500" .. sk_name .. "#ce32957 đã tiêu diệt bạn", kill_choice)
end
else
Chat:sendSystemMsg("#RTrong phòng chỉ có 1 mình bạn, không có ai để tiêu diệt", sk)
end
elseif ar[2] == "@r" then
local res, player_alive, kill_ar = World:getAllPlayers(1)
if player_alive > 0 then
local kill_choice_num = math.random(1, #kill_ar)
local kill_choice = kill_ar[kill_choice_num]
local res, kill_choice_name = Player:getNickname(kill_choice)
Actor:killSelf(kill_choice)
if kill_choice == sk then
Chat:sendSystemMsg("#ce32957Bạn đã được lựa chọn để bị tiêu diệt", sk)
else
Chat:sendSystemMsg("#cFFA500" .. kill_choice_name .. "#ce32957 đã được lựa chọn để bị tiêu diệt", sk)
Chat:sendSystemMsg("#ce32957Bạn đã được lựa chọn để bị tiêu diệt", kill_choice)
end
else
Chat:sendSystemMsg("#RTất cả người chơi đã chết, không có ai để lựa chọn", sk)
end
elseif ar[2] == "@r-s" then
local res, player_alive, kill_ar = World:getAllPlayers(1)
local res, num, all_player = World:getAllPlayers(-1)
if num > 1 then
local i, sk_in_ar = find_in(kill_ar, sk)
if sk_in_ar then
table.remove(kill_ar, i)
end
if #kill_ar == 0 then
Chat:sendSystemMsg("#RTất cả người chơi đã chết, không có ai để lựa chọn", sk)
elseif #kill_ar == 1 then
local kill_choice = kill_ar[1]
local res, kill_choice_name = Player:getNickname(kill_choice)
Actor:killSelf(kill_choice)
Chat:sendSystemMsg("#cFFA500" .. kill_choice_name .. "#ce32957 đã được lựa chọn để bị tiêu diệt", sk)
Chat:sendSystemMsg("#ce32957Bạn đã được lựa chọn để bị tiêu diệt", kill_choice)
else
local kill_choice_num = math.random(1, #kill_ar)
local kill_choice = kill_ar[kill_choice_num]
local res, kill_choice_name = Player:getNickname(kill_choice)
Actor:killSelf(kill_choice)
Chat:sendSystemMsg("#cFFA500" .. kill_choice_name .. "#ce32957 đã được lựa chọn để bị tiêu diệt", sk)
Chat:sendSystemMsg("#ce32957Bạn đã được lựa chọn để bị tiêu diệt", kill_choice)
end
else
Chat:sendSystemMsg("#RTrong phòng chỉ có 1 mình bạn, không có ai để lựa chọn", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
end
else
Chat:sendSystemMsg("#RBạn không có quyền sử dụng #B\"/kill\"#n", sk)
end
elseif ar[1] == "tp" then
local res, check_sk = find_in(tp_list, sk)
if check_sk then
if run then
if #ar == 2 then
local to_id = true_id(ar[2])
if to_id == sk then
Chat:sendSystemMsg("#RBạn không thể dịch chuyển đến vị trí của chính mình", sk)
else
local res, to_id_name = Player:getNickname(to_id)
if to_id_name == nil then
Chat:sendSystemMsg("#RUID #cFFA500" .. to_id .. "#R không tồn tại", sk)
else
local res, sk_name = Player:getNickname(sk)
local res, x1, z1, y1 = Player:getPosition(to_id)
--x1, z1, y1 = math.floor(x1), math.floor(z1), math.floor(y1)
Player:setPosition(sk, x1, z1, y1)
Chat:sendSystemMsg("#GBạn đã dịch chuyển đến vị trí của #cFFA500" .. to_id_name, sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã dịch chuyển đến vị trí của bạn", to_id)
end
end
elseif #ar == 3 then
local from_id = true_id(ar[2])
local to_id = true_id(ar[3])
if from_id == to_id then
Chat:sendSystemMsg("#RKhông thể nhập UID của cùng 1 người", sk)
else
local res, from_id_name = Player:getNickname(from_id)
local res, to_id_name = Player:getNickname(to_id)
if from_id_name == nil then
Chat:sendSystemMsg("#RUID #cFFA500" .. from_id .. "#R không tồn tại", sk)
else
if to_id_name == nil then
Chat:sendSystemMsg("#RUID #cFFA500" .. to_id .. "#R không tồn tại", sk)
else
local res, x1, z1, y1 = Player:getPosition(to_id)
--x1, z1, y1 = math.floor(x1), math.floor(z1), math.floor(y1)
Player:setPosition(from_id, x1, z1, y1)
Chat:sendSystemMsg("#GBạn đã dịch chuyển đến vị trí của #cFFA500" .. to_id_name, from_id)
Chat:sendSystemMsg("#cFFA500" .. from_id_name .. "#G đã dịch chuyển đến vị trí của bạn", to_id)
end
end
end
elseif #ar == 4 then
local x1, z1, y1 = tonumber(ar[2]), tonumber(ar[3]), tonumber(ar[4])
--x1, z1, y1 = math.floor(x1), math.floor(z1), math.floor(y1)
if z1 < 1 then
Chat:sendSystemMsg("#RKhông thể nhập cаᴏ độ âm", sk)
else
Player:setPosition(sk, x1, z1, y1)
Chat:sendSystemMsg("#GBạn đã dịch chuyển đến vị trí ( #cFFA500" .. x1 .. "#G, #cFFA500" .. z1 .. "#G, #cFFA500" .. y1 .. "#G)", sk)
end
elseif #ar == 5 then
local from_id = true_id(ar[2])
local x1, z1, y1 = tonumber(ar[3]), tonumber(ar[4]), tonumber(ar[5])
--x1, z1, y1 = math.floor(x1), math.floor(z1), math.floor(y1)
if from_id == sk then
if z1 < 1 then
Chat:sendSystemMsg("#RKhông thể nhập cаᴏ độ nhỏ hơn 1", sk)
else
Player:setPosition(sk, x1, z1, y1)
Chat:sendSystemMsg("#GBạn đã dịch chuyển đến vị trí ( #cFFA500" .. x1 .. "#G, #cFFA500" .. z1 .. "#G, #cFFA500" .. y1 .. "#G)", sk)
end
else
local res, from_id_name = Player:getNickname(from_id)
if from_id_name == nil then
Chat:sendSystemMsg("#RUID #cFFA500" .. from_id .. "#R không tồn tại", sk)
else
if z1 < 1 then
Chat:sendSystemMsg("#RKhông thể nhập cаᴏ độ nhỏ hơn 1", sk)
else
local res, sk_name = Player:getNickname(sk)
Player:setPosition(from_id, x1, z1, y1)
Chat:sendSystemMsg("#cFFA500" .. from_id_name .. "#G đã dịch chuyển đến vị trí ( #cFFA500" .. x1 .. "#G, #cFFA500" .. z1 .. "#G, #cFFA500" .. y1 .. "#G)", sk)
Chat:sendSystemMsg("#GBạn đã được #cFFA500" .. sk_name .. " #G dịch chuyển đến vị trí ( #cFFA500" .. x1 .. "#G, #cFFA500" .. z1 .. "#G, #cFFA500" .. y1 .. "#G)", from_id)
end
end
end
end
else
if ar[2] == "@a" then
if #ar == 3 then
local to_id = true_id(ar[3])
local res, to_id_name = Player:getNickname(to_id)
if to_id_name == nil then
Chat:sendSystemMsg("#RUID #cFFA500" .. to_id .. "#R không tồn tại", sk)
else
local res, num, player_ar = World:getAllPlayers(-1)
if num == 1 then
Chat:sendSystemMsg("#RTrong phòng chỉ có 1 mình bạn, không có ai để dịch chuyển", sk)
else
local to_id_index, to_id_find = find_in(player_ar, to_id_name)
table.remove(player_ar, to_id_index)
local res, x1, z1, y1 = Player:getPosition(to_id)
--x1, z1, y1 = math.floor(x1), math.floor(z1), math.floor(y1)
for res, from_id in ipairs(player_ar) do
Player:setPosition(from_id, x1, z1, y1)
Chat:sendSystemMsg("#GTất cả mọi người đã dịch chuyển đến vị trí của #cFFA500" .. to_id_name, from_id)
end
Chat:sendSystemMsg("#GTất cả mọi người đã dịch chuyển đến vị trí của bạn", to_id)
end
end
elseif #ar == 5 then
local x1, z1, y1 = tonumber(ar[3]), tonumber(ar[4]), tonumber(ar[5])
--x1, z1, y1 = math.floor(x1), math.floor(z1), math.floor(y1)
if z1 < 1 then
Chat:sendSystemMsg("#RKhông thể nhập cаᴏ độ nhỏ hơn 1", sk)
else
local res, num, player_ar = World:getAllPlayers(-1)
for res, from_id in ipairs(player_ar) do
Player:setPosition(from_id, x1, z1, y1)
Chat:sendSystemMsg("#GTất cả người chơi đã dịch chuyển đến vị trí ( #cFFA500" .. x1 .. "#G, #cFFA500" .. z1 .. "#G, #cFFA500" .. y1 .. "#G)", from_id)
end
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
elseif ar[2] == "@a-s" then
if #ar == 3 then
local to_id = true_id(ar[3])
local res, to_id_name = Player:getNickname(to_id)
if to_id_name == nil then
Chat:sendSystemMsg("#RUID #cFFA500" .. to_id .. "#R không tồn tại", sk)
else
local res, num, player_ar = World:getAllPlayers(-1)
if num == 1 then
Chat:sendSystemMsg("#RTrong phòng chỉ có 1 mình bạn, không có ai để dịch chuyển", sk)
else
local to_id_index, to_id_find = find_in(player_ar, to_id_name)
table.remove(player_ar, to_id_index)
local res, x1, z1, y1 = Player:getPosition(to_id)
--x1, z1, y1 = math.floor(x1), math.floor(z1), math.floor(y1)
for res, from_id in ipairs(player_ar) do
if from_id == sk then
--
else
Player:setPosition(from_id, x1, z1, y1)
Chat:sendSystemMsg("#GTất cả mọi người đã dịch chuyển đến vị trí của #cFFA500" .. to_id_name, from_id)
end
end
Chat:sendSystemMsg("#GTất cả mọi người đã dịch chuyển đến vị trí của bạn", to_id)
end
end
elseif #ar == 5 then
local x1, z1, y1 = tonumber(ar[3]), tonumber(ar[4]), tonumber(ar[5])
--x1, z1, y1 = math.floor(x1), math.floor(z1), math.floor(y1)
if z1 < 1 then
Chat:sendSystemMsg("#RKhông thể nhập cаᴏ độ nhỏ hơn 1", sk)
else
local res, num, player_ar = World:getAllPlayers(-1)
local i, sk_in_ar = find_in(player_ar, sk)
if sk_in_ar then
table.remove(player_ar, i)
end
for res, from_id in ipairs(player_ar) do
Player:setPosition(from_id, x1, z1, y1)
Chat:sendSystemMsg("#GTất cả người chơi đã dịch chuyển đến vị trí ( #cFFA500" .. x1 .. "#G, #cFFA500" .. z1 .. "#G, #cFFA500" .. y1 .. "#G)", from_id)
end
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
end
else
Chat:sendSystemMsg("#RBạn không có quyền sử dụng #B\"/tp\"#n", sk)
end
elseif ar[1] == "time" then
local res, check_sk = find_in(tp_list, sk)
if check_sk then
if run then
else
if #ar == 3 then
if ar[2] == "set" then
world_time = tonumber(ar[3])
if world_time == nil then
local res, sk_name = Player:getNickname(sk)
if ar[3] == "day" then
world_time = 7
World:setHours(world_time)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi thời gian thành #Y" .. world_time .. "#G giờ")
elseif ar[3] == "night" then
world_time = 19
World:setHours(world_time)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi thời gian thành #Y" .. world_time .. "#G giờ")
elseif ar[3] == "midday" then
world_time = 12
World:setHours(world_time)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi thời gian thành #Y" .. world_time .. "#G giờ")
elseif ar[3] == "midnight" then
world_time = 24
World:setHours(world_time)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi thời gian thành #Y" .. world_time .. "#G giờ")
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
world_time = world_time % 24
if world_time == 0 then
world_time = 24
end
if world_time < 1 or world_time > 24 then
Chat:sendSystemMsg("#b#cFF0000Lỗi: Thời gian không hợp lệ", sk)
else
World:setHours(world_time)
local res, sk_name = Player:getNickname(sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi thời gian thành #Y" .. world_time .. "#G giờ")
end
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
end
else
Chat:sendSystemMsg("#RBạn không có quyền sử dụng #B\"/time\"#n", sk)
end
elseif ar[1] == "weather" then
local res, check_sk = find_in(tp_list, sk)
if check_sk then
if ar[2] == "set" then
local res, sk_name = Player:getNickname(sk)
if #ar == 3 then
if tonumber(ar[3]) then
local world_weather = math.floor(tonumber(ar[3]))
if world_weather == 0 then
GameRule.Weather = world_weather
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi thời tiết thành #YNắng #cFFA500& #BMưa")
elseif world_weather == 1 then
GameRule.Weather = world_weather
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi thời tiết thành #YTrời Nắng")
elseif world_weather == 2 then
GameRule.Weather = world_weather
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi thời tiết thành #BTrời Mưa")
else
Chat:sendSystemMsg("#RGiá trị không hợp lệ", sk)
Chat:sendSystemMsg("#R> #YNắng #cFFA500& #BMưa #W[ 0 ]", sk)
Chat:sendSystemMsg("#R> #YNắng #W[ 1 ]", sk)
Chat:sendSystemMsg("#R> #BMưa #W[ 2 ]", sk)
end
elseif ar[3] == "sunny&rainy" or ar[3] == "rainy&sunny" or ar[3] == "sun&rain" or ar[3] == "rain&sun" then
GameRule.Weather = 0
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi thời tiết thành #YNắng #cFFA500& #BMưa")
elseif ar[3] == "sunny" or ar[3] == "sun" then
GameRule.Weather = 1
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi thời tiết thành #YTrời Nắng")
elseif ar[3] == "rainy" or ar[3] == "rain" then
GameRule.Weather = 2
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi thời tiết thành #BTrời Mưa")
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
else
if #ar == 1 then
local cur_weather = GameRule.Weather
if cur_weather == 0 then
Chat:sendSystemMsg("#GThời tiết hiện tại đang là: #YNắng #cFFA500& #BMưa", sk)
elseif cur_weather == 1 then
Chat:sendSystemMsg("#GThời tiết hiện tại đang là: #YTrời Nắng", sk)
elseif cur_weather == 2 then
Chat:sendSystemMsg("#GThời tiết hiện tại đang là: #BTrời Mưa", sk)
elseif cur_weather == 3 then
Chat:sendSystemMsg("#GThời tiết hiện tại đang là: #c0976d6Trời Giông (Có Sấm Sét)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
end
else
Chat:sendSystemMsg("#RBạn không có quyền sử dụng #B\"/weather\"#n", sk)
end
elseif ar[1] == "area" or ar[1] == "a" then
local i, check_sk = find_in(admin_list, sk)
if check_sk then
if ar[2] == "set" then
if ar[3] == "start" or ar[3] == "s" then
if ar[4] == "here" then
if #ar == 4 then
if (not area_start_pos) and (not area_end_pos) then
local res, x1, z1, y1 = Player:getPosition(sk)
x1, z1, y1 = math.floor(x1), math.floor(z1), math.floor(y1)
if z1 < 0 or z1 > 256 then
Chat:sendSystemMsg("#RKhông thể lấy cаᴏ độ âm hoặc lớn hơn 256", sk)
else
Block:placeBlock(963, x1, z1, y1, 0)
area_start_pos = {x1, z1, y1}
local res, sk_name = Player:getNickname(sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã tạo điểm bắt đầu khu vực mới tại tọa độ ( #cFFA500" .. x1 .. "#G, #cFFA500" .. z1 .. "#G, #cFFA500" .. y1 .. "#G)")
end
elseif area_start_pos and (not area_end_pos) then
local res, x1, z1, y1 = Player:getPosition(sk)
x1, z1, y1 = math.floor(x1), math.floor(z1), math.floor(y1)
if z1 < 0 or z1 > 256 then
Chat:sendSystemMsg("#RKhông thể lấy cаᴏ độ âm hoặc lớn hơn 256", sk)
else
Block:destroyBlock(area_start_pos[1], area_start_pos[2], area_start_pos[3], false)
Block:placeBlock(963, x1, z1, y1, 0)
area_start_pos = {x1, z1, y1}
local res, sk_name = Player:getNickname(sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi điểm bắt đầu khu vực thành tọa độ ( #cFFA500" .. x1 .. "#G, #cFFA500" .. z1 .. "#G, #cFFA500" .. y1 .. "#G)")
end
elseif area_start_pos and area_end_pos then
local res, x1, z1, y1 = Player:getPosition(sk)
x1, z1, y1 = math.floor(x1), math.floor(z1), math.floor(y1)
if z1 < 0 or z1 > 256 then
Chat:sendSystemMsg("#RKhông thể lấy cаᴏ độ âm hoặc lớn hơn 256", sk)
else
for _, coord in ipairs(ECoords) do
Block:destroyBlock(coord[1], coord[2], coord[3], false)
end
Block:placeBlock(963, x1, z1, y1, 0)
area_start_pos = {x1, z1, y1}
ECoords = getEdgeCoordinates(area_start_pos[1], area_start_pos[2], area_start_pos[3], area_end_pos[1], area_end_pos[2], area_end_pos[3])
for _, coord in ipairs(ECoords) do
Block:placeBlock(118, coord[1], coord[2], coord[3], 0)
end
local res, sk_name = Player:getNickname(sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi điểm bắt đầu khu vực thành tọa độ ( #cFFA500" .. x1 .. "#G, #cFFA500" .. z1 .. "#G, #cFFA500" .. y1 .. "#G)")
Chat:sendSystemMsg("#GKhu vực đã thay đổi")
end
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
else
if #ar == 6 then
local x1, z1, y1 = tonumber(ar[4]), tonumber(ar[5]), tonumber(ar[6])
if x1 and z1 and y1 then
if z1 < 0 or z1 > 256 then
Chat:sendSystemMsg("#RKhông thể lấy cаᴏ độ âm hoặc lớn hơn 256", sk)
else
x1, z1, y1 = math.floor(x1), math.floor(z1), math.floor(y1)
if ECoords then
for _, coord in ipairs(ECoords) do
Block:destroyBlock(coord[1], coord[2], coord[3], false)
end
area_start_pos = {x1, z1, y1}
ECoords = getEdgeCoordinates(area_start_pos[1], area_start_pos[2], area_start_pos[3], area_end_pos[1], area_end_pos[2], area_end_pos[3])
for _, coord in ipairs(ECoords) do
Block:placeBlock(118, coord[1], coord[2], coord[3], 0)
end
local res, sk_name = Player:getNickname(sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi điểm bắt đầu khu vực thành tọa độ ( #cFFA500" .. x1 .. "#G, #cFFA500" .. z1 .. "#G, #cFFA500" .. y1 .. "#G)")
Chat:sendSystemMsg("#GKhu vực đã thay đổi")
else
if area_start_pos then
Block:destroyBlock(area_start_pos[1], area_start_pos[2], area_start_pos[3], false)
Block:placeBlock(963, x1, z1, y1, 0)
area_start_pos = {x1, z1, y1}
local res, sk_name = Player:getNickname(sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi điểm bắt đầu khu vực thành tọa độ ( #cFFA500" .. x1 .. "#G, #cFFA500" .. z1 .. "#G, #cFFA500" .. y1 .. "#G)")
else
Block:placeBlock(963, x1, z1, y1, 0)
area_start_pos = {x1, z1, y1}
local res, sk_name = Player:getNickname(sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã tạo điểm bắt đầu khu vực mới tại tọa độ ( #cFFA500" .. x1 .. "#G, #cFFA500" .. z1 .. "#G, #cFFA500" .. y1 .. "#G)")
end
end
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
end
elseif ar[3] == "end" or ar[3] == "e" then
if ar[4] == "here" then
if area_start_pos and (not area_end_pos) then
local res, x1, z1, y1 = Player:getPosition(sk)
x1, z1, y1 = math.floor(x1), math.floor(z1), math.floor(y1)
if z1 < 0 or z1 > 256 then
Chat:sendSystemMsg("#RKhông thể lấy cаᴏ độ âm hoặc lớn hơn 256", sk)
else
area_end_pos = {x1, z1, y1}
ECoords = getEdgeCoordinates(area_start_pos[1], area_start_pos[2], area_start_pos[3], area_end_pos[1], area_end_pos[2], area_end_pos[3])
for _, coord in ipairs(ECoords) do
Block:placeBlock(118, coord[1], coord[2], coord[3], 0)
end
local res, sk_name = Player:getNickname(sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã tạo điểm kết thúc khu vực tại tọa độ ( #cFFA500" .. x1 .. "#G, #cFFA500" .. z1 .. "#G, #cFFA500" .. y1 .. "#G)")
Chat:sendSystemMsg("#GKhu vực mới đã được tạo")
end
elseif area_start_pos and area_end_pos then
local res, x1, z1, y1 = Player:getPosition(sk)
x1, z1, y1 = math.floor(x1), math.floor(z1), math.floor(y1)
if z1 < 0 or z1 > 256 then
Chat:sendSystemMsg("#RKhông thể lấy cаᴏ độ âm hoặc lớn hơn 256", sk)
else
for _, coord in ipairs(ECoords) do
Block:destroyBlock(coord[1], coord[2], coord[3], false)
end
area_end_pos = {x1, z1, y1}
ECoords = getEdgeCoordinates(area_start_pos[1], area_start_pos[2], area_start_pos[3], area_end_pos[1], area_end_pos[2], area_end_pos[3])
for _, coord in ipairs(ECoords) do
Block:placeBlock(118, coord[1], coord[2], coord[3], 0)
end
local res, sk_name = Player:getNickname(sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay điểm kết thúc khu vực thành tọa độ ( #cFFA500" .. x1 .. "#G, #cFFA500" .. z1 .. "#G, #cFFA500" .. y1 .. "#G)")
Chat:sendSystemMsg("#GKhu vực đã thay đổi")
end
else
Chat:sendSystemMsg("#RTọa độ điểm bắt đầu khu vực chưa được tạo", sk)
end
else
if #ar == 6 then
local x1, z1, y1 = tonumber(ar[4]), tonumber(ar[5]), tonumber(ar[6])
if x1 and z1 and y1 then
if z1 < 0 or z1 > 256 then
Chat:sendSystemMsg("#RKhông thể lấy cаᴏ độ âm hoặc lớn hơn 256", sk)
else
x1, z1, y1 = math.floor(x1), math.floor(z1), math.floor(y1)
if ECoords then
for _, coord in ipairs(ECoords) do
Block:destroyBlock(coord[1], coord[2], coord[3], false)
end
area_end_pos = {x1, z1, y1}
ECoords = getEdgeCoordinates(area_start_pos[1], area_start_pos[2], area_start_pos[3], area_end_pos[1], area_end_pos[2], area_end_pos[3])
for _, coord in ipairs(ECoords) do
Block:placeBlock(118, coord[1], coord[2], coord[3], 0)
end
local res, sk_name = Player:getNickname(sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay điểm kết thúc khu vực thành tọa độ ( #cFFA500" .. x1 .. "#G, #cFFA500" .. z1 .. "#G, #cFFA500" .. y1 .. "#G)")
Chat:sendSystemMsg("#GKhu vực đã thay đổi")
else
if area_start_pos then
area_end_pos = {x1, z1, y1}
ECoords = getEdgeCoordinates(area_start_pos[1], area_start_pos[2], area_start_pos[3], area_end_pos[1], area_end_pos[2], area_end_pos[3])
for _, coord in ipairs(ECoords) do
Block:placeBlock(118, coord[1], coord[2], coord[3], 0)
end
local res, sk_name = Player:getNickname(sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã tạo điểm kết thúc khu vực tại tọa độ ( #cFFA500" .. x1 .. "#G, #cFFA500" .. z1 .. "#G, #cFFA500" .. y1 .. "#G)")
Chat:sendSystemMsg("#GKhu vực mới đã được tạo")
else
Chat:sendSystemMsg("#RTọa độ điểm bắt đầu khu vực chưa được tạo", sk)
end
end
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
end
elseif ar[3] == "area" or ar[3] == "a" then
if #ar == 9 then
local x, z, y = tonumber(ar[4]), tonumber(ar[5]), tonumber(ar[6])
local x1, z1, y1 = tonumber(ar[7]), tonumber(ar[8]), tonumber(ar[9])
if x == nil or z == nil or y == nil or x1 == nil or z1 == nil or y1 == nil then
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
else
if z < 0 or z > 256 or z1 < 0 or z1 > 256 then
Chat:sendSystemMsg("#RKhông thể nhập cаᴏ độ âm hoặc lớn hơn 256", sk)
else
x, z, y = math.floor(x), math.floor(z), math.floor(y)
x1, z1, y1 = math.floor(x1), math.floor(z1), math.floor(y1)
if area_start_pos and area_end_pos then
for _, coord in ipairs(ECoords) do
Block:destroyBlock(coord[1], coord[2], coord[3], false)
end
area_start_pos, area_end_pos = {x, z, y}, {x1, z1, y1}
ECoords = getEdgeCoordinates(area_start_pos[1], area_start_pos[2], area_start_pos[3], area_end_pos[1], area_end_pos[2], area_end_pos[3])
for _, coord in ipairs(ECoords) do
Block:placeBlock(118, coord[1], coord[2], coord[3], 0)
end
local res, sk_name = Player:getNickname(sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay điểm bắt đầu khu vực thành tọa độ ( #cFFA500" .. x .. "#G, #cFFA500" .. z .. "#G, #cFFA500" .. y .. "#G) và điểm kết thúc khu vực thành tọa độ ( #cFFA500" .. x1 .. "#G, #cFFA500" .. z1 .. "#G, #cFFA500" .. y1 .. "#G)")
Chat:sendSystemMsg("#GKhu vực đã thay đổi")
end
end
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
end
elseif ar[2] == "fill" then
if #ar == 3 then
if ar[3] == "none" or ar[3] == "air" then
if ECoords then
local ACoords = getAllCoordinates(area_start_pos[1], area_start_pos[2], area_start_pos[3], area_end_pos[1], area_end_pos[2], area_end_pos[3])
for _, coord in ipairs(ACoords) do
Block:destroyBlock(coord[1], coord[2], coord[3], false)
end
local res, sk_name = Player:getNickname(sk)
local area_length, area_width, area_height = getBoxDimensions(area_start_pos[1], area_start_pos[3], area_start_pos[2], area_end_pos[1], area_end_pos[3], area_end_pos[2])
ECoords, area_start_pos, area_end_pos = nil, nil, nil
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã xóa tất cả khối trong một khu vực")
Chat:sendSystemMsg("#GThể tích: #Y" .. #ACoords)
Chat:sendSystemMsg("#GDiện tích đáy: #Y" .. area_length .. "#cFFA500 x #Y" .. area_width .. "#cFFA500 / #GChiều cаᴏ: #Y" .. area_height)
else
Chat:sendSystemMsg("#RKhu vực chưa được tạo", sk)
end
elseif tonumber(ar[3]) then
if ECoords then
local area_block_id = tonumber(ar[3])
local res, area_item_name = Item:getItemName(area_block_id)
if area_item_name then
local area_block = true
local ACoords = getAllCoordinates(area_start_pos[1], area_start_pos[2], area_start_pos[3], area_end_pos[1], area_end_pos[2], area_end_pos[3])
local area_length, area_width, area_height = getBoxDimensions(area_start_pos[1], area_start_pos[3], area_start_pos[2], area_end_pos[1], area_end_pos[3], area_end_pos[2])
for _, coord in ipairs(ACoords) do
Block:placeBlock(area_block_id, coord[1], coord[2], coord[3], 0)
local res, area_block_at_pos = Block:getBlockID(coord[1], coord[2], coord[3])
if area_block_at_pos == 0 then
area_block = false
break
end
end
if area_block then
local res, sk_name = Player:getNickname(sk)
ECoords, area_start_pos, area_end_pos = nil, nil, nil
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã lấp đầy một khu vực bằng #Y" .. area_item_name)
Chat:sendSystemMsg("#GThể tích: #Y" .. #ACoords)
Chat:sendSystemMsg("#GDiện tích đáy: #Y" .. area_length .. "#cFFA500 x #Y" .. area_width .. "#cFFA500 / #GChiều cаᴏ: #Y" .. area_height)
else
Chat:sendSystemMsg("#RID khối #Y" .. area_block_id .. "#R không tồn tại", sk)
end
else
Chat:sendSystemMsg("#RID khối #Y" .. area_block_id .. "#R không tồn tại", sk)
end
else
Chat:sendSystemMsg("#RKhu vực chưa được tạo", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
end
elseif ar[2] == "replace" then
if ECoords then
local replace_block, replace_to_block = {}, {}
local replace_run = true
for i, replace_element in ipairs(ar) do
Chat:sendSystemMsg("Đang kiểm tra dữ liệu...", sk)
if i > 2 then
local check_equal = string.find(ar[i], "=", 1)
if check_equal then
local res, replace_ar = splitString(ar[i], "=", false)
if #replace_ar == 2 then
if tonumber(replace_ar[1]) and tonumber(replace_ar[2]) then
table.insert(replace_block, tonumber(replace_ar[1]))
table.insert(replace_to_block, tonumber(replace_ar[2]))
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)#R--" .. ar[i], sk)
replace_run = false
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)#R--" .. ar[i], sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)#R--" .. ar[i], sk)
replace_run = false
end
end
end
if replace_run then
--for _, coord in ipairs(ECoords) do
--end
end
else
Chat:sendSystemMsg("#RKhu vực chưa được tạo", sk)
end
elseif ar[2] == "del" then
if #ar == 3 then
if ar[3] == "area" or ar[3] == "a" then
if ECoords then
for _, coord in ipairs(ECoords) do
Block:destroyBlock(coord[1], coord[2], coord[3], false)
end
local res, sk_name = Player:getNickname(sk)
local area_length, area_width, area_height = getBoxDimensions(area_start_pos[1], area_start_pos[3], area_start_pos[2], area_end_pos[1], area_end_pos[3], area_end_pos[2])
ECoords, area_start_pos, area_end_pos = nil, nil, nil
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã xóa một khu vực")
Chat:sendSystemMsg("#GThể tích: #Y" .. area_length*area_width*area_height)
Chat:sendSystemMsg("#GDiện tích đáy: #Y" .. area_length .. "#cFFA500 x #Y" .. area_width .. "#cFFA500 / #GChiều cаᴏ: #Y" .. area_height)
else
Chat:sendSystemMsg("#RKhu vực chưa được tạo", sk)
end
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
end
else
Chat:sendSystemMsg("#RĐây là lệnh chỉ dành cho admin", sk)
end
elseif ar[1] == "set" then
local i, check_sk = find_in(admin_list, sk)
if check_sk then
if ar[2] == "attr" then
if #ar == 4 then
local attr_type, attr_value = tonumber(ar[3]), tonumber(ar[4])
if attr_type and attr_value then
local attr_name = getAttrName(attr_type)
if attr_name then
if attr_value < 0 then
Chat:sendSystemMsg("#RKhông thể nhập giá trị thuộc tính âm", sk)
else
Player:setAttr(sk, attr_type, attr_value)
Chat:sendSystemMsg("#GĐã thay đổi #Y" .. attr_name .. "#G thành: #Y" .. attr_value, sk)
end
else
Chat:sendSystemMsg("#RLoại thuộc tính không tồn tại", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
elseif #ar == 5 then
if tonumber(ar[3]) then
local player_id, attr_type, attr_value = true_id(ar[3]), tonumber(ar[4]), tonumber(ar[5])
local _, player_name = Player:getNickname(player_id)
if player_name then
if attr_type and attr_value then
local attr_name = getAttrName(attr_type)
if attr_name then
if attr_value < 0 then
Chat:sendSystemMsg("#RKhông thể nhập giá trị thuộc tính âm", sk)
else
if player_id == sk then
Player:setAttr(sk, attr_type, attr_value)
Chat:sendSystemMsg("#GĐã thay đổi thuộc tính #Y" .. attr_name .. "#G của bạn thành: #Y" .. attr_value, sk)
else
local res, sk_name = Player:getNickname(sk)
Player:setAttr(player_id, attr_type, attr_value)
Chat:sendSystemMsg("#GĐã thay đổi thuộc tính #Y" .. attr_name .. "#G của #cFFA500" .. player_name .. "#G thành: #Y" .. attr_value, sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi thuộc tính #Y" .. attr_name .. "#G của bạn thành: #Y" .. attr_value, player_id)
end
end
else
Chat:sendSystemMsg("#RLoại thuộc tính không tồn tại", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
local creature_id = tonumber(ar[3])
local _, creature_name = Creature:getActorName(creature_id)
if creature_name then
if attr_type and attr_value then
local attr_name = getAttrName(attr_type)
if attr_name then
if attr_value < 0 then
Chat:sendSystemMsg("#RKhông thể nhập giá trị thuộc tính âm", sk)
else
Creature:setAttr(creature_id, attr_type, attr_value)
Chat:sendSystemMsg("#GĐã thay đổi thuộc tính #Y" .. attr_name .. "#G của #cFFA500" .. creature_name .. "#G thành: #Y" .. attr_value, sk)
end
else
Chat:sendSystemMsg("#RLoại thuộc tính không tồn tại", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#RUID #cFFA500" .. player_id .. "#R không tồn tại", sk)
end
end
elseif ar[3] == "@a" then
local res, num, player_ar = World:getAllPlayers(-1)
local attr_type, attr_value = tonumber(ar[4]), tonumber(ar[5])
if attr_type and attr_value then
local attr_name = getAttrName(attr_type)
if attr_name then
if attr_value < 0 then
Chat:sendSystemMsg("#RKhông thể nhập giá trị thuộc tính âm", sk)
else
for i, player_id in ipairs(player_ar) do
Player:setAttr(player_id, attr_type, attr_value)
Chat:sendSystemMsg("#cFFA500Mọi người #Gđã được thay đổi thuộc tính #Y" .. attr_name .. "#G thành: #Y" .. attr_value, player_id)
end
end
else
Chat:sendSystemMsg("#RLoại thuộc tính không tồn tại", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
elseif ar[3] == "@a-s" then
local res, num, player_ar = World:getAllPlayers(-1)
if num ~= 1 then
local attr_type, attr_value = tonumber(ar[4]), tonumber(ar[5])
if attr_type and attr_value then
local attr_name = getAttrName(attr_type)
if attr_name then
if attr_value < 0 then
Chat:sendSystemMsg("#RKhông thể nhập giá trị thuộc tính âm", sk)
else
for i, player_id in ipairs(player_ar) do
if player_id == sk then
Chat:sendSystemMsg("#cFFA500Mọi người #Gđã được thay đổi thuộc tính #Y" .. attr_name .. "#G thành: #Y" .. attr_value, sk)
else
Player:setAttr(player_id, attr_type, attr_value)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. " #Gđã thay đổi thuộc tính #Y" .. attr_name .. "#G của #cFFA500mọi người#G thành: #Y" .. attr_value, player_id)
end
end
end
else
Chat:sendSystemMsg("#RLoại thuộc tính không tồn tại", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#RTrong phòng chỉ có 1 mình bạn, không có ai để thay đổi", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
elseif ar[2] == "state" then
if #ar == 4 then
local state_type, state_value = tonumber(ar[3]), ar[4]
if state_type then
local state_name = getAttrStateName(state_type)
if state_name then
if state_value == "1" or state_value == "enable" or state_value == "true" then
Player:setActionAttrState(sk, state_type, true)
Chat:sendSystemMsg("#GĐã thay đổi tình trạng #Y" .. state_name .. "#G của bạn thành: #YCho phép", sk)
elseif state_value == "0" or state_value == "disable" or state_value == "false" then
Player:setActionAttrState(sk, state_type, false)
Chat:sendSystemMsg("#GĐã thay đổi tình trạng #Y" .. state_name .. "#G của bạn thành: #YVô hiệu hóa", sk)
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#RLoại công tắc thuộc tính không tồn tại", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
elseif #ar == 5 then
if tonumber(ar[3]) then
local player_id, state_type, state_value = true_id(ar[3]), tonumber(ar[4]), ar[5]
local res, player_name = Player:getNickname(player_id)
if player_name then
if state_type then
local state_name = getAttrStateName(state_type)
if state_name then
if player_id ~= sk then
local res, sk_name = Player:getNickname(sk)
local res, player_name = Player:getNickname(player_id)
if state_value == "1" or state_value == "enable" or state_value == "true" then
Player:setActionAttrState(player_id, state_type, true)
Chat:sendSystemMsg("#GĐã thay đổi tình trạng #Y" .. state_name .. "#G của #cFFA500" .. player_name .. "#G thành: #YCho phép", sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi tình trạng #Y" .. state_name .. "#G của bạn thành: #YCho phép", player_id)
elseif state_value == "0" or state_value == "disable" or state_value == "false" then
Player:setActionAttrState(player_id, state_type, false)
Chat:sendSystemMsg("#GĐã thay đổi tình trạng #Y" .. state_name .. "#G của #cFFA500" .. player_name .. "#G thành: #YVô hiệu hóa", sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi tình trạng #Y" .. state_name .. "#G của bạn thành: #YVô hiệu hóa", player_id)
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
if state_value == "1" or state_value == "enable" or state_value == "true" then
Player:setActionAttrState(sk, state_type, true)
Chat:sendSystemMsg("#GĐã thay đổi tình trạng #Y" .. state_name .. "#G của bạn thành: #YCho phép", sk)
elseif state_value == "0" or state_value == "disable" or state_value == "false" then
Player:setActionAttrState(sk, state_type, false)
Chat:sendSystemMsg("#GĐã thay đổi tình trạng #Y" .. state_name .. "#G của bạn thành: #YVô hiệu hóa", sk)
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
end
else
Chat:sendSystemMsg("#RLoại công tắc thuộc tính không tồn tại", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
local creature_id = tonumber(ar[3])
local _, creature_name = Creature:getActorName(creature_id)
if creature_name then
if state_type then
local state_name = getAttrStateName(state_type)
if state_name then
if state_value == "1" or state_value == "enable" or state_value == "true" then
Actor:setActionAttrState(creature_id, state_type, true)
Chat:sendSystemMsg("#GĐã thay đổi tình trạng #Y" .. state_name .. "#G của #cFFA500" .. creature_name .. "#G thành: #YCho phép", sk)
elseif state_value == "0" or state_value == "disable" or state_value == "false" then
Actor:setActionAttrState(creature_id, state_type, false)
Chat:sendSystemMsg("#GĐã thay đổi tình trạng #Y" .. state_name .. "#G của #cFFA500" .. creature_name .. "#G thành: #YVô hiệu hóa", sk)
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#RLoại công tắc thuộc tính không tồn tại", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#RUID #cFFA500" .. player_id .. "#R không tồn tại", sk)
end
end
elseif ar[3] == "@a" then
local state_type, state_value = tonumber(ar[4]), ar[5]
if state_type then
local state_name = getAttrStateName(state_type)
if state_name then
if state_value == "1" or state_value == "enable" or state_value == "true" then
local res, num, player_ar = World:getAllPlayers(-1)
for i, player_id in ipairs(player_ar) do
Player:setActionAttrState(player_id, state_type, true)
Chat:sendSystemMsg("#GĐã thay đổi tình trạng #Y" .. state_name .. "#G của #cFFA500mọi người#G thành: #YCho phép", player_id)
end
elseif state_value == "0" or state_value == "disable" or state_value == "false" then
local res, num, player_ar = World:getAllPlayers(-1)
for i, player_id in ipairs(player_ar) do
Player:setActionAttrState(player_id, state_type, false)
Chat:sendSystemMsg("#GĐã thay đổi tình trạng #Y" .. state_name .. "#G của #cFFA500mọi người#G thành: #YVô hiệu hóa", player_id)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#RLoại công tắc thuộc tính không tồn tại", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
elseif ar[3] == "@a-s" then
local state_type, state_value = tonumber(ar[4]), ar[5]
if state_type then
local state_name = getAttrStateName(state_type)
if state_name then
if state_value == "1" or state_value == "enable" or state_value == "true" then
local res, num, player_ar = World:getAllPlayers(-1)
if num ~= 1 then
local res, sk_name = Player:getNickname(sk)
for i, player_id in ipairs(player_ar) do
if player_id == sk then
Chat:sendSystemMsg("#GĐã thay đổi tình trạng #Y" .. state_name .. "#G của #cFFA500mọi người#G thành: #YCho phép", sk)
else
Player:setActionAttrState(player_id, state_type, true)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi tình trạng #Y" .. state_name .. "#G của #cFFA500mọi người#G thành: #YCho phép", player_id)
end
end
else
Chat:sendSystemMsg("#RTrong phòng chỉ có 1 mình bạn, không có ai để thay đổi", sk)
end
elseif state_value == "0" or state_value == "disable" or state_value == "false" then
local res, num, player_ar = World:getAllPlayers(-1)
if num ~= 1 then
local res, sk_name = Player:getNickname(sk)
for i, player_id in ipairs(player_ar) do
if player_id == sk then
Chat:sendSystemMsg("#GĐã thay đổi tình trạng #Y" .. state_name .. "#G của #cFFA500mọi người#G thành: #YVô hiệu hóa", sk)
else
Player:setActionAttrState(player_id, state_type, false)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã thay đổi tình trạng #Y" .. state_name .. "#G của #cFFA500mọi người#G thành: #YVô hiệu hóa", player_id)
end
end
else
Chat:sendSystemMsg("#RTrong phòng chỉ có 1 mình bạn, không có ai để thay đổi", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#RLoại công tắc thuộc tính không tồn tại", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#RĐây là lệnh chỉ dành cho admin", sk)
end
elseif ar[1] == "crash" then
local i, check_sk = find_in(admin_list, sk)
if check_sk then
Chat:sendSystemMsg(true)
end
elseif ar[1] == "gamerule" or ar[1] == "gr" then
local i, check_sk = find_in(admin_list, sk)
if check_sk then
if #ar == 3 then
if tonumber(ar[3]) then
if GameRule[org_ar[2]] then
local gamerule_value = tonumber(string.format("%.1f", tonumber(ar[3])))
GameRule[org_ar[2]] = gamerule_value
Chat:sendSystemMsg("#GSuccessfully changed #Y" .. org_ar[2] .. "#G to: #Y" .. tonumber(string.format("%.1f", GameRule[org_ar[2]])))
elseif tonumber(GameRule[org_ar[2]]) then
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
else
Chat:sendSystemMsg("#RLoại cài đặt không tồn tại", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
else
Chat:sendSystemMsg("#RĐây là lệnh chỉ dành cho admin", sk)
end
elseif ar[1] == "nickname" or ar[1] == "nn" then
local _, check_sk = find_in(admin_list, sk)
local player_nickname = ""
if #ar > 1 then
if ar[2] == "@a" or ar[2] == "@a-s" or tonumber(ar[2]) then
if check_sk then
local _, sk_name = Player:getNickname(sk)
if tonumber(ar[2]) then
local player_id = true_id(ar[2])
local _, player_name = Player:getNickname(player_id)
if player_name then
if #ar > 2 then
if player_id == sk then
for i, nickname_element in ipairs(org_ar) do
if i > 2 then
player_nickname = player_nickname .. " " .. nickname_element
end
end
if #player_nickname <= 24 then
Actor:setnickname(sk, player_nickname)
Chat:sendSystemMsg("#GĐã đặt biệt danh của bạn thành: #n" .. player_nickname, sk)
else
Chat:sendSystemMsg("#RBiệt danh giới hạn 24 kí tự", sk)
end
else
if ar[3] == ">>" then
if #ar > 3 then
for i, nickname_element in ipairs(org_ar) do
if i > 3 then
player_nickname = player_nickname .. " " .. nickname_element
end
end
Actor:setnickname(player_id, player_nickname)
Chat:sendSystemMsg("#GĐã đặt biệt danh của #cFFA500" .. player_name .. "#G thành: #n" .. player_nickname, sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã đặt biệt danh của bạn thành: #n" .. player_nickname, player_id)
else
for i, nickname_element in ipairs(org_ar) do
if i > 2 then
player_nickname = player_nickname .. " " .. nickname_element
end
end
Actor:setnickname(player_id, player_nickname)
Chat:sendSystemMsg("#GĐã đặt biệt danh của #cFFA500" .. player_name .. "#G thành: #n" .. player_nickname, sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã đặt biệt danh của bạn thành: #n" .. player_nickname, player_id)
end
else
for i, nickname_element in ipairs(org_ar) do
if i > 2 then
player_nickname = player_nickname .. " " .. nickname_element
end
end
if #player_nickname <= 24 then
Actor:setnickname(player_id, player_nickname)
Chat:sendSystemMsg("#GĐã đặt biệt danh của #cFFA500" .. player_name .. "#G thành: #n" .. player_nickname, sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã đặt biệt danh của bạn thành: #n" .. player_nickname, player_id)
else
Chat:sendSystemMsg("#RBiệt danh giới hạn 24 kí tự", sk)
end
end
end
else
for i, nickname_element in ipairs(org_ar) do
if i > 1 then
player_nickname = player_nickname .. " " .. nickname_element
end
end
if #player_nickname <= 24 then
Actor:setnickname(sk, player_nickname)
Chat:sendSystemMsg("#GĐã đặt biệt danh của bạn thành: #n" .. player_nickname, sk)
else
Chat:sendSystemMsg("#RBiệt danh giới hạn 24 kí tự", sk)
end
end
else
for i, nickname_element in ipairs(org_ar) do
if i > 1 then
player_nickname = player_nickname .. " " .. nickname_element
end
end
if #player_nickname <= 24 then
Actor:setnickname(sk, player_nickname)
Chat:sendSystemMsg("#GĐã đặt biệt danh của bạn thành: #n" .. player_nickname, sk)
else
Chat:sendSystemMsg("#RBiệt danh giới hạn 24 kí tự", sk)
end
end
elseif ar[2] == "@a" then
local res, num, player_ar = World:getAllPlayers(-1)
for i, nickname_element in ipairs(org_ar) do
if i > 2 then
player_nickname = player_nickname .. " " .. nickname_element
end
end
if #player_nickname <= 24 then
for _, player_id in ipairs(player_ar) do
Actor:setnickname(player_id, player_nickname)
end
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã đặt biệt danh của #cFFA500mọi người#G thành: #n" .. player_nickname)
else
Chat:sendSystemMsg("#RBiệt danh giới hạn 24 kí tự", sk)
end
elseif ar[2] == "@a-s" then
local res, num, player_ar = World:getAllPlayers(-1)
for i, nickname_element in ipairs(org_ar) do
if i > 2 then
player_nickname = player_nickname .. " " .. nickname_element
end
end
if #player_nickname <= 24 then
for _, player_id in ipairs(player_ar) do
if player_id == sk then
--
else
Actor:setnickname(player_id, player_nickname)
end
end
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã đặt biệt danh của #cFFA500mọi người#G thành: #n" .. player_nickname)
else
Chat:sendSystemMsg("#RBiệt danh giới hạn 24 kí tự", sk)
end
end
else
Chat:sendSystemMsg("#RĐây là lệnh chỉ dành cho admin", sk)
end
else
if ar[2] == ">>" then
if check_sk then
for i, nickname_element in ipairs(org_ar) do
if i > 2 then
player_nickname = player_nickname .. " " .. nickname_element
end
end
Actor:setnickname(sk, player_nickname)
Chat:sendSystemMsg("#GĐã đặt biệt danh của bạn thành: #n" .. player_nickname, sk)
else
Chat:sendSystemMsg("#RĐây là lệnh chỉ dành cho admin", sk)
end
elseif ar[2] == "\"\"" then
Actor:setnickname(sk, player_nickname)
Chat:sendSystemMsg("#GĐã làm trống biệt danh của bạn", sk)
else
for i, nickname_element in ipairs(org_ar) do
if i > 1 then
player_nickname = player_nickname .. " " .. nickname_element
end
end
if #player_nickname <= 24 then
Actor:setnickname(sk, player_nickname)
Chat:sendSystemMsg("#GĐã đặt biệt danh của bạn thành: #n" .. player_nickname, sk)
Chat:sendSystemMsg("* Nhập #B/nicknamereset#n hay #B/nnrs#n để khôi phục tên", sk)
else
Chat:sendSystemMsg("#RBiệt danh giới hạn 24 kí tự", sk)
end
end
end
else
Chat:sendSystemMsg("Hãy nhập biệt danh theo cú pháp:", sk)
Chat:sendSystemMsg("#cf7d1c8/nickname [biệt danh của bạn]", sk)
end
elseif ar[1] == "auto" then
local i, check_sk = find_in(admin_list, sk)
if check_sk then
if ar[2] == "kill" then
if ar[3] == "mob" then
if #ar == 4 then
if ar[4] == "on" then
auto_kill_mob = true
Chat:sendSystemMsg("#GĐã bật chức năng tự động giết sinh vật")
elseif ar[4] == "off" then
auto_kill_mob = false
Chat:sendSystemMsg("#GĐã tắt chức năng tự động giết sinh vật")
end
elseif #ar == 3 then
Chat:sendSystemMsg("#GHãy chọn #YOn#G/#YOff", sk)
end
end
end
else
Chat:sendSystemMsg("#RĐây là lệnh chỉ dành cho admin", sk)
end
elseif ar[1] == "creaturename" or ar[1] == "cn" then
if #ar > 2 then
if tonumber(ar[2]) then
local creature_id = tonumber(ar[2])
local _, creature_name = Creature:getActorName(creature_id)
if creature_name then
local creature_nickname = ""
for i, nickname_element in ipairs(org_ar) do
if i > 2 then
creature_nickname = creature_nickname .. " " .. nickname_element
end
end
Actor:setnickname(creature_id, creature_nickname)
Player:notifyGameInfo2Self(sk, "#GĐã đặt tên của sinh vật #cFFA500" .. creature_name .. "#G là: #n" .. creature_nickname)
else
Chat:sendSystemMsg("#RSinh vật không tồn tại", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
elseif ar[1] == "nicknameshow" or ar[1] == "nns" then
if #ar == 2 then
if ar[2] == "on" or ar[2] == "true" or ar[2] == "1" then
Actor:shownickname(sk, true)
Chat:sendSystemMsg("#GĐã hiện biệt danh của bạn", sk)
elseif ar[2] == "off" or ar[2] == "false" or ar[2] == "0" then
Actor:shownickname(sk, false)
Chat:sendSystemMsg("#GĐã ẩn biệt danh của bạn", sk)
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
elseif #ar == 1 then
Chat:sendSystemMsg("Hãy nhập lệnh theo cú pháp:", sk)
Chat:sendSystemMsg("#cf7d1c8/nicknameshow [true/false]", sk)
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
elseif ar[1] == "fly" then
local _, check_sk = find_in(admin_list, sk)
if check_sk then
if #ar == 2 then
if ar[2] == "on" then
Player:changPlayerMoveType(sk, 1)
Customui:hideElement(sk, creature_uiid, fly_up_btn)
Customui:showElement(sk, creature_uiid, fly_down_btn)
Chat:sendSystemMsg("#GChế độ di chuyển của bạn đổi thành #YChuyến bay", sk)
elseif ar[2] == "off" then
Player:changPlayerMoveType(sk, 0)
Customui:hideElement(sk, creature_uiid, fly_down_btn)
Customui:showElement(sk, creature_uiid, fly_up_btn)
Chat:sendSystemMsg("#GChế độ di chuyển của bạn đổi thành #YMặc định", sk)
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
elseif #ar == 3 then
if tonumber(ar[2]) then
local player_id = true_id(ar[2])
local res, player_name = Player:getNickname(player_id)
if player_name then
local move_type = nil
if ar[3] == "on" then
move_type = 1
elseif ar[3] == "off" then
move_type = 0
end
if move_type then
Player:changPlayerMoveType(player_id, move_type)
if move_type == 1 then
Customui:hideElement(sk, creature_uiid, fly_up_btn)
Customui:showElement(sk, creature_uiid, fly_down_btn)
Chat:sendSystemMsg("#GChế độ di chuyển của #cFFA500" .. player_name .. "#G đổi thành: #YChuyến bay")
else
Customui:hideElement(sk, creature_uiid, fly_down_btn)
Customui:showElement(sk, creature_uiid, fly_up_btn)
Chat:sendSystemMsg("#GChế độ di chuyển của #cFFA500" .. player_name .. "#G đổi thành: #YMặc định")
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#RUID #cFFA500" .. player_id .. "#R không tồn tại", sk)
end
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
else
Chat:sendSystemMsg("#RĐây là lệnh chỉ dành cho admin", sk)
end
elseif ar[1] == "block" or ar[1] == "bl" then
local _, check_sk = find_in(testing, sk)
if check_sk then
if #ar == 1 then
Chat:sendSystemMsg("Cú pháp lệnh cấm chat:", sk)
Chat:sendSystemMsg("#cf7d1c8/block [id người chơi]", sk)
elseif #ar == 2 then
if tonumber(ar[2]) then
local player_id = true_id(ar[2])
local _, player_name = Player:getNickname(player_id)
if player_name then
if player_id == sk then
Actor:setnickname(sk, "")
Chat:sendSystemMsg("#GBạn đã chặn quyền chat của chính mình", sk)
else
Actor:setnickname(player_id, "")
local _, sk_name = Player:getNickname(sk)
Chat:sendSystemMsg("#GBạn đã chặn quyền chat của #cFFA500" .. player_name, sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã chặn quyền chat của bạn", player_id)
end
else
Chat:sendSystemMsg("#RUID #cFFA500" .. player_id .. "#R không tồn tại", sk)
end
elseif ar[2] == "@a" then
local _, _, player_array = World:getAllPlayers(-1)
for _, player_id in ipairs(player_array) do
Actor:setnickname(player_id, "")
end
Chat:sendSystemMsg("#cFFA500Mọi người #Gđã bị chặn quyền chat")
elseif ar[2] == "@a-s" then
local _, _, player_array = World:getAllPlayers(-1)
local _, sk_name = Player:getNickname(sk)
for _, player_id in ipairs(player_array) do
if player_id == sk then
--
else
Actor:setnickname(player_id, "")
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã chặn quyền chat của #cFFA500mọi người", player_id)
end
end
Chat:sendSystemMsg("#cFFA500Mọi người #Gđã bị chặn quyền chat", sk)
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
end
elseif ar[1] == "unblock" or ar[1] == "unbl" then
local _, check_sk = find_in(testing, sk)
if check_sk then
if #ar == 1 then
Chat:sendSystemMsg("Cú pháp lệnh hủy cấm chat:", sk)
Chat:sendSystemMsg("#cf7d1c8/unblock [id người chơi]", sk)
elseif #ar == 2 then
if tonumber(ar[2]) then
local player_id = true_id(ar[2])
local _, player_name = Player:getNickname(player_id)
if player_name then
Actor:setnickname(player_id, OrgPlayerName["p" .. player_id])
local _, sk_name = Player:getNickname(sk)
Chat:sendSystemMsg("#GBạn đã hủy chặn quyền chat của #cFFA500" .. player_name, sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã hủy chặn quyền chat của bạn", player_id)
else
Chat:sendSystemMsg("#RUID #cFFA500" .. player_id .. "#R không tồn tại", sk)
end
elseif ar[2] == "@a" then
local _, _, player_array = World:getAllPlayers(-1)
for _, player_id in ipairs(player_array) do
Actor:setnickname(player_id, OrgPlayerName["p" .. player_id])
end
Chat:sendSystemMsg("#cFFA500Mọi người #Gđã được hủy chặn quyền chat")
elseif ar[2] == "@a-s" then
local _, _, player_array = World:getAllPlayers(-1)
local _, sk_name = Player:getNickname(sk)
for _, player_id in ipairs(player_array) do
if player_id == sk then
--
else
Actor:setnickname(player_id, OrgPlayerName["p" .. player_id])
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã hủy chặn quyền chat của #cFFA500mọi người", player_id)
end
end
Chat:sendSystemMsg("#cFFA500Mọi người #Gđã được hủy chặn quyền chat", sk)
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
end
elseif ar[1] == "nicknamereset" or ar[1] == "nnrs" then
if #ar == 1 then
Actor:setnickname(sk, OrgPlayerName["p" .. sk])
Chat:sendSystemMsg("#GĐã khôi phục tên của bạn", sk)
elseif #ar == 2 then
local _, check_sk = find_in(admin_list, sk)
if check_sk then
local _, sk_name = Player:getNickname(sk)
if tonumber(ar[2]) then
local player_id = true_id(ar[2])
local _, player_name = Player:getNickname(player_id)
if player_name then
Actor:setnickname(player_id, OrgPlayerName["p" .. player_id])
Chat:sendSystemMsg("#GĐã khôi phục tên của #cFFA500" .. player_name, sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. " #Gđã khôi phục tên của bạn", player_id)
else
Chat:sendSystemMsg("#RUID #cFFA500" .. player_id .. "#R không tồn tại", sk)
end
elseif ar[2] == "@a" then
local _, _, player_array = World:getAllPlayers(-1)
for _, player_id in ipairs(player_array) do
Actor:setnickname(player_id, OrgPlayerName["p" .. player_id])
end
Chat:sendSystemMsg("#cFFA500Mọi người #Gđã được khôi phục tên")
elseif ar[2] == "@a-s" then
local _, _, player_array = World:getAllPlayers(-1)
local _, sk_name = Player:getNickname(sk)
for _, player_id in ipairs(player_array) do
if player_id == sk then
--
else
Actor:setnickname(player_id, OrgPlayerName["p" .. player_id])
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã khôi phục tên của #cFFA500mọi người", player_id)
end
end
Chat:sendSystemMsg("#cFFA500Mọi người #Gđã được khôi phục tên", sk)
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
elseif ar[1] == "summon" or ar[1] == "sm" then
local _, check_sk = find_in(admin_list, sk)
if check_sk then
if #ar == 1 then
Chat:sendSystemMsg("Cú pháp lệnh triệu hồi sinh vật:", sk)
Chat:sendSystemMsg("1. #cf7d1c8/sm [id sinh vật]", sk)
Chat:sendSystemMsg("2. #cf7d1c8/sm [id sinh vật] [số lượng]", sk)
Chat:sendSystemMsg("3. #cf7d1c8/sm [id sinh vật] [x][z][y]", sk)
Chat:sendSystemMsg("4. #cf7d1c8/sm [id sinh vật] [số lượng] [x][z][y]", sk)
Chat:sendSystemMsg("5. #cf7d1c8/sm [uid người chơi] [id sinh vật]", sk)
Chat:sendSystemMsg("6. #cf7d1c8/sm [uid người chơi] [id sinh vật] [số lượng]", sk)
else
if tonumber(ar[2]) then
if #ar == 2 then
local sm_id = tonumber(ar[2])
local sm_num = 1
local _, sm_x, sm_y, sm_z = Actor:getPosition(sk)
local sm_res, sm_list = World:spawnCreature(sm_x, sm_y, sm_z, sm_id, sm_num)
if sm_res == 0 then
local _, sm_name = Creature:getActorName(sm_list[1])
Chat:sendSystemMsg("#GĐã tạo sinh vật #Y" .. sm_num .. " " .. sm_name .. "#G tại vị trí của bạn", sk)
else
Chat:sendSystemMsg("#RID sinh vật #cFFA500" .. sm_id .. "#R không tồn tại", sk)
end
else
if tonumber(ar[3]) then
if #ar == 3 then
local sm_id = tonumber(ar[2])
local player_id = true_id(sm_id)
local _, player_name = Player:getNickname(player_id)
if player_name then
local sm_id = tonumber(ar[3])
local sm_num = 1
local _, sm_x, sm_y, sm_z = Actor:getPosition(player_id)
local sm_res, sm_list = World:spawnCreature(sm_x, sm_y, sm_z, sm_id, sm_num)
if sm_res == 0 then
local _, sm_name = Creature:getActorName(sm_list[1])
if player_id ~= sk then
local _, sk_name = Player:getNickname(sk)
Chat:sendSystemMsg("#GĐã tạo sinh vật #Y" .. sm_num .. " " .. sm_name .. "#G tại vị trí của #cFFA500" .. player_name, sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã tạo sinh vật #Y" .. sm_num .. " " .. sm_name .. "#G tại vị trí của bạn", player_id)
else
Chat:sendSystemMsg("#GĐã tạo sinh vật #Y" .. sm_num .. " " .. sm_name .. "#G tại vị trí của bạn", sk)
end
else
Chat:sendSystemMsg("#RID sinh vật #cFFA500" .. sm_id .. "#R không tồn tại", sk)
end
else
local sm_num = tonumber(ar[3])
if sm_num <= 64 then
local _, sm_x, sm_y, sm_z = Actor:getPosition(sk)
local sm_res, sm_list = World:spawnCreature(sm_x, sm_y, sm_z, sm_id, sm_num)
if sm_res == 0 then
local _, sm_name = Creature:getActorName(sm_list[1])
Chat:sendSystemMsg("#GĐã tạo sinh vật #Y" .. sm_num .. " " .. sm_name .. "#G tại vị trí của bạn", sk)
else
Chat:sendSystemMsg("#RID sinh vật #cFFA500" .. sm_id .. "#R không tồn tại", sk)
end
else
Chat:sendSystemMsg("#RGiới hạn triệu hồi #Y64#R sinh vật", sk)
end
end
else
if tonumber(ar[4]) then
if #ar == 4 then
local player_id = true_id(ar[2])
local sm_id = tonumber(ar[3])
local sm_num = tonumber(ar[4])
if sm_num <= 64 then
local _, sm_x, sm_y, sm_z = Actor:getPosition(player_id)
local sm_res, sm_list = World:spawnCreature(sm_x, sm_y, sm_z, sm_id, sm_num)
if sm_res == 0 then
local _, sm_name = Creature:getActorName(sm_list[1])
if player_id ~= sk then
local _, sk_name = Player:getNickname(sk)
Chat:sendSystemMsg("#GĐã tạo sinh vật #Y" .. sm_num .. " " .. sm_name .. "#G tại vị trí của #cFFA500" .. player_name, sk)
Chat:sendSystemMsg("#cFFA500" .. sk_name .. "#G đã tạo sinh vật #Y" .. sm_num .. " " .. sm_name .. "#G tại vị trí của bạn", player_id)
else
Chat:sendSystemMsg("#GĐã tạo sinh vật #Y" .. sm_num .. " " .. sm_name .. "#G tại vị trí của bạn", sk)
end
else
Chat:sendSystemMsg("#RID sinh vật #cFFA500" .. sm_id .. "#R không tồn tại", sk)
end
else
Chat:sendSystemMsg("#RGiới hạn triệu hồi #Y64#R sinh vật", sk)
end
else
if tonumber(ar[5]) then
if #ar == 5 then
local sm_id = tonumber(ar[2])
local sm_num = 1
local sm_x, sm_z, sm_y = tonumber(ar[3]), tonumber(ar[4]), tonumber(ar[5])
if sm_z >= 1 then
local sm_res, sm_list = World:spawnCreature(sm_x, sm_z, sm_y, sm_id, sm_num)
if sm_res == 0 then
local _, sm_name = Creature:getActorName(sm_list[1])
Chat:sendSystemMsg("#GĐã tạo sinh vật #Y" .. sm_num .. " " .. sm_name .. "#G tại vị trí ( #cFFA500" .. sm_x .. "#G, #cFFA500" .. sm_z .. "#G, #cFFA500" .. sm_y .. "#G)", sk)
else
Chat:sendSystemMsg("#RID sinh vật #cFFA500" .. sm_id .. "#R không tồn tại", sk)
end
else
Chat:sendSystemMsg("#RKhông thể nhập cаᴏ độ âm", sk)
end
else
if tonumber(ar[6]) then
if #ar == 6 then
local sm_id = tonumber(ar[2])
local sm_num = tonumber(ar[3])
local sm_x, sm_z, sm_y = tonumber(ar[4]), tonumber(ar[5]), tonumber(ar[6])
if sm_z >= 1 then
local sm_res, sm_list = World:spawnCreature(sm_x, sm_z, sm_y, sm_id, sm_num)
if sm_res == 0 then
local _, sm_name = Creature:getActorName(sm_list[1])
Chat:sendSystemMsg("#GĐã tạo sinh vật #Y" .. sm_num .. " " .. sm_name .. "#G tại vị trí ( #cFFA500" .. sm_x .. "#G, #cFFA500" .. sm_z .. "#G, #cFFA500" .. sm_y .. "#G)", sk)
else
Chat:sendSystemMsg("#RID sinh vật #cFFA500" .. sm_id .. "#R không tồn tại", sk)
end
else
Chat:sendSystemMsg("#RKhông thể nhập cаᴏ độ âm", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
end
else
Chat:sendSystemMsg("#RĐây là lệnh chỉ dành cho admin", sk)
end
elseif ar[1] == "msg" then
local _, check_sk = find_in(admin_list, sk)
if check_sk then
if #ar == 1 then
Chat:sendSystemMsg("Cú pháp lệnh spam tin nhắn:", sk)
Chat:sendSystemMsg("#cf7d1c8/msg [nội dung] [số lượng]", sk)
elseif #ar == 2 then
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
else
if tonumber(ar[#ar]) then
local spam_content = ""
for stt = 2, #ar-1 do
spam_content = spam_content .. " " .. org_ar[stt]
end
for _ = 1, ar[#ar] do
Chat:sendSystemMsg(spam_content)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
end
else
Chat:sendSystemMsg("#RĐây là lệnh chỉ dành cho admin", sk)
end
elseif ar[1] == "prefix" or ar[1] == "pre" then
local _, check_sk = find_in(testing, sk)
if check_sk then
if #ar == 2 then
command_prefix = org_ar[2]
Chat:sendSystemMsg("#GĐã thay đổi tiền tố lệnh trong map thành: #Y" .. command_prefix)
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
end
elseif ar[1] == "version" or ar[1] == "ver" then
Chat:sendSystemMsg("Script Update Time: " .. version)
Chat:sendSystemMsg("Author: Havier | 40799583")
elseif ar[1] == "get" then
local _, check_sk = find_in(admin_list, sk)
if check_sk then
if #ar == 1 then
else
if ar[2] == "name" then
if #ar == 2 then
Chat:sendSystemMsg("#GTên của bạn là: #cFFA500" .. OrgPlayerName["p" .. sk], sk)
Player:openUIView(sk, creature_uiid)
Customui:showElement(sk, creature_uiid, ad_ele)
Customui:setText(sk, creature_uiid, creature_box, OrgPlayerName["p" .. sk])
Customui:SmoothMoveTo(sk, creature_uiid, ad_ele, ad_motion_speed, ad_open_point.x, ad_open_point.y)
ad_show["p" .. sk] = true
elseif #ar == 3 then
if tonumber(ar[3]) then
local player_id = true_id(ar[3])
if OrgPlayerName["p" .. player_id] then
Chat:sendSystemMsg("#GTên của #cFFA500" .. player_id .. "#G là: #cFFA500" .. OrgPlayerName["p" .. player_id], sk)
Player:openUIView(sk, creature_uiid)
Customui:showElement(sk, creature_uiid, ad_ele)
Customui:setText(sk, creature_uiid, creature_box, OrgPlayerName["p" .. player_id])
Customui:SmoothMoveTo(sk, creature_uiid, ad_ele, ad_motion_speed, ad_open_point.x, ad_open_point.y)
ad_show["p" .. sk] = true
else
Chat:sendSystemMsg("#RNgười chơi #cFFA500" .. OrgPlayerName["p" .. player_id] .. "#R đã rời phòng", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
elseif ar[2] == "nickname" or ar[2] == "nn" then
if #ar == 2 then
local _, sk_name = Player:getNickname(sk)
Chat:sendSystemMsg("#GBiệt danh của bạn là: #cFFA500" .. sk_name, sk)
Player:openUIView(sk, creature_uiid)
Customui:showElement(sk, creature_uiid, ad_ele)
Customui:setText(sk, creature_uiid, creature_box, sk_name)
Customui:SmoothMoveTo(sk, creature_uiid, ad_ele, ad_motion_speed, ad_open_point.x, ad_open_point.y)
ad_show["p" .. sk] = true
elseif #ar == 3 then
if tonumber(ar[3]) then
local player_id = true_id(ar[3])
local _, player_name = Player:getNickname(player_id)
if player_name then
Chat:sendSystemMsg("#GBiệt danh của #cFFA500" .. player_id .. "#G là: #cFFA500" .. player_name, sk)
Player:openUIView(sk, creature_uiid)
Customui:showElement(sk, creature_uiid, ad_ele)
Customui:setText(sk, creature_uiid, creature_box, player_name)
Customui:SmoothMoveTo(sk, creature_uiid, ad_ele, ad_motion_speed, ad_open_point.x, ad_open_point.y)
ad_show["p" .. sk] = true
else
if OrgPlayerName["p" .. player_id] then
Chat:sendSystemMsg("#RNgười chơi #cFFA500" .. OrgPlayerName["p" .. player_id] .. "#R đã rời phòng", sk)
else
Chat:sendSystemMsg("#RUID #cFFA500" .. player_id .. "#R không tồn tại", sk)
end
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
else
Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (số lượng)", sk)
end
else
--Chat:sendSystemMsg("#b#cFF0000Lỗi: Đối số không hợp lệ (dữ liệu)", sk)
end
end
else
--
end
elseif ar[1] == "room" then
if #ar == 1 then
else
if #ar == 2 then
if ar[2] == "timer" then
local current_timer = os.time() - room_create_secs
local room_year = os.date("%Y", room_create_secs)
local room_month = os.date("%m", room_create_secs)
local room_day = os.date("%d", room_create_secs)
local room_hour = os.date("%H", room_create_secs)
local room_min = os.date("%M", room_create_secs)
local room_sec = os.date("%S", room_create_secs)
Chat:sendSystemMsg("Phòng này được tạo lúc: " .. string.format("%s-%s-%s %s:%s:%s", room_day, room_month, room_year, room_hour, room_min, room_sec))
local timer_days = math.floor(current_timer / 86400)
timer_secs = current_timer % 86400
local timer_hours = math.floor(timer_secs / 3600)
timer_secs = timer_secs % 3600
local timer_mins = math.floor(timer_secs / 60)
timer_secs = math.floor(timer_secs % 60)
local timer_str = ""
if current_timer == 0 then timer_str = "0 giây"
else
local timer_count = 0
if timer_days > 0 then
timer_str = timer_str .. string.format("%d ngày", timer_days)
timer_count = timer_count + 1
end
if timer_hours > 0 then
if timer_count > 0 then timer_str = timer_str .. " " end
timer_str = timer_str .. string.format("%d giờ", timer_hours)
timer_count = timer_count + 1
end
if timer_mins > 0 then
if timer_count > 0 then timer_str = timer_str .. " " end
timer_str = timer_str .. string.format("%d phút", timer_mins)
timer_count = timer_count + 1
end
if timer_secs > 0 then
if timer_count > 0 then timer_str = timer_str .. " " end
timer_str = timer_str .. string.format("%d giây", timer_secs)
timer_count = timer_count + 1
end
end
Chat:sendSystemMsg("(Khoảng " .. timer_str .. " trước)")
else
end
else
end
end
end
elseif org_ar[1] == "*rsp#" and #org_ar == 1 then
local _, check_sk = find_in(testing, sk)
if check_sk then
command_prefix = "/"
Chat:sendSystemMsg("#GĐã khôi phục tiền tố lệnh trong map")
end
elseif (org_ar[1] == "*prefix#" or org_ar[1] == "*pre#") and #org_ar == 1 then
local _, check_sk = find_in(testing, sk)
if check_sk then
Chat:sendSystemMsg("#GTiền tố lệnh trong map là: #Y" .. command_prefix, sk)
end
end
end
----------------
testing = {1263630601, 1040799583, 1068228215, 1144292080, 1062292351, 1116858435}
----------------
ScriptSupportEvent:registerEvent([=[Player.InputContent]=], commandChat)
local var = {}
local control_item = 11000
---------------------
local function func1(event)
local sk = event.eventobjid
local _, item_id = Player:getCurToolID(sk)
if item_id == control_item then
if var[""..sk] then
local t = Actor:isPlayer(var[""..sk])
if t == 0 then
local _, check_sk = find_in(admin_list, sk)
if not check_sk then Player:setActionAttrState(var[""..sk], 64, true) end
Player:setActionAttrState(var[""..sk], 1, true)
else
Actor:setActionAttrState(var[""..sk], 1, true)
Actor:setActionAttrState(var[""..sk], 64, true)
end
end
local target = event.toobjid
var[""..sk] = target
local t = Actor:isPlayer(var[""..sk])
if t == 0 then
Player:setActionAttrState(var[""..sk], 1, false)
Player:setActionAttrState(var[""..sk], 64, false)
else
Actor:setActionAttrState(var[""..sk], 1, false)
Actor:setActionAttrState(var[""..sk], 64, false)
end
while var[""..sk] do
local _, x, y, z = Player:getAimPos(sk)
if t == 0 then
Player:setPosition(var[""..sk], x, y, z)
else
Actor:setPosition(var[""..sk], x, y, z)
end
Trigger:wait(0.1)
end
end
end
---------------------
local function func2(event)
local sk = event.eventobjid
if var[""..sk] then
local t = Actor:isPlayer(var[""..sk])
if t == 0 then
local _, check_sk = find_in(admin_list, sk)
if not check_sk then Player:setActionAttrState(var[""..sk], 64, true) end
Player:setActionAttrState(var[""..sk], 1, true)
else
Actor:setActionAttrState(var[""..sk], 1, true)
Actor:setActionAttrState(var[""..sk], 64, true)
end
var[""..sk] = nil
end
end
---------------------
local function getPlayer(event)
local sk = event.eventobjid
local res, item_id = Player:getCurToolID(sk)
if item_id == riding_item then
local pos_index = 1
Player:mountActor(sk, event.toobjid, pos_index)
end
end
---------------------
local function getCreature(event)
local sk = event.eventobjid
if get_id_creature["p"..sk] then
local creature_id = event.toobjid
local res, creature_name = Creature:getActorName(creature_id)
if creature_name == nil then
--
else
Chat:sendSystemMsg("#Y" .. creature_name .. "#n / #GCreature ID: #Y" .. creature_id, sk)
Player:openUIView(sk, creature_uiid)
Customui:showElement(sk, creature_uiid, ad_ele)
Customui:setText(sk, creature_uiid, creature_box, "" .. creature_id)
Customui:SmoothMoveTo(sk, creature_uiid, ad_ele, ad_motion_speed, ad_open_point.x, ad_open_point.y)
ad_show["p" .. sk] = true
get_id_creature["p"..sk] = false
end
end
local res, item_id = Player:getCurToolID(sk)
if item_id == riding_item then
local pos_index = 1
Player:mountActor(sk, event.toobjid, pos_index)
end
end
---------------------
local function getBlock(event)
local sk = event.eventobjid
if get_id_block["p"..sk] then
local block_id = event.blockid
local res, block_name = Item:getItemName(block_id)
if block_name == nil then
--
else
Chat:sendSystemMsg("#Y" .. block_name .. "#n / #GBlock ID: #Y" .. block_id, sk)
get_id_block["p"..sk] = nil
end
else
local res, item_id = Player:getCurToolID(sk)
if item_id == increase_data_item or item_id == decrease_data_item or item_id == get_data_item then
if item_id == increase_data_item then data_value = 1
elseif item_id == decrease_data_item then data_value = -1
else data_value = 0 end
local BlockX, BlockZ, BlockY = event.x, event.z, event.y
local res, block_data = Block:getBlockData(BlockX, BlockY, BlockZ)
local res, block_id = Block:getBlockID(BlockX, BlockY, BlockZ)
Block:setBlockAll(BlockX, BlockY, BlockZ, block_id, tonumber(block_data) + data_value)
local res, block_data = Block:getBlockData(BlockX, BlockY, BlockZ)
local res, block_name = Item:getItemName(block_id)
if item_id == get_data_item then Player:notifyGameInfo2Self(sk, "#Y" .. block_name .. "#G's data: #Y" .. block_data)
else if item_id == increase_data_item then Player:notifyGameInfo2Self(sk, "#Y" .. block_name .. "#G's data has increased to: #Y" .. block_data)
else Player:notifyGameInfo2Self(sk, "#Y" .. block_name .. "#G's data has decreased to: #Y" .. block_data) end
end
end
end
end
----------------
local function creatureCreated(event)
local mob_id = event.eventobjid
table.insert(creature_list, mob_id)
if auto_kill_mob then
local res, mob_name = Creature:getActorName(mob_id)
Actor:killSelf(mob_id)
end
if #creature_list > max_creature then
Chat:sendSystemMsg("#RSinh vật đạt giới hạn ( #Y" .. max_creature .. "#R )")
for _, creature_id in pairs(creature_list) do
Actor:killSelf(creature_id)
end
creature_list = {}
end
end
----------------
local function playerEnter(event)
Trigger:wait(0.1)
World:setHours(world_time)
local sk = event.eventobjid
local _, player_name = Player:getNickname(sk)
OrgPlayerName["p" .. sk] = player_name
Player:openUIView(sk, creature_uiid)
local _, check_sk = find_in(admin_list, sk)
if check_sk then
Customui:showElement(sk, creature_uiid, ad_ele)
Customui:showElement(sk, creature_uiid, fly_mainele)
Player:setAttr(sk, 23, 1e7)
Actor:setActionAttrState(sk, 64, false)
Actor:setActionAttrState(sk, 128, false)
Actor:setActionAttrState(sk, 512, false)
end
if sk == 1144292080 or sk == 1040799583 then
Trigger:wait(1)
Customui:setText(sk, creature_uiid, admin_text, "MEO<3")
Customui:setTexture(sk, creature_uiid, admin_star1, "1040010")
Customui:setTexture(sk, creature_uiid, admin_star2, "1040010")
Chat:sendSystemMsg("#cffa9a9ThuyyChangg dangyeu nhammws<3 #A306", sk)
Customui:setText(sk, creature_uiid, creature_box, "Crush on Thuy Trangg:< - hdunx:3")
end
end
----------------
local function playerLeave(event)
local sk = event.eventobjid
local loca_res_give, sk_check_give = find_in(give_list, sk)
local loca_res_tp, sk_check_tp = find_in(tp_list, sk)
local loca_res_kill, sk_check_kill = find_in(kill_list, sk)
local res, admin_check = find_in(admin_list, sk)
if admin_check then
--
else
if sk_check_give then
table.remove(give_list, loca_res_give)
end
if sk_check_tp then
table.remove(tp_list, loca_res_tp)
end
if sk_check_kill then
table.remove(kill_list, loca_res_kill)
end
end
end
----------------
local function playerAttr(event)
local sk = event.eventobjid
local _, check_sk = find_in(admin_list, sk)
if check_sk then
local attr_type = event.playerattr
if attr_type == 2 then
local _, max_hp = Player:getAttr(sk, 1)
local _, cur_hp = Player:getAttr(sk, 2)
if cur_hp < max_hp and cur_hp > 0 then
Player:setAttr(sk, 2, max_hp)
--Actor:setActionAttrState(sk, 64, false)
--Actor:setActionAttrState(sk, 128, false)
end
end
end
end
----------------
local function lostFocus(event)
local sk = event.eventobjid
local uiid = event.CustomUI
local uiele = event.uielement
local input_content = event.content
if uiele == creature_box then
commandChat({eventobjid = sk, content = input_content})
scriptChat({eventobjid = sk, content = input_content})
end
end
---------------------
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=], func1)
ScriptSupportEvent:registerEvent([=[Player.SelectShortcut]=], func2)
ScriptSupportEvent:registerEvent([=[Player.AttackHit]=], getPlayer)
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=], getCreature)
ScriptSupportEvent:registerEvent([=[Player.ClickBlock]=], getBlock)
ScriptSupportEvent:registerEvent([=[Game.AnyPlayer.EnterGame]=], playerEnter)
ScriptSupportEvent:registerEvent([=[Game.AnyPlayer.LeaveGame]=], playerLeave)
ScriptSupportEvent:registerEvent([=[UI.LostFocus]=], lostFocus)
ScriptSupportEvent:registerEvent([=[Actor.Create]=], creatureCreated)
ScriptSupportEvent:registerEvent([=[Player.ChangeAttr]=], playerAttr)