View Issue Details

IDProjectCategoryView StatusLast Update
0007623Multi Theft Auto : San AndreasServerpublic2013-05-31 16:06
ReporterZoLoAssigned Tosbx320 
PrioritynormalSeveritymajorReproducibilitysometimes
Status resolvedResolutionfixed 
PlatformLinuxOSCentOS 6OS Version64 bits
Product Version 
Target Version1.3.3Fixed in Version1.3.3 
Summary0007623: getPedTotalAmmo sometimes returns 0 while player is aiming (Slot 8)
Description

This is probably a fault in logic or dyssynchrony of explosive ammo.

The function getPedTotalAmmo(player, 8), sometimes returns 0 while player is aiming with other weapon slot (Eg: swith and aim with ak47)

Steps To Reproduce

The script below is used with a timer to give 1 Satchel to players who are within a collshape, but some players are aiming with weapon to get more than 5.

Additional Information

Eg. script:

function giveSlotWeapon(player, weapon, ammo, maxAmmo)
local slot = getSlotFromWeapon(weapon)
local curAmmo = getPedTotalAmmo(player, slot)
local curWeapon = getPedWeapon(player, slot)
if(curWeapon ~= weapon) then
takeWeapon(player, curWeapon)
giveWeapon(player, weapon, ammo, true)
else
if(curAmmo < maxAmmo) then
giveWeapon(player, weapon, ammo, true)
else
setPedWeaponSlot(player, slot)
end
end
end

Eg call:
giveSlotWeapon(player, 39, 1, 5)

TagsNo tags attached.

Activities

sbx320

2013-05-18 21:08

administrator   ~~0018582

Couldn't reproduce getPedTotalAmmo returning 0, but found another issue with updating the client's ammo getting out of sync with the Server which lead to the same outcome as you described.

Please retest in a 1.4 nightly from r5410 onwards.

DanceOrDie

2013-05-23 20:26

viewer   ~~0018596

Well, I just tested and it works fine for me now. But it'd be better if someone else could test it again too.

Btw, can this be backported to 1.3.2 please? :)

sbx320

2013-05-31 09:28

administrator   ~~0018617

Fixed in http://code.google.com/p/mtasa-blue/source/detail?r=5410
Backported to 1.3.2 in http://code.google.com/p/mtasa-blue/source/detail?r=5446

Issue History

Date Modified Username Field Change