Ammo saves correctly but multiplies on spawn
#1

No idea what the problem is, could anyone help me out?

>> ENUM
pawn Код:
enum pInfo
{
    Password[129],
    Level,
    Admin,
    Skin,
    Age,
    Cocaine,
    Banned,
    Float:PosX,
    Float:PosY,
    Float:PosZ,
    Float:PosA,
    Interior,
    VirtualWorld,
    Faction,
    Rank,
    Tutorial,
    Muted,
    HidePM,
    MaskUse,
    Mask,
    MaskID,
    Gender,
    Minutes,
    Hours,
    Paycheck,
    JobEarnings,
    HadPaycheck,
    Bank,
    Money,
    BizKey,
    InBusiness,
    Weapon[12],
    Ammo[12],
    Cigg,
    Cheque[10],
    ChequeAmount[10],
    Signature1[64],
    Signature2[64],
    Signature3[64],
    Signature4[64],
    Signature5[64],
    Signature6[64],
    Signature7[64],
    Signature8[64],
    Signature9[64],
    Signature10[64],
    FishingRod,
    FishingBait,
    FishingLine,
    BlindFold,
    Rope
}


>> SAVING
pawn Код:
forward SavePlayer(playerid);
public SavePlayer(playerid)
{
    if(Logged[playerid])
    {
        new Float:X, Float:Y, Float:Z, Float:A;
        new interior = GetPlayerInterior(playerid);
        new vw = GetPlayerVirtualWorld(playerid);
        new skin = GetPlayerSkin(playerid);
        new money = GetPlayerMoney(playerid);
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, A);
        PlayerInfo[playerid][PosX] = X;
        PlayerInfo[playerid][PosY] = Y;
        PlayerInfo[playerid][PosZ] = Z;
        PlayerInfo[playerid][PosA] = A;
        PlayerInfo[playerid][Interior] = interior;
        PlayerInfo[playerid][VirtualWorld] = vw;
        PlayerInfo[playerid][Skin] = skin;
        PlayerInfo[playerid][Money] = money;




        new INI:file = INI_Open(Path(playerid));
        INI_SetTag(file,"P-RP User");
        INI_WriteInt(file, "Level", PlayerInfo[playerid][Level]);
        INI_WriteInt(file, "Admin", PlayerInfo[playerid][Admin]);
        INI_WriteInt(file, "Skin", PlayerInfo[playerid][Skin]);
        INI_WriteInt(file, "Age", PlayerInfo[playerid][Age]);
        INI_WriteInt(file, "Cocaine", PlayerInfo[playerid][Cocaine]);
        INI_WriteInt(file, "Banned", PlayerInfo[playerid][Banned]);
        INI_WriteFloat(file, "PosX", PlayerInfo[playerid][PosX]);
        INI_WriteFloat(file, "PosY", PlayerInfo[playerid][PosY]);
        INI_WriteFloat(file, "PosZ", PlayerInfo[playerid][PosZ]);
        INI_WriteFloat(file, "PosA", PlayerInfo[playerid][PosA]);
        INI_WriteInt(file, "Interior", PlayerInfo[playerid][Interior]);
        INI_WriteInt(file, "VirtualWorld", PlayerInfo[playerid][VirtualWorld]);
        INI_WriteInt(file, "Faction", PlayerInfo[playerid][Faction]);
        INI_WriteInt(file, "Rank", PlayerInfo[playerid][Rank]);
        INI_WriteInt(file, "Tutorial", PlayerInfo[playerid][Tutorial]);
        INI_WriteInt(file, "Muted", PlayerInfo[playerid][Muted]);
        INI_WriteInt(file, "HidePM", PlayerInfo[playerid][HidePM]);
        INI_WriteInt(file, "MaskUse", PlayerInfo[playerid][MaskUse]);
        INI_WriteInt(file, "Mask", PlayerInfo[playerid][Mask]);
        INI_WriteInt(file, "Gender", PlayerInfo[playerid][Gender]);
        INI_WriteInt(file, "Minutes", PlayerInfo[playerid][Minutes]);
        INI_WriteInt(file, "Hours", PlayerInfo[playerid][Hours]);
        INI_WriteInt(file, "Paycheck", PlayerInfo[playerid][Paycheck]);
        INI_WriteInt(file, "JobEarnings", PlayerInfo[playerid][JobEarnings]);
        INI_WriteInt(file, "HadPaycheck", PlayerInfo[playerid][HadPaycheck]);
        INI_WriteInt(file, "Bank", PlayerInfo[playerid][Bank]);
        INI_WriteInt(file, "Money", PlayerInfo[playerid][Money]);
        INI_WriteInt(file, "BizKey", PlayerInfo[playerid][BizKey]);
        INI_WriteInt(file, "InBusiness", PlayerInfo[playerid][InBusiness]);
        INI_WriteInt(file, "Weapon1", PlayerInfo[playerid][Weapon][0]);
        INI_WriteInt(file, "Weapon2", PlayerInfo[playerid][Weapon][1]);
        INI_WriteInt(file, "Weapon3", PlayerInfo[playerid][Weapon][2]);
        INI_WriteInt(file, "Weapon4", PlayerInfo[playerid][Weapon][3]);
        INI_WriteInt(file, "Weapon5", PlayerInfo[playerid][Weapon][4]);
        INI_WriteInt(file, "Weapon6", PlayerInfo[playerid][Weapon][5]);
        INI_WriteInt(file, "Weapon7", PlayerInfo[playerid][Weapon][6]);
        INI_WriteInt(file, "Weapon8", PlayerInfo[playerid][Weapon][7]);
        INI_WriteInt(file, "Weapon9", PlayerInfo[playerid][Weapon][8]);
        INI_WriteInt(file, "Weapon10", PlayerInfo[playerid][Weapon][9]);
        INI_WriteInt(file, "Weapon11", PlayerInfo[playerid][Weapon][10]);
        INI_WriteInt(file, "Weapon12", PlayerInfo[playerid][Weapon][11]);
        INI_WriteInt(file, "Ammo1", PlayerInfo[playerid][Ammo][0]);
        INI_WriteInt(file, "Ammo2", PlayerInfo[playerid][Ammo][1]);
        INI_WriteInt(file, "Ammo3", PlayerInfo[playerid][Ammo][2]);
        INI_WriteInt(file, "Ammo4", PlayerInfo[playerid][Ammo][3]);
        INI_WriteInt(file, "Ammo5", PlayerInfo[playerid][Ammo][4]);
        INI_WriteInt(file, "Ammo6", PlayerInfo[playerid][Ammo][5]);
        INI_WriteInt(file, "Ammo7", PlayerInfo[playerid][Ammo][6]);
        INI_WriteInt(file, "Ammo8", PlayerInfo[playerid][Ammo][7]);
        INI_WriteInt(file, "Ammo9", PlayerInfo[playerid][Ammo][8]);
        INI_WriteInt(file, "Ammo10", PlayerInfo[playerid][Ammo][9]);
        INI_WriteInt(file, "Ammo11", PlayerInfo[playerid][Ammo][10]);
        INI_WriteInt(file, "Ammo12", PlayerInfo[playerid][Ammo][11]);
        INI_WriteInt(file, "Cigg", PlayerInfo[playerid][Cigg]);
        INI_WriteInt(file, "Cheque1", PlayerInfo[playerid][Cheque][0]);
        INI_WriteInt(file, "Cheque2", PlayerInfo[playerid][Cheque][1]);
        INI_WriteInt(file, "Cheque3", PlayerInfo[playerid][Cheque][2]);
        INI_WriteInt(file, "Cheque4", PlayerInfo[playerid][Cheque][3]);
        INI_WriteInt(file, "Cheque5", PlayerInfo[playerid][Cheque][4]);
        INI_WriteInt(file, "Cheque6", PlayerInfo[playerid][Cheque][5]);
        INI_WriteInt(file, "Cheque7", PlayerInfo[playerid][Cheque][6]);
        INI_WriteInt(file, "Cheque8", PlayerInfo[playerid][Cheque][7]);
        INI_WriteInt(file, "Cheque9", PlayerInfo[playerid][Cheque][8]);
        INI_WriteInt(file, "Cheque10", PlayerInfo[playerid][Cheque][9]);
        INI_WriteInt(file, "ChequeAmount1", PlayerInfo[playerid][ChequeAmount][0]);
        INI_WriteInt(file, "ChequeAmount2", PlayerInfo[playerid][ChequeAmount][1]);
        INI_WriteInt(file, "ChequeAmount3", PlayerInfo[playerid][ChequeAmount][2]);
        INI_WriteInt(file, "ChequeAmount4", PlayerInfo[playerid][ChequeAmount][3]);
        INI_WriteInt(file, "ChequeAmount5", PlayerInfo[playerid][ChequeAmount][4]);
        INI_WriteInt(file, "ChequeAmount6", PlayerInfo[playerid][ChequeAmount][5]);
        INI_WriteInt(file, "ChequeAmount7", PlayerInfo[playerid][ChequeAmount][6]);
        INI_WriteInt(file, "ChequeAmount8", PlayerInfo[playerid][ChequeAmount][7]);
        INI_WriteInt(file, "ChequeAmount9", PlayerInfo[playerid][ChequeAmount][8]);
        INI_WriteInt(file, "ChequeAmount10", PlayerInfo[playerid][ChequeAmount][9]);
        INI_WriteString(file, "Signature1", PlayerInfo[playerid][Signature1]);
        INI_WriteString(file, "Signature2", PlayerInfo[playerid][Signature2]);
        INI_WriteString(file, "Signature3", PlayerInfo[playerid][Signature3]);
        INI_WriteString(file, "Signature4", PlayerInfo[playerid][Signature4]);
        INI_WriteString(file, "Signature5", PlayerInfo[playerid][Signature5]);
        INI_WriteString(file, "Signature6", PlayerInfo[playerid][Signature6]);
        INI_WriteString(file, "Signature7", PlayerInfo[playerid][Signature7]);
        INI_WriteString(file, "Signature8", PlayerInfo[playerid][Signature8]);
        INI_WriteString(file, "Signature9", PlayerInfo[playerid][Signature9]);
        INI_WriteString(file, "Signature10", PlayerInfo[playerid][Signature10]);
        INI_WriteInt(file, "FishRod", PlayerInfo[playerid][FishingRod]);
        INI_WriteInt(file, "FishBait", PlayerInfo[playerid][FishingBait]);
        INI_WriteInt(file, "FishLine", PlayerInfo[playerid][FishingLine]);
        INI_WriteInt(file, "BlindFold", PlayerInfo[playerid][BlindFold]);
        INI_WriteInt(file, "Rope", PlayerInfo[playerid][Rope]);
        INI_Close(file);
    }
}
pawn Код:
forward SaveWeapons(playerid);
public SaveWeapons(playerid)
{
    GetPlayerWeaponData(playerid, 1, PlayerInfo[playerid][Weapon][0], PlayerInfo[playerid][Ammo][0]);
    GetPlayerWeaponData(playerid, 2, PlayerInfo[playerid][Weapon][1], PlayerInfo[playerid][Ammo][1]);
    GetPlayerWeaponData(playerid, 3, PlayerInfo[playerid][Weapon][2], PlayerInfo[playerid][Ammo][2]);
    GetPlayerWeaponData(playerid, 4, PlayerInfo[playerid][Weapon][3], PlayerInfo[playerid][Ammo][3]);
    GetPlayerWeaponData(playerid, 5, PlayerInfo[playerid][Weapon][4], PlayerInfo[playerid][Ammo][4]);
    GetPlayerWeaponData(playerid, 6, PlayerInfo[playerid][Weapon][5], PlayerInfo[playerid][Ammo][5]);
    GetPlayerWeaponData(playerid, 7, PlayerInfo[playerid][Weapon][6], PlayerInfo[playerid][Ammo][6]);
    GetPlayerWeaponData(playerid, 8, PlayerInfo[playerid][Weapon][7], PlayerInfo[playerid][Ammo][7]);
    GetPlayerWeaponData(playerid, 9, PlayerInfo[playerid][Weapon][8], PlayerInfo[playerid][Ammo][8]);
    GetPlayerWeaponData(playerid, 10, PlayerInfo[playerid][Weapon][9], PlayerInfo[playerid][Ammo][9]);
    GetPlayerWeaponData(playerid, 11, PlayerInfo[playerid][Weapon][10], PlayerInfo[playerid][Ammo][10]);
    GetPlayerWeaponData(playerid, 12, PlayerInfo[playerid][Weapon][11], PlayerInfo[playerid][Ammo][11]);
    return true;
}
>> SPAWNING
pawn Код:
forward LoadUser_account(playerid, name[], value[]);
public LoadUser_account(playerid, name[], value[])
{
    INI_String("Password", PlayerInfo[playerid][Password], 129);
    INI_Int("Level", PlayerInfo[playerid][Level]);
    INI_Int("Admin", PlayerInfo[playerid][Admin]);
    INI_Int("Skin", PlayerInfo[playerid][Skin]);
    INI_Int("Age", PlayerInfo[playerid][Age]);
    INI_Int("Cocaine", PlayerInfo[playerid][Cocaine]);
    INI_Int("Banned", PlayerInfo[playerid][Banned]);
    INI_Float("PosX", PlayerInfo[playerid][PosX]);
    INI_Float("PosY", PlayerInfo[playerid][PosY]);
    INI_Float("PosZ", PlayerInfo[playerid][PosZ]);
    INI_Float("PosA", PlayerInfo[playerid][PosA]);
    INI_Int("Interior", PlayerInfo[playerid][Interior]);
    INI_Int("VirtualWorld", PlayerInfo[playerid][VirtualWorld]);
    INI_Int("Faction", PlayerInfo[playerid][Faction]);
    INI_Int("Rank", PlayerInfo[playerid][Rank]);
    INI_Int("Tutorial", PlayerInfo[playerid][Tutorial]);
    INI_Int("Muted", PlayerInfo[playerid][Muted]);
    INI_Int("HidePM", PlayerInfo[playerid][HidePM]);
    INI_Int("MaskUse", PlayerInfo[playerid][MaskUse]);
    INI_Int("Mask", PlayerInfo[playerid][Mask]);
    INI_Int("MaskID", PlayerInfo[playerid][MaskID]);
    INI_Int("Gender", PlayerInfo[playerid][Gender]);
    INI_Int("Minutes", PlayerInfo[playerid][Minutes]);
    INI_Int("Hours", PlayerInfo[playerid][Hours]);
    INI_Int("Paycheck", PlayerInfo[playerid][Paycheck]);
    INI_Int("JobEarnings", PlayerInfo[playerid][JobEarnings]);
    INI_Int("HadPaycheck", PlayerInfo[playerid][HadPaycheck]);
    INI_Int("Bank", PlayerInfo[playerid][Bank]);
    INI_Int("Money", PlayerInfo[playerid][Money]);
    INI_Int("BizKey", PlayerInfo[playerid][BizKey]);
    INI_Int("InBusiness", PlayerInfo[playerid][InBusiness]);
    INI_Int("Weapon1", PlayerInfo[playerid][Weapon][0]);
    INI_Int("Weapon2", PlayerInfo[playerid][Weapon][1]);
    INI_Int("Weapon3", PlayerInfo[playerid][Weapon][2]);
    INI_Int("Weapon4", PlayerInfo[playerid][Weapon][3]);
    INI_Int("Weapon5", PlayerInfo[playerid][Weapon][4]);
    INI_Int("Weapon6", PlayerInfo[playerid][Weapon][5]);
    INI_Int("Weapon7", PlayerInfo[playerid][Weapon][6]);
    INI_Int("Weapon8", PlayerInfo[playerid][Weapon][7]);
    INI_Int("Weapon9", PlayerInfo[playerid][Weapon][8]);
    INI_Int("Weapon10", PlayerInfo[playerid][Weapon][9]);
    INI_Int("Weapon11", PlayerInfo[playerid][Weapon][10]);
    INI_Int("Weapon12", PlayerInfo[playerid][Weapon][11]);
    INI_Int("Ammo1", PlayerInfo[playerid][Ammo][0]);
    INI_Int("Ammo2", PlayerInfo[playerid][Ammo][1]);
    INI_Int("Ammo3", PlayerInfo[playerid][Ammo][2]);
    INI_Int("Ammo4", PlayerInfo[playerid][Ammo][3]);
    INI_Int("Ammo5", PlayerInfo[playerid][Ammo][4]);
    INI_Int("Ammo6", PlayerInfo[playerid][Ammo][5]);
    INI_Int("Ammo7", PlayerInfo[playerid][Ammo][6]);
    INI_Int("Ammo8", PlayerInfo[playerid][Ammo][7]);
    INI_Int("Ammo9", PlayerInfo[playerid][Ammo][8]);
    INI_Int("Ammo10", PlayerInfo[playerid][Ammo][9]);
    INI_Int("Ammo11", PlayerInfo[playerid][Ammo][10]);
    INI_Int("Ammo12", PlayerInfo[playerid][Ammo][11]);
    INI_Int("Cigg", PlayerInfo[playerid][Cigg]);
    INI_Int("Cheque1", PlayerInfo[playerid][Cheque][0]);
    INI_Int("Cheque2", PlayerInfo[playerid][Cheque][1]);
    INI_Int("Cheque3", PlayerInfo[playerid][Cheque][2]);
    INI_Int("Cheque4", PlayerInfo[playerid][Cheque][3]);
    INI_Int("Cheque5", PlayerInfo[playerid][Cheque][4]);
    INI_Int("Cheque6", PlayerInfo[playerid][Cheque][5]);
    INI_Int("Cheque7", PlayerInfo[playerid][Cheque][6]);
    INI_Int("Cheque8", PlayerInfo[playerid][Cheque][7]);
    INI_Int("Cheque9", PlayerInfo[playerid][Cheque][8]);
    INI_Int("Cheque10", PlayerInfo[playerid][Cheque][9]);
    INI_Int("ChequeAmount1", PlayerInfo[playerid][ChequeAmount][0]);
    INI_Int("ChequeAmount2", PlayerInfo[playerid][ChequeAmount][1]);
    INI_Int("ChequeAmount3", PlayerInfo[playerid][ChequeAmount][2]);
    INI_Int("ChequeAmount4", PlayerInfo[playerid][ChequeAmount][3]);
    INI_Int("ChequeAmount5", PlayerInfo[playerid][ChequeAmount][4]);
    INI_Int("ChequeAmount6", PlayerInfo[playerid][ChequeAmount][5]);
    INI_Int("ChequeAmount7", PlayerInfo[playerid][ChequeAmount][6]);
    INI_Int("ChequeAmount8", PlayerInfo[playerid][ChequeAmount][7]);
    INI_Int("ChequeAmount9", PlayerInfo[playerid][ChequeAmount][8]);
    INI_Int("ChequeAmount10", PlayerInfo[playerid][ChequeAmount][9]);
    INI_String("Signature1", PlayerInfo[playerid][Signature1], 48);
    INI_String("Signature2", PlayerInfo[playerid][Signature2], 48);
    INI_String("Signature3", PlayerInfo[playerid][Signature3], 48);
    INI_String("Signature4", PlayerInfo[playerid][Signature4], 48);
    INI_String("Signature5", PlayerInfo[playerid][Signature5], 48);
    INI_String("Signature6", PlayerInfo[playerid][Signature6], 48);
    INI_String("Signature7", PlayerInfo[playerid][Signature7], 48);
    INI_String("Signature8", PlayerInfo[playerid][Signature8], 48);
    INI_String("Signature9", PlayerInfo[playerid][Signature9], 48);
    INI_String("Signature10", PlayerInfo[playerid][Signature10], 48);
    INI_Int("FishRod", PlayerInfo[playerid][FishingRod]);
    INI_Int("FishBait", PlayerInfo[playerid][FishingBait]);
    INI_Int("FishLine", PlayerInfo[playerid][FishingLine]);
    INI_Int("BlindFold", PlayerInfo[playerid][BlindFold]);
    INI_Int("Rope", PlayerInfo[playerid][Rope]);
    return 1;
}
pawn Код:
for(new i = 0; i < 12; i++)
    {
        if(PlayerInfo[playerid][Weapon][i]) GivePlayerWeapon(playerid, PlayerInfo[playerid][Weapon][i], PlayerInfo[playerid][Ammo][i]);
    }
Reply
#2

ResetPlayerWeapons
Reply
#3

Show the weapon loading from database/ini.
Reply
#4

Show your onplayerdis, and LoadUser_data(playerid,name[],value[]) please
Reply
#5

Thread updated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)