mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-19 06:21:08 +00:00
fix leaving : splice not slice !!
This commit is contained in:
parent
213fe7d84b
commit
8010ae86bd
1 changed files with 6 additions and 5 deletions
|
|
@ -181,17 +181,18 @@ function inject(serv,player)
|
|||
|
||||
player._client.on('end', function () {
|
||||
serv.broadcast(player.username + ' quit the game.', "yellow");
|
||||
player._writeOthers('player_info',{
|
||||
player._writeOthers('player_info', {
|
||||
action: 4,
|
||||
data: [{
|
||||
UUID: transformUuid(player._client.uuid)
|
||||
}]
|
||||
});
|
||||
player._writeOthers('entity_destroy',{'entityIds':[player.entity.id]});
|
||||
player._writeOthers('entity_destroy', {'entityIds': [player.entity.id]});
|
||||
player.emit('disconnect');
|
||||
var index=serv.players.indexOf(player);
|
||||
if(index>-1)
|
||||
serv.players.slice(index,1);
|
||||
var index = serv.players.indexOf(player);
|
||||
if (index > -1) {
|
||||
serv.players.splice(index,1);
|
||||
}
|
||||
delete serv.uuidToPlayer[player._client.uuid];
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue