Set ammo in a magazine. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Set ammo in a magazine. (
/showthread.php?tid=614500)
Set ammo in a magazine. -
Dayrion - 09.08.2016
Hello!
I have simple question:
Is this possible to set ammo in the current magazine of a player? If yes, what is the function?
Thanks for any answer!
Re: Set ammo in a magazine. -
Shinja - 09.08.2016
GetPlayerWeaponData and store ammo and GivePlayerWeapon with ammo+ammount
Re: Set ammo in a magazine. -
Dayrion - 09.08.2016
No. Example:

Change the 35 by a wanted number.
Re: Set ammo in a magazine. -
Konstantinos - 09.08.2016
pawn Код:
GetWeaponMagazineAmmo(weaponid)
{
switch (weaponid)
{
case 22: return 34;
case 23: return 17;
case 24: return 7;
case 26: return 4;
case 27: return 7;
case 28: return 100;
case 29: return 30;
case 30: return 30;
case 31: return 50;
case 32: return 100;
case 38: return 500;
}
return -1;
}
The usage is: GetWeaponMagazineAmmo(weaponid) * how many magazines
An example to set to 46 magazines to your m4 weapon:
pawn Код:
SetPlayerAmmo(playerid, WEAPON_M4, GetWeaponMagazineAmmo(WEAPON_M4) * 46);
which makes it 2300-46
Re: Set ammo in a magazine. -
Shinja - 09.08.2016
But when player shoot magazine ammo will be different?
Re: Set ammo in a magazine. -
Dayrion - 09.08.2016
Quote:
Originally Posted by Konstantinos
pawn Код:
GetWeaponMagazineAmmo(weaponid) { switch (weaponid) { case 22: return 34; case 23: return 17; case 24: return 7; case 26: return 4; case 27: return 7; case 28: return 100; case 29: return 30; case 30: return 30; case 31: return 50; case 32: return 100; case 38: return 500; } return -1; }
The usage is: GetWeaponMagazineAmmo(weaponid) * how many magazines
An example to set to 46 magazines to your m4 weapon:
pawn Код:
SetPlayerAmmo(playerid, WEAPON_M4, GetWeaponMagazineAmmo(WEAPON_M4) * 46);
which makes it 2300-46
|
I've already something like that. I'm looking for set the number of ammo in a magazine.
I think I've to set 1 magazine and custom the number of ammo.
Re: Set ammo in a magazine. -
Konstantinos - 09.08.2016
You said to set the number of ammo in a magazine, let's say m4 has 1 magazine = 50 bullets. Is what you want to set let's say half of the bullets in a magazine which makes it 25 bullets? If not, can you give an example of what you are looking for because it is kind of confusing?
Re: Set ammo in a magazine. -
PrO.GameR - 09.08.2016
If you mean make a player have for example 10/50 bullets with 200 outside the magazine, as far as I know it's not possible (maybe with YSI and faking player shot packets? I haven't worked with that so it might be possible there)
but setting ammo less than a magazine always affects the current magazine.