Set ammo in a magazine.
#1

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!
Reply
#2

GetPlayerWeaponData and store ammo and GivePlayerWeapon with ammo+ammount
Reply
#3

No. Example:

Change the 35 by a wanted number.
Reply
#4

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
Reply
#5

But when player shoot magazine ammo will be different?
Reply
#6

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.
Reply
#7

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?
Reply
#8

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)