View Issue Details

IDProjectCategoryView StatusLast Update
0007762Multi Theft Auto : San AndreasServerpublic2013-08-23 01:19
ReporterNeXTremeAssigned Toccw 
PrioritynormalSeveritymajorReproducibilitysometimes
Status resolvedResolutionfixed 
Product Version 
Target Version1.3.4Fixed in Version1.3.4 
Summary0007762: Projectile-type weapons messing up ammo count
Description

Giving projectile-type weapons (slot 8) seems to be severely messing up the ammo count on server. The exact steps you need to take for this to happen are unclear to me, however it seems to happen when giveWeapon() and/or setWeaponAmmo() are called frequently after one another. It also only seems to be the issue with weapons in slot 8 (grenade, molotov, satchel and tear gas).

Here's an image that showcases what exactly happenes with a little script I wrote:
http://i.imgur.com/o4mxe7b.png

The script gives various weapons, each with 10 ammo, on a 50ms timer delay between each weapon change (see the attached code). Before the weapon is changed, it outputs the ammo count from the previous weapon. As you can see on the picture, the molotiv magically gets 1 ammo, and then the next weapon gets thousands of bullets.
(BONUS bug report: Notice that flamethrower has 100 ammo?)

This issue seems to be related to this:
http://bugs.mtasa.com/view.php?id=7719

I have not tested the ammo count on the client, however given the information in the link above it should be correct.

Steps To Reproduce

http://pastebin.com/4zYn6wrZ

TagsNo tags attached.

Activities

lopezloo

2013-08-11 22:01

developer   ~~0019119

Last edited: 2013-08-11 22:03

View 2 revisions

Yes, information about ammo on clientside is correct. Bug with flamethrower: http://bugs.mtasa.com/view.php?id=6639

NeXTreme

2013-08-13 13:05

viewer   ~~0019137

I also noticed that sometimes, getPedWeaponSlot() on server reports a projectile weapon to be on slot 1 (melee). Seems to happen under the same circumstances as the ammo issue.

arranTuna

2013-08-21 15:05

manager   ~~0019179

Last edited: 2013-08-21 15:17

View 3 revisions

Quick way to get grenade desync:

-- Works (returns 100)
srun giveWeapon(getRandomPlayer(), 16, 100)
srun outputChatBox(getPedTotalAmmo(getRandomPlayer(), 8))
Edit: After further testing this can even return 0 sometimes.

-- Doesn't work (returns 0)
srun giveWeapon(getRandomPlayer(), 16, 100, true)
srun outputChatBox(getPedTotalAmmo(getRandomPlayer(), 8))

-- Works (returns 100)
srun giveWeapon(getRandomPlayer(), 16, 100) setPedWeaponSlot(getRandomPlayer(), 8)
srun outputChatBox(getPedTotalAmmo(getRandomPlayer(), 8))

ccw

2013-08-23 01:18

administrator   ~~0019189

Fixed the example provided by Arran in http://code.google.com/p/mtasa-blue/source/detail?r=5741

NeXTreme, if this doesn't fix the issue for you, please provide example script

Issue History

Date Modified Username Field Change