View Issue Details

IDProjectCategoryView StatusLast Update
0009810New issuesScriptingpublic2018-01-28 03:39
Reportereinheit-101Assigned To 
Status newResolutionopen 
Summary0009810: getElementsByType("player") should not return players that are not "joined"

Sometimes i get this debug message:

xxx.lua 651: setPlayerMoney(): Modifying players before onPlayerJoin() can cause desynchronization

This line of code is inside a getElementsByType("player") loop.
A bug like this should not be possible, because getElementsByType() should not return elements that are either non-existing or "not joined".
Also, there is no function like "isPlayerJoined()" to actually prevent this bug. So it may cause desync errors randomly and there is no way to prevent them from happening.

Steps To Reproduce

Randomly execute this code at some points of time when players are joining the server:

for i, thisplayer in pairs(getElementsByType("player")) do
setPlayerMoney(thisplayer, 0)

Maybe one player is currently exactly between the point of "joined" and "not joined" and the debug line appears. It seems to be pretty rare because the time window is small.

TagsNo tags attached.


There are no notes attached to this issue.

Issue History

Date Modified Username Field Change