View Issue Details

IDProjectCategoryView StatusLast Update
0007905Multi Theft Auto : San AndreasClientpublic2014-04-30 17:19
ReporterarranTunaAssigned Tosbx320 
PrioritynormalSeverityminorReproducibilityrandom
Status resolvedResolutionfixed 
Product Version 
Target Version1.3.5Fixed in Version1.3.5 
Summary0007905: setPedStat sometimes not synced to client
Description

I made M4 poor do super damage and everyone else logs in and has every weapon set to 1000 stat yet certain players were killing me with 1 bullet as if their M4 stat was desynced so I added some debug and went around getting shot at until I found somebody with the problem:

#Marco-ACAB shot you with M4, damage: 7.9900035858154 M4 stat: 0

Which is shouldn't ever be as this is set when you login:

function setCorrectWeaponSkills()
setPedStat(source, 69, 1000)
setPedStat(source, 70, 1000)
setPedStat(source, 71, 1000)
setPedStat(source, 72, 1000)
setPedStat(source, 73, 1000)
setPedStat(source, 74, 1000)
setPedStat(source, 75, 1000)
setPedStat(source, 76, 1000)
setPedStat(source, 77, 1000)
setPedStat(source, 78, 1000)
end
addEventHandler("onPlayerLogin", root, setCorrectWeaponSkills, true, "low")

And it seems to be set correctly server side but for some reason my client wasn't informed:

Server: getPedStat(getPlayerFromName("#Marco-ACAB"), 78)
Command results: 1000 [number]
Client: getPedStat(getPlayerFromName("#Marco-ACAB"), 78)
Command results: 0 [number]

I did this to see how many are wrong

for i, plr in pairs(getElementsByType("player")) do
if (getPedStat(plr, 78) ~= 1000 and getTeamName(getPlayerTeam(plr)) ~= "Unoccupied") then
outputChatBox(getPlayerName(plr).." "..getPedStat(plr, 78))
end
end

8 out of 728 players had their stat set to 0 when it should have been 1000 as they all logged in.

I'll change it to use onPlayerJoin and see if that makes any difference to it being desynced.

Edit: Checked with onPlayerJoin and no players had desynced stat, but then I reconnected and checked again, 14 players were bugged so it seems to only happen with players that were online before you as I'd been online for a very long time when it returned none.

TagsNo tags attached.

Relationships

related to 0007740 resolvedsbx320 [Sync] Sometimes moving when aiming isn't synced 
related to 0008211 resolvedJusonex getPedStat desync for freshly joined players 

Activities

kakaksk

2013-11-22 20:09

viewer   ~~0019694

Happens sometimes

sbx320

2013-12-23 21:12

administrator   ~~0019855

Last edited: 2013-12-23 21:15

View 2 revisions

Fixed in http://code.google.com/p/mtasa-blue/source/detail?r=6016

This bug was caused by the false assumption that a dead (or unspawned) player cannot have stats.

When a player was dead, while you were connecting their stat values were not sent to the client. Thus they stayed on the default value of zero, which allowed them to kill you after being respawned.

Issue History

Date Modified Username Field Change