View Issue Details

IDProjectCategoryView StatusLast Update
0008254Multi Theft Auto : San AndreasClientpublic2014-08-01 00:56
ReporterGrafuAssigned ToCazomino05 
Status resolvedResolutionfixed 
Platform64-bitOSWindowsOS Version8.1 Pro
Product Version 
Target Version1.4Fixed in Version1.4 
Summary0008254: Elements lose velocity when streamed-in players fire their weapons

Elements lose velocity when streamed-in players fire their weapons. This issue occurs to many types of elements: player peds, vehicles, possibly rockets too. As you can see in the video, the gameplay with this issue is horrible. Here are 2 videos, one with speed correction and another one without it:

Steps To Reproduce

This can possibly be reproduced doing the following steps:

Player 1 firing his weapons while player 2 flying over him (I recommend hydras)

Yet I don't know, if there are any other conditions, which leads the issue to occur.

TagsNo tags attached.


has duplicate 0008375 closed New issues Element movement is not smooth, when laggy steamed-in players fire their weapons 



2014-06-05 21:29

updater   ~~0020969

Last edited: 2014-06-05 21:30

View 2 revisions

So this is the cause of the well-known hydra airbraking bug?
really annoying, fly over others firing their weapons (happens all the time in DM maps, where you fly, is a fight)

and then you'll lose velocity and drop, impact most likely killing you. please give this some priority, mostly for hydras.

I was wondering what was causing hydra's (apart from other elements) to drop randomly, as it's really gameplay-ruining, now if this is the cause atleast we know it now.


2014-06-05 22:21

viewer   ~~0020970

Last edited: 2014-06-15 14:58

View 2 revisions

It can also be reproduced on parachute. When you're skydiving and your ped suddenly stops in air. If occured being on a parachute, the script considers the ped being landed (since speed is 0) and removes it.


2014-06-18 22:12

administrator   ~~0021051

<rasta_Toady> this #8254 could be related to the way we compensate lag
<rasta_Toady> since we move players/vehicles back and forth between frames
<rasta_Toady> probably wasnt noticable until we added shot lag compensation for vehicles
<rasta_Toady> as velocity barely affects running around players


2014-06-30 14:58

viewer   ~~0021186

I've tried disabling bullet sync and latency reduction, but no change. Could this be related to vehicle extrapolation?


2014-07-01 22:26

reporter   ~~0021201

Last edited: 2014-07-01 22:33

View 3 revisions

could you retest this with r6634 or greater? I'm VERY sure I fixed it.

here are the runcode lines I used:
run ox, oy, oz = getElementPosition(getPedOccupiedVehicle(getRandomPlayer()))
run vehicle = getRandomPlayer().vehicle
run px = vehicle.position vehicle.position = Vector3(ox, oy, oz) setTimer(function ( ) vehicle.position = px end, 50, 1)

This happened because the lag compensation was warping the vehicle very far back ( greater than 50 units ) and the wait for ground code was triggering which has a bug where it resets turn velocity and velocity rather than storing them.

fix at


2014-07-02 01:17

viewer   ~~0021206

Last edited: 2014-07-02 17:14

View 3 revisions

We will test this out for sure. Thank you for putting your time into this. I will let you know, if something is wrong.

EDIT: Tested with 8 different ping having people. Been testing for an hour and no more freezes occured. Good job ^^

Another edit: This bug also appears on falling players (reproduced it on my own ped when I was skydiving with a parachute. Wasn't able to make a video for this).


2014-07-02 18:35

reporter   ~~0021213

I do apologize I only read vehicles, I know where to fix it though.


2014-07-22 20:56

viewer   ~~0021412

Last edited: 2014-07-22 20:57

View 2 revisions

Partially fixed. The velocity doesn't stay at 0 km/h after the problem occurs, but it's still very annoying when the flying gets interrupted by constant freezes. If A LOT of laggy players fire their weapons when you fly over, your plane might stick to the place for 2-4 seconds till their clip end up. Here's a video:


2014-07-22 22:39

administrator   ~~0021413

Try latest nightly


2014-07-23 15:35

reporter   ~~0021420

Since this was reopened, I've set this to feedback it was originally fixed when not near custom objects and should now be fixed for all other cases as ccw asked could you please retest and reply to this bug as it is holding up 1.4.


2014-07-23 21:52

viewer   ~~0021426

I've tested it with hydras. No more freezes like I've described, but I've noticed I got 1 freeze when I was parachuting: I was opening the parachute and instead of smoothly slowing down, my velocity went instantly 0 right after the chute open. I believe those sticks aren't caused by the parachute resource, because the script has intended behavior to smoothly reduce the velocity till it reaches chute landing speed, but sometimes it sticks in the air (might also be some other issue, not this related, because (not sure, but as far as I remember) it occurs under different conditions than the fixed issue. So in conclusion:

-Plane freezes fixed
-Ped freezes still exist, but possibly under different conditions


2014-07-23 23:30

reporter   ~~0021430

what revision did you test exactly? type ver in console to find out


2014-07-23 23:43

viewer   ~~0021431

Server and all clients r6708


2014-07-24 21:13

reporter   ~~0021433

I can't test this so I'm going to need more information or a video basically I'm interested in at what point the "velocity sticks" and if it's actually the parachute resource thinking the player is on the ground or if it is something else


2014-07-24 22:22

viewer   ~~0021435

I could maybe explain this: if the ped velocity gets changed by MTA for a half frame, getting element velocity while in that temporary frame stop would return velocity zero. What means using this value for other actions would lead the ped to be frozen. I am not sure about this since MTA should be already restoring velocity before onClientRender is triggered, but I have no more ideas what could cause it. And about the sticking: whenever you skydive and open your chute, slowing down the player takes only some frames instead of smoothly reducing the speed. It feels like your chute grabs some branches. :p


2014-07-24 22:46

reporter   ~~0021437

Right, I'm gonna add a scripting function to check if the ground is loading under the ped if this returns true then I know what to do if you could tell us how often this happens that would be useful is it reproducable every time or just sometimes


2014-07-24 22:51

viewer   ~~0021438

It happens randomly, not every time.


2014-07-24 23:11

reporter   ~~0021439

log the output of isElementWaitingForGroundToLoad when you freeze looking for true, you'l need to do it in onClientRender and tells is if it is returning true or not.


2014-07-24 23:27

viewer   ~~0021440

I will. And when I am done, I will tell you. ^^


2014-07-24 23:38

reporter   ~~0021441

Thanks :)


2014-07-25 16:07

viewer   ~~0021453

Last edited: 2014-07-25 16:14

View 4 revisions

Okay, my ped managed to stick in air and I've logged isElementWaitingForGroundToLoad output (been doing it onClientRender, like you said). The function returned false when the stick occured (even when the function was returning true right after changing location by warping)

  1. I warp to another location (into the air)
  2. isElementWaitingForGroundToLoad called onClientRender returns true for 1-6 frames
  3. My ped starts landing with the parachute, function returns true no more.
  4. I click left mouse button to open the chute and my ped instantly freezes (starts landing at chute speed without being interpolated from the skydiving state). The function still returns false


2014-07-25 16:40

reporter   ~~0021455

how modified is your parachute resource? have you tried backing it up and using the original one? it's possible parachute is just resetting velocity


2014-07-25 19:56

viewer   ~~0021461

It's made to get current velocity and slowly reduce the speed in some time. So the only thing what would cause speed to reset seems to be bad getElementVelocity data, which gets recalculated. Anyways, I was testing all day and it only occured once, seems to be very rare after the modifications to player/ped logic.


2014-07-25 19:58

reporter   ~~0021462

Last edited: 2014-07-25 20:02

View 3 revisions

well the only instance of the game freezing a ped is returned by that function and was disabled in r6708 which is why I'm confused. the only way it could happen is if you called setElementPosition which parachute doesn't

The freezing when you call setelementposition is more by design than by accident and you'd have to move him > 50 units


2014-07-25 20:13

viewer   ~~0021463

But that velocity stick happens after some time player has warped. And another thing I am not clear about is how the weapon firing related to ground object loading?


2014-07-25 20:17

reporter   ~~0021464

every time the local player records a shot he is moved back to where he would have been that time ago which triggers waiting for ground to load which didn't restore velocity and disabled async loading


2014-07-25 20:49

viewer   ~~0021465

Last edited: 2014-07-25 21:16

View 2 revisions

I am still curious what getElementVelocity would return, if I used in the time you process that moving back thing. Like you've said, the problem might also be in the parachute script, since the ped after r6708 only freezes when opening the chute, but no longer when skydiving.


2014-07-26 23:14

reporter   ~~0021478

I don't think that's possible as MTA isn't asynchronous.


2014-07-26 23:27

viewer   ~~0021479

You mean getElementVelocity gets queued, if freezing thing is being done in the time?


2014-07-26 23:29

reporter   ~~0021480

no I mean the moving back thing happens before processing goes back to Lua.


2014-07-26 23:52

viewer   ~~0021482

Last edited: 2014-07-29 12:51

View 5 revisions

So the parachute freeze issue must be the script itself then. I see no other ways to get it frozen only on opening chute.

EDIT: I've checked this part of the script:

"-- going too slow, speed back up to appropriate speed
elseif ( velZ > currentfallspeed ) then
velZ = currentfallspeed

                                            if lastspeed &lt;= velZ then
                                                    currentmovespeed = currentmovespeed / 2

This part seems to do the behavior, which I've described before. currentfallspeed is -0.15 at game speed 1. So if velocity returned by getElementVelocity is zero, this part gets executed and we get our described behavior. The only question is: where we get the zero velocity from?

EDIT 2: I will put some debug code into the parachute, to check what speeds it returns when the freeze occur.

EDIT 3: Reproduced 2 hydra freezes today, but they seem to be caused by something else than firing weapons. (velocity went 0 km/h and didn't get back)

EDIT 4: Managed to record the freezes of the vehicle. They weren't occuring since last fixes, occured only once yesterday (july 28th) and today (july 29th) they started occuring pretty often. I don't believe current freezes are somehow related to the ones I've told you about earlier, because in some of the freezes there were no streamed players in. Here's the video:


2014-07-29 15:43

reporter   ~~0021506

Last edited: 2014-07-29 15:45

View 2 revisions

my code to reset velocity was reverted, if it happens it'l happen as shown in the video however ccw might have fixed those two freezes hopefully

if not it really has to be your scripts calling setElementPosition or setElementVelocity


2014-07-29 16:26

administrator   ~~0021507

Please retry with latest nightly


2014-07-29 19:34

viewer   ~~0021515

Last edited: 2014-07-31 19:37

View 2 revisions

Testing will take some time, since the issue occurs randomly. I will report my observings here when I am done.

EDIT: Been testing for 2 days. No more vehicle freezing, only frozen once on the parachute. I think you have put way too much effort to get this fixed, so now I feel ashamed to continue this issue. Great job ^^ This can be tagged as resolved now.

Issue History

Date Modified Username Field Change