Problem with SetPlayerAmmo.
#1

Hi.

For exemple:

pawn Код:
SetPlayerAmmo(playerid, 5, 0);
It's not work...

I still have the weapon in hands ...
Reply
#2

ClickHere
Look this before
Reply
#3

I already looked. I tried with the slot of the weapon, the id of the weapon, but it's not work.
Reply
#4

Where are you using this ?
Can you show mee the code ?
Reply
#5

PHP код:
SetPlayerAmmo(playerid50); 
5 is not the weapon id, but the slotid.

You have to use the weaponid, look here:
Quote:

weaponslot The ID of the weapon to set the ammo of. The name of this parameter is wrong - the weapon ID must be passed, not the slot
Reply
#6

5 it's a weaponid lol.
https://sampwiki.blast.hk/wiki/Weapons
Reply
#7

Do you want delete your weapon or give an another weapon in the hands?
Reply
#8

delete
Reply
#9

Take this function:
PHP код:
stock RemovePlayerWeapon(playeridweaponidammo 0//©Jeffry
{
    new 
GetPlayerWeapon(playerid), plyWeapons[13], plyAmmo[13];
    for(new 
slot 0slot <= 12slot++)
    {
        
GetPlayerWeaponData(playeridslotplyWeapons[slot], plyAmmo[slot]);
        if(
plyWeapons[slot] == weaponid)
        {
            if(
ammo == || plyAmmo[slot] <= ammo)
            {
                if(
== plyWeapons[slot]) 0;
                
plyAmmo[slot] = 0;
                
plyWeapons[slot] = 0;
            }
            else
            {
                
plyAmmo[slot]-=ammo;
            }
        }
    }
    
ResetPlayerWeapons(playerid);
    for(new 
slot 0slot <= 12slot++)
    {
        
GivePlayerWeapon(playeridplyWeapons[slot], plyAmmo[slot]);
    }
    
SetPlayerArmedWeapon(playeridw);
    return 
1;

and write it so:
PHP код:
RemovePlayerWeapon(playerid,5); 
Reply


Forum Jump:


Users browsing this thread: