Weapon not saving
#1

Hello folks,
I made a quite advanced /inventory (for weapons) and made two commands:
/putgun - To put a gun inside the "bag" / inventory.
/takegun - To take a gun from the "bag" / inventory.

The weapons in the inventory save excellent. But the guns that the player didn't put in the bag don't save.
What is the problem here?

Here is my pInfo enum:
pawn Код:
enum pInfo
{
    pWeapons,
}
The saving:
pawn Код:
INI_WriteInt(File,"Weapons", PlayerInfo[playerid][pWeapons]);
The loading:
pawn Код:
INI_Int("Weapons", PlayerInfo[playerid][pWeapons]);
The publics:
pawn Код:
public SafeGivePlayerWeapon(playerid, weaponid, ammo)
{
    ScriptWeaponsUpdated[playerid] = 1;
    GivePlayerWeapon(playerid, weaponid, ammo);
    SetTimerEx("UpdateWeapons",2500,false,"i",playerid);
    return 1;
}

public UpdateWeapons(plyid)
{
    new weaponid, ammo;
    for(new i = 0; i < 13; i++)
    {
        GetPlayerWeaponData(plyid, i, weaponid, ammo);
        ScriptWeapons[plyid][i] = weaponid;
    }
    ScriptWeaponsUpdated[plyid] = 0;
    return 1;
}

public RemovePlayerWeapon(playerid, weaponid)
{
    new plyWeapons[12] = 0;
    new plyAmmo[12] = 0;
    for(new slot = 0; slot != 12; slot++)
    {
        new wep, ammo;
        GetPlayerWeaponData(playerid, slot, wep, ammo);

        if(wep != weaponid && ammo != 0)
        {
            GetPlayerWeaponData(playerid, slot, plyWeapons[slot], plyAmmo[slot]);
        }
    }

    SafeResetPlayerWeapons(playerid);
    for(new slot = 0; slot != 12; slot++)
    {
        if(plyAmmo[slot] != 0)
        {
            SafeGivePlayerWeapon(playerid, plyWeapons[slot], plyAmmo[slot]);
        }
    }
    return 1;
}

public SafeResetPlayerWeapons(playerid)
{
    ScriptWeaponsUpdated[playerid] = 1;
    ResetPlayerWeapons(playerid);
    SetTimerEx("UpdateWeapons",2500,false,"i",playerid);
    return 1;
}
Solutions?
Thanks!
Reply


Messages In This Thread
Weapon not saving - by AndySedeyn - 09.04.2014, 09:18
Re: Weapon not saving - by Dokins - 09.04.2014, 10:06
Re: Weapon not saving - by AndySedeyn - 09.04.2014, 10:11
Re: Weapon not saving - by Dokins - 09.04.2014, 10:36
Re: Weapon not saving - by AndySedeyn - 09.04.2014, 11:16
Re: Weapon not saving - by xVIP3Rx - 09.04.2014, 11:28
Re: Weapon not saving - by Dokins - 09.04.2014, 11:39
Re: Weapon not saving - by AndySedeyn - 09.04.2014, 12:09

Forum Jump:


Users browsing this thread: 2 Guest(s)