View Issue Details

IDProjectCategoryView StatusLast Update
0009810Multi Theft Auto : San AndreasScriptingpublic2018-07-22 21:08
Reportereinheit-101Assigned ToNecktrox 
PrioritynormalSeverityminorReproducibilitysometimes
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0009810: getElementsByType("player") should not return players that are not "joined"
Description

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)
end

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.

Activities

arranTuna

2018-03-12 21:15

manager   ~~0026466

Agreed, just had the same problem.

Necktrox

2018-03-12 23:02

developer   ~~0026467

Should be fixed in https://github.com/multitheftauto/mtasa-blue/commit/41ff5bd589018432e9f8889bd2b43f56145f24a3

Issue History

Date Modified Username Field Change