diff --git a/Scripts/jetSpawner.lua b/Scripts/jetSpawner.lua index adb6e54..b3103c6 100644 --- a/Scripts/jetSpawner.lua +++ b/Scripts/jetSpawner.lua @@ -173,7 +173,7 @@ do -- playerNum -1 if event.id == world.event.S_EVENT_CRASH or event.id == world.event.S_EVENT_PLAYER_LEAVE_UNIT then local unit = event.initiator - if not unit then return end + if not unit or not unit.getPlayerName then return end local playerName = unit:getPlayerName() if playerName then @@ -232,7 +232,7 @@ do --设定下次刷新时间 local Ratio = 0.05 for maxPlayer,ratio in pairs(self.player_ratio_table) do - if #self.playerList <= maxPlayer then + if self.tableCount(self.playerList) <= maxPlayer then Ratio = ratio break end @@ -243,7 +243,7 @@ do local maxTime = nextSpawnTime * (1 + self.RANDOM_DEVIATION) nextSpawnTime = math.random(minTime, maxTime) - Debug('playerNumber:' ..#self.playerList..' ratio: '..Ratio..' Preset:'..preset.categoryName..' nextSpawnTime: '..nextSpawnTime * Ratio) + Debug('playerNumber:' ..self.tableCount(self.playerList)..' ratio: '..Ratio..' Preset:'..preset.categoryName..' nextSpawnTime: '..nextSpawnTime * Ratio) return time + nextSpawnTime * Ratio end