GivePlayerWeapon bug
#1

If you have a weapon, and use GivePlayerWeapon to give a weapon, that has the same slot as your weapon, with 0 bullet to yourself, your weapon will be set to the number of bullets of the new weapon.

For example:
  1. A player has a desert eagle with 100 bullets
  2. The server gives a 9mm to him with 0 bullet by GivePlayerWeapon
  3. The player finds that he has no pistols, since the 100 bullets are ignored, and the 0 bullet from 9mm is counted
  1. A player has a desert eagle with 100 bullets
  2. The server gives a 9mm to him with 10 bullet by GivePlayerWeapon
  3. The player finds that he has only 10 bullet, since the 100 bullets are ignored, and the 10 bullets from 9mm is counted
However, some weapons like shotguns do not act like this. If you give a sawn-off shotgun with 100 bullets to a player who has a combact shotgun with 100 bullets already, he will have 200 bullets.
Reply
#2

That's not a bug. In different weapon slots some weapons replace others and some just add the ammo to the weapon.
Reply
#3

as said above, you know how there are weapon types? well there are ammo types too.

i think its the same for uzi's and tec9's too?
Reply
#4

Ok, if it is not a bug then it is hard to calculate how many ammo the player have, unless you use a timer to get the players' weapon data after giving them weapons.
It'll be better if it is be consistent(add or clear the original bullets a player has), or a GetPlayerAmmoType function is added.
Reply
#5

Yeah, well some weapons are, just like in real life, able to use the same bullets while a Desert Eagle and a 9mm wouldn't use the same type of bullets.
Reply
#6

I think we could just make GetPlayerAmmoType, our own custom function..

why not, make a custom giveplayerweapon to SetPlayerAmmo(playerid, weapon, 0); then call the native giveplayerweapon?
Reply
#7

You may do this, that it has the same idea as SetPlayerWeapon custom function. I am making my own function that bullets are always be added when the weapons are in the same slot.
This will not be a big problem, but as I said, this problem can cause more problems on server side weapons if scripters do not aware of this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)