mirror of
https://github.com/demostf/demo.js
synced 2026-06-03 16:44:12 +02:00
bit more robust
This commit is contained in:
parent
8c337219b6
commit
1cb6d881b6
1 changed files with 9 additions and 7 deletions
16
parser.js
16
parser.js
|
|
@ -117,14 +117,16 @@ Parser.prototype.parseBody = function () {
|
|||
break;
|
||||
case 'player_spawn':
|
||||
userId = packet.event.values.userid;
|
||||
if (!this.state.users[userId].team) { //only register first spawn
|
||||
this.state.users[userId].team = packet.event.values.team === 2 ? 'red' : 'blue'
|
||||
if (this.state.users[userId]) {
|
||||
if (!this.state.users[userId].team) { //only register first spawn
|
||||
this.state.users[userId].team = packet.event.values.team === 2 ? 'red' : 'blue'
|
||||
}
|
||||
var classId = packet.event.values.class;
|
||||
if (!this.state.users[userId].classes[classId]) {
|
||||
this.state.users[userId].classes[classId] = 0;
|
||||
}
|
||||
this.state.users[userId].classes[classId]++;
|
||||
}
|
||||
var classId = packet.event.values.class;
|
||||
if (!this.state.users[userId].classes[classId]) {
|
||||
this.state.users[userId].classes[classId] = 0;
|
||||
}
|
||||
this.state.users[userId].classes[classId]++;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue