var express=require("express");
var app=express();
var server=require("http").createServer(app);
var io=require("socket.io").listen(server);
app.use('/',express.static(__dirname));
server.listen(80);
console.log("server started");

function Player(name){
	this.name=name;
}

var players=new Array();


io.on("connection",function(socket){
	socket.on("postInfo",function(pos,sprite,name){
		socket.broadcast.emit("getInfo",pos,sprite,socket.index,name);
	});
	socket.on("setName",function(name){
		for(var i=0;i<players.length;i++){
			if(name==players[i].name){
				socket.emit("nameerror");
				return;
			}
		}
		socket.index=players.length;
		socket.name=name;
		players.push(new Player(name));
		console.log(name+" is connected");
		socket.emit("loginsuccess");
	});
})


@@ -134,16 +134,66 @@
 erver);%0A
+var level=0;%0Avar time=0;%0Avar players=new Array();%0A
 app.use(
@@ -322,33 +322,397 @@
 %0A%7D%0A%0A
-var players=new Array();%0A
+function timecount()%7B%0A%09if(time%3C300)%7B%0A%09%09io.sockets.emit(%22timecount%22,time,players.length);%0A%09%09time++;%0A%09%09setTimeout(timecount,1000);%0A%09%7Delse%7B%0A%09%09level++;%0A%09%09if(level%3E1)%0A%09%09%09level=0;%0A%09%09io.sockets.emit(%22changemap%22,level);%0A%09%09time=0;%0A%09%09timecount();%0A%09%7D%0A%7D%0Atimecount();%0A%0A%09function update()%7B%0A%09%09var t=Math.random()*3000+3000;%0A%09%09io.sockets.emit(%22check%22);%0A%09%09setTimeout(update,t);%0A%09%7D%0A%09setTimeout(update,3000);
 %0A%0Aio
@@ -746,16 +746,17 @@
 ocket)%7B%0A
+%0A
 %09socket.
@@ -1171,16 +1171,528 @@
 success%22
+,level,time,players.length);%0A%09%7D);%0A%09socket.on(%22push%22,function(name,bl)%7B%0A%09%09socket.broadcast.emit(%22pushPlayer%22,name,bl);%0A%09%7D);%0A%09socket.on(%22up%22,function(name,spd)%7B%0A%09%09socket.broadcast.emit(%22Playerup%22,name,spd);%0A%09%7D);%0A%09socket.on(%22close%22,function(name)%7B%0A%09%09socket.broadcast.emit(%22logout%22,name);%0A%09%09for(var i=0;i%3Cplayers.length;i++)%7B%0A%09%09%09if(players%5Bi%5D.name==name)%7B%0A%09%09%09%09players.splice(i,1);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09console.log(name+%22 is disconnected%22);%0A%09%7D);%0A%09socket.on(%22throw%22,function(name,dir)%7B%0A%09%09socket.broadcast.emit(%22bethrow%22,name,dir
 );%0A%09%7D);%0A

update server.js