Commit 47c72eca authored by mercury233's avatar mercury233

update ban user

parent 18e3dc59
......@@ -70,9 +70,12 @@ nconf.myset = (settings, path, val) ->
ban_user = (name) ->
settings.ban.banned_user.push(name)
nconf.myset(settings, "ban:banned_user", settings.ban.banned_user)
bad_ip=0
for room in ROOM_all when room and room.established
for player in room.players
if player and player.name == name
if player and (player.name == name or player.ip == bad_ip)
bad_ip = player.ip
ROOM_bad_ip.push(player.ip)
settings.ban.banned_ip.push(player.ip)
ygopro.stoc_send_chat_to_room(room, "#{player.name} 被系统请出了房间", ygopro.constants.COLORS.RED)
player.destroy()
......
......@@ -88,16 +88,19 @@
};
ban_user = function(name) {
var k, l, len, len1, player, ref, room;
var bad_ip, k, l, len, len1, player, ref, room;
settings.ban.banned_user.push(name);
nconf.myset(settings, "ban:banned_user", settings.ban.banned_user);
bad_ip = 0;
for (k = 0, len = ROOM_all.length; k < len; k++) {
room = ROOM_all[k];
if (room && room.established) {
ref = room.players;
for (l = 0, len1 = ref.length; l < len1; l++) {
player = ref[l];
if (player && player.name === name) {
if (player && (player.name === name || player.ip === bad_ip)) {
bad_ip = player.ip;
ROOM_bad_ip.push(player.ip);
settings.ban.banned_ip.push(player.ip);
ygopro.stoc_send_chat_to_room(room, player.name + " 被系统请出了房间", ygopro.constants.COLORS.RED);
player.destroy();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment