1
0
Fork 0
mirror of https://github.com/demostf/demo.js synced 2026-06-04 00:54:14 +02:00

bit more robust

This commit is contained in:
Robin Appelman 2015-02-01 19:02:10 +01:00
commit 1cb6d881b6

View file

@ -117,6 +117,7 @@ Parser.prototype.parseBody = function () {
break; break;
case 'player_spawn': case 'player_spawn':
userId = packet.event.values.userid; userId = packet.event.values.userid;
if (this.state.users[userId]) {
if (!this.state.users[userId].team) { //only register first spawn if (!this.state.users[userId].team) { //only register first spawn
this.state.users[userId].team = packet.event.values.team === 2 ? 'red' : 'blue' this.state.users[userId].team = packet.event.values.team === 2 ? 'red' : 'blue'
} }
@ -125,6 +126,7 @@ Parser.prototype.parseBody = function () {
this.state.users[userId].classes[classId] = 0; this.state.users[userId].classes[classId] = 0;
} }
this.state.users[userId].classes[classId]++; this.state.users[userId].classes[classId]++;
}
break; break;
} }
break; break;