View Issue Details

IDProjectCategoryView StatusLast Update
0009810New issuesScriptingpublic2018-03-12 23:03
Reportereinheit-101Assigned ToNecktrox 
Status resolvedResolutionfixed 
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.



2018-03-12 21:15

manager   ~~0026466

Agreed, just had the same problem.


2018-03-12 23:02

developer   ~~0026467

Should be fixed in

Issue History

Date Modified Username Field Change