13.03.2015, 17:58
(
Последний раз редактировалось Correlli; 13.03.2015 в 20:12.
)
I don't remember "GetPlayerWeaponData" function acting like this before 0.3.7 version. I've noticed this thing in 0.3.7 RC2.
Okey, so here's the thing. Player connects to a server, he gets weapons, let's say these:
We run this code:
And we get these results:
Everything fine for now.
Then the player shoots all the bullets (or we remove them with "ResetPlayerWeapons" function) and we run the same code again, only to get these (false) results:
No ammunition, and when there's no ammunition, then there is no weapon, but "GetPlayerWeaponData" function still returns the latest weapons in player's weapon inventory.
Okey, so here's the thing. Player connects to a server, he gets weapons, let's say these:
pawn Код:
GivePlayerWeapon(playerid, WEAPON_SILENCED, 25);
GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 30);
GivePlayerWeapon(playerid, WEAPON_M4, 50);
GivePlayerWeapon(playerid, WEAPON_RIFLE, 15);
pawn Код:
new
w_data[13][2];
for(new a = 0; a < 13; a++)
{
GetPlayerWeaponData(playerid, a, w_data[a][0], w_data[a][1]);
printf("Weaponry for slot %i: weapon (%i), amount (%i)", a, w_data[a][0], w_data[a][1]);
}
Код:
Weaponry for slot 0: weapon (0), amount (0) Weaponry for slot 1: weapon (0), amount (0) Weaponry for slot 2: weapon (23), amount (25) Weaponry for slot 3: weapon (27), amount (30) Weaponry for slot 4: weapon (0), amount (0) Weaponry for slot 5: weapon (31), amount (50) Weaponry for slot 6: weapon (33), amount (15) Weaponry for slot 7: weapon (0), amount (0) Weaponry for slot 8: weapon (0), amount (0) Weaponry for slot 9: weapon (0), amount (0) Weaponry for slot 10: weapon (0), amount (0) Weaponry for slot 11: weapon (0), amount (0) Weaponry for slot 12: weapon (0), amount (0)
Then the player shoots all the bullets (or we remove them with "ResetPlayerWeapons" function) and we run the same code again, only to get these (false) results:
Код:
Weaponry for slot 0: weapon (0), amount (0) Weaponry for slot 1: weapon (0), amount (0) Weaponry for slot 2: weapon (23), amount (0) Weaponry for slot 3: weapon (27), amount (0) Weaponry for slot 4: weapon (0), amount (0) Weaponry for slot 5: weapon (31), amount (0) Weaponry for slot 6: weapon (33), amount (0) Weaponry for slot 7: weapon (0), amount (0) Weaponry for slot 8: weapon (0), amount (0) Weaponry for slot 9: weapon (0), amount (0) Weaponry for slot 10: weapon (0), amount (0) Weaponry for slot 11: weapon (0), amount (0) Weaponry for slot 12: weapon (0), amount (0)