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:
parent
8c337219b6
commit
1cb6d881b6
1 changed files with 9 additions and 7 deletions
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue