Dont send after PlayerRemoving#223
Conversation
| self.push_line("for _, player in Players:GetPlayers() do"); | ||
| self.indent(); | ||
| self.push_line("load_player(player)"); | ||
| self.push_line("player_map[player] = save()"); | ||
| self.dedent(); | ||
| self.push_line("end"); | ||
| self.push_line("Players.PlayerAdded:Connect(function(player)"); | ||
| self.indent(); | ||
| self.push_line("load_player(player)"); | ||
| self.push_line("player_map[player] = save()"); | ||
| self.dedent(); | ||
| self.push_line("end)"); |
There was a problem hiding this comment.
This is an unnecessary addition
There was a problem hiding this comment.
If they are not added to player_map on join they will only be added after the server receives an event from the player, so zap would drop their requests before that. But i just noticed an issue, other scripts PlayerAdded will run before zaps so firing inside PlayerAdded would no longer work.
| self.push_line(&format!("task.spawn(function(player_2, call_id_2, {args})")); | ||
| self.indent(); | ||
|
|
||
| self.push_line("if player_map[player_2] == nil and player_2.Parent == nil then return end"); |
There was a problem hiding this comment.
As a performance optimisation, we should check if the player exists before spawning a task.
| self.push(")\n"); | ||
| self.indent(); | ||
|
|
||
| self.push_line(&format!("if player_map[{player}] == nil and {player}.Parent == nil then return end")); |
There was a problem hiding this comment.
This will return in places it shouldn't, as we save to the player map (which could be for the first time) about 25 lines below.
| } | ||
| self.push_line(&format!("for _, player in {list} do")); | ||
| self.indent(); | ||
| self.push_line("if player_map[player] == nil and player.Parent == nil then continue end"); |
There was a problem hiding this comment.
We don't use player_map for unreliables.
Fix #216 by checking if player is still in player_map and also adding to player_map on PlayerAdded.