View Single Post
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-09-2013 , 13:33   Re: Store and restore bpammo
Reply With Quote #2

PHP Code:
const WEAPON_SUIT 31;

const 
_ammo_338magnum 1;
const 
_ammo_c4 14;

const 
m_rgAmmo_CBasePlayer[32] = {376,377,...};

new 
gPlayerWeapons[33];
new 
gPlayersBpAmmo[33][_ammo_c4+1];

public 
StoreAllPlayersWeapons()
{
    new 
players[32], numidrgAmmoSlot;
    
get_players(playersnum"a");
    for(--
numnum>=0num--)
    {
        
id players[num];
        
gPlayerWeapons[id] = pev(idpev_weapons) & ~(1<<WEAPON_SUIT);
        for(
rgAmmoSlot=_ammo_338magnumrgAmmoSlot<=_ammo_c4rgAmmoSlot++)
        {
            
gPlayersBpAmmo[id][rgAmmoSlot] = get_pdata_int(idm_rgAmmo_CBasePlayer[rgAmmoSlot]);
        }
    }
}

RestoreWeapons(id)
{
    new 
szWeapon[32];
    new 
weapons gPlayerWeapons[id];
    for(new 
iId CSW_P228iId<=CSW_P90iId++)
    {
        if( 
weapons 1<<iId )
        {
            
get_weaponname(iIdszWeaponcharsmax(szWeapon));
            
give_item(idszWeapon);
        }
    }
    for(new 
rgAmmoSlot=_ammo_338magnumrgAmmoSlot<=_ammo_c4rgAmmoSlot++)
    {
        
set_pdata_int(idm_rgAmmo_CBasePlayer[rgAmmoSlot], gPlayersBpAmmo[id][rgAmmoSlot]);
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 10-10-2013 at 14:12.
ConnorMcLeod is offline