Weapons arent saving. Supposed to every 2 secs
#1

So this says it saves weapons every 2 seconds...but it doesnt. Creates the save .cfg file for the account but doesnt save weapons.
Ideas?
pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <dini>
#include <dudb>
#include <sscanf2>

new file[256];


enum WepData
{
        Weapon1,
        Weapon1a,
        Weapon2,
        Weapon2a,
        Weapon3,
        Weapon3a,
        Weapon4,
        Weapon4a,
        Weapon5,
        Weapon5a,
        Weapon6,
        Weapon6a,
        Weapon7,
        Weapon7a,
        Weapon8,
        Weapon8a,
        Weapon9,
        Weapon9a,
        Weapon10,
        Weapon10a,
        Weapon11,
        Weapon11a,
        Weapon12,
        Weapon12a,
}

new WeaponInfo[MAX_PLAYERS][WepData];

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
        print("\n--------------------------------------");
        print(" Weapon Saving + Loading by Milan_Huizen");
        print("--------------------------------------\n");
        return 1;
}

public OnFilterScriptExit()
{
        return 1;
}

#else

main()
{
        print("\n----------------------------------");
        print(" Blank Gamemode by your name here");
        print("----------------------------------\n");
}

#endif


public OnPlayerConnect(playerid)
{
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), "/Accounts/weapons/%s.ini", name);
    if (!dini_Exists(file))
    {
                dini_Create(file);
                dini_IntSet(file, "Weapon1",WeaponInfo[playerid][Weapon1] = 0);
                dini_IntSet(file, "Weapon1a",WeaponInfo[playerid][Weapon1a] = 0);
                dini_IntSet(file, "Weapon2",WeaponInfo[playerid][Weapon2] = 0);
                dini_IntSet(file, "Weapon2a",WeaponInfo[playerid][Weapon2a] = 0);
                dini_IntSet(file, "Weapon3",WeaponInfo[playerid][Weapon3] = 0);
                dini_IntSet(file, "Weapon3a",WeaponInfo[playerid][Weapon3a] = 0);
                dini_IntSet(file, "Weapon4",WeaponInfo[playerid][Weapon4] = 0);
                dini_IntSet(file, "Weapon4a",WeaponInfo[playerid][Weapon4a] = 0);
                dini_IntSet(file, "Weapon5",WeaponInfo[playerid][Weapon5] = 0);
                dini_IntSet(file, "Weapon5a",WeaponInfo[playerid][Weapon5a] = 0);
                dini_IntSet(file, "Weapon6",WeaponInfo[playerid][Weapon6] = 0);
                dini_IntSet(file, "Weapon6a",WeaponInfo[playerid][Weapon6a] = 0);
                dini_IntSet(file, "Weapon7",WeaponInfo[playerid][Weapon7] = 0);
                dini_IntSet(file, "Weapon7a",WeaponInfo[playerid][Weapon7a] = 0);
                dini_IntSet(file, "Weapon8",WeaponInfo[playerid][Weapon8] = 0);
                dini_IntSet(file, "Weapon8a",WeaponInfo[playerid][Weapon8a] = 0);
                dini_IntSet(file, "Weapon9",WeaponInfo[playerid][Weapon9] = 0);
                dini_IntSet(file, "Weapon9a",WeaponInfo[playerid][Weapon9a] = 0);
                dini_IntSet(file, "Weapon10",WeaponInfo[playerid][Weapon10] = 0);
                dini_IntSet(file, "Weapon10a",WeaponInfo[playerid][Weapon10a] = 0);
                dini_IntSet(file, "Weapon11",WeaponInfo[playerid][Weapon11] = 0);
                dini_IntSet(file, "Weapon11a",WeaponInfo[playerid][Weapon11a] = 0);
                dini_IntSet(file, "Weapon12",WeaponInfo[playerid][Weapon12] = 0);
                dini_IntSet(file, "Weapon12a",WeaponInfo[playerid][Weapon12a] = 0);
        }
        else
        {
                WeaponInfo[playerid][Weapon1] = dini_Int(file, "Weapon1");
                WeaponInfo[playerid][Weapon1a] = dini_Int(file, "Weapon1a");
                WeaponInfo[playerid][Weapon2] = dini_Int(file, "Weapon2");
                WeaponInfo[playerid][Weapon2a] = dini_Int(file, "Weapon2a");
                WeaponInfo[playerid][Weapon3] = dini_Int(file, "Weapon3");
                WeaponInfo[playerid][Weapon3a] = dini_Int(file, "Weapon3a");
                WeaponInfo[playerid][Weapon4] = dini_Int(file, "Weapon4");
                WeaponInfo[playerid][Weapon4a] = dini_Int(file, "Weapon4a");
                WeaponInfo[playerid][Weapon5] = dini_Int(file, "Weapon5");
                WeaponInfo[playerid][Weapon5a] = dini_Int(file, "Weapon5a");
                WeaponInfo[playerid][Weapon6] = dini_Int(file, "Weapon6");
                WeaponInfo[playerid][Weapon6a] = dini_Int(file, "Weapon6a");
                WeaponInfo[playerid][Weapon7] = dini_Int(file, "Weapon7");
                WeaponInfo[playerid][Weapon7a] = dini_Int(file, "Weapon7a");
                WeaponInfo[playerid][Weapon8] = dini_Int(file, "Weapon8");
                WeaponInfo[playerid][Weapon8a] = dini_Int(file, "Weapon8a");
                WeaponInfo[playerid][Weapon9] = dini_Int(file, "Weapon9");
                WeaponInfo[playerid][Weapon9a] = dini_Int(file, "Weapon9a");
                WeaponInfo[playerid][Weapon10] = dini_Int(file, "Weapon10");
                WeaponInfo[playerid][Weapon10a] = dini_Int(file, "Weapon10a");
                WeaponInfo[playerid][Weapon11] = dini_Int(file, "Weapon11");
                WeaponInfo[playerid][Weapon11a] = dini_Int(file, "Weapon11a");
                WeaponInfo[playerid][Weapon12] = dini_Int(file, "Weapon12");
                WeaponInfo[playerid][Weapon12a] = dini_Int(file, "Weapon12a");
        }
        return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
        return 1;
}

public OnPlayerSpawn(playerid)
{
        GivePlayerWeapon(playerid, WeaponInfo[playerid][Weapon1], WeaponInfo[playerid][Weapon1a]);
        GivePlayerWeapon(playerid, WeaponInfo[playerid][Weapon2], WeaponInfo[playerid][Weapon2a]);
        GivePlayerWeapon(playerid, WeaponInfo[playerid][Weapon3], WeaponInfo[playerid][Weapon3a]);
        GivePlayerWeapon(playerid, WeaponInfo[playerid][Weapon4], WeaponInfo[playerid][Weapon4a]);
        GivePlayerWeapon(playerid, WeaponInfo[playerid][Weapon5], WeaponInfo[playerid][Weapon5a]);
        GivePlayerWeapon(playerid, WeaponInfo[playerid][Weapon6], WeaponInfo[playerid][Weapon6a]);
        GivePlayerWeapon(playerid, WeaponInfo[playerid][Weapon7], WeaponInfo[playerid][Weapon7a]);
        GivePlayerWeapon(playerid, WeaponInfo[playerid][Weapon8], WeaponInfo[playerid][Weapon8a]);
        GivePlayerWeapon(playerid, WeaponInfo[playerid][Weapon9], WeaponInfo[playerid][Weapon9a]);
        GivePlayerWeapon(playerid, WeaponInfo[playerid][Weapon10], WeaponInfo[playerid][Weapon10a]);
        GivePlayerWeapon(playerid, WeaponInfo[playerid][Weapon11], WeaponInfo[playerid][Weapon11a]);
        GivePlayerWeapon(playerid, WeaponInfo[playerid][Weapon12], WeaponInfo[playerid][Weapon12a]);
        SetTimerEx("save", 2000, true, "i", playerid);
        return 1;
}

forward save(playerid);
public save(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), "weapons/%s.ini", name);
    GetPlayerWeaponData(playerid, 1, WeaponInfo[playerid][Weapon1], WeaponInfo[playerid][Weapon1a]);
    GetPlayerWeaponData(playerid, 2, WeaponInfo[playerid][Weapon2], WeaponInfo[playerid][Weapon2a]);
    GetPlayerWeaponData(playerid, 3, WeaponInfo[playerid][Weapon3], WeaponInfo[playerid][Weapon3a]);
    GetPlayerWeaponData(playerid, 4, WeaponInfo[playerid][Weapon4], WeaponInfo[playerid][Weapon4a]);
    GetPlayerWeaponData(playerid, 5, WeaponInfo[playerid][Weapon5], WeaponInfo[playerid][Weapon5a]);
    GetPlayerWeaponData(playerid, 6, WeaponInfo[playerid][Weapon6], WeaponInfo[playerid][Weapon6a]);
    GetPlayerWeaponData(playerid, 7, WeaponInfo[playerid][Weapon7], WeaponInfo[playerid][Weapon7a]);
    GetPlayerWeaponData(playerid, 8, WeaponInfo[playerid][Weapon8], WeaponInfo[playerid][Weapon8a]);
    GetPlayerWeaponData(playerid, 9, WeaponInfo[playerid][Weapon9], WeaponInfo[playerid][Weapon9a]);
    GetPlayerWeaponData(playerid, 10, WeaponInfo[playerid][Weapon10], WeaponInfo[playerid][Weapon10a]);
    GetPlayerWeaponData(playerid, 11, WeaponInfo[playerid][Weapon11], WeaponInfo[playerid][Weapon11a]);
    GetPlayerWeaponData(playerid, 12, WeaponInfo[playerid][Weapon12], WeaponInfo[playerid][Weapon12a]);
    dini_IntSet(file, "Weapon1",WeaponInfo[playerid][Weapon1]);
    dini_IntSet(file, "Weapon1a",WeaponInfo[playerid][Weapon1a]);
    dini_IntSet(file, "Weapon2",WeaponInfo[playerid][Weapon2]);
    dini_IntSet(file, "Weapon2a",WeaponInfo[playerid][Weapon2a]);
    dini_IntSet(file, "Weapon3",WeaponInfo[playerid][Weapon3]);
    dini_IntSet(file, "Weapon3a",WeaponInfo[playerid][Weapon3a]);
    dini_IntSet(file, "Weapon4",WeaponInfo[playerid][Weapon4]);
    dini_IntSet(file, "Weapon4a",WeaponInfo[playerid][Weapon4a]);
    dini_IntSet(file, "Weapon5",WeaponInfo[playerid][Weapon5]);
    dini_IntSet(file, "Weapon5a",WeaponInfo[playerid][Weapon5a]);
    dini_IntSet(file, "Weapon6",WeaponInfo[playerid][Weapon6]);
    dini_IntSet(file, "Weapon6a",WeaponInfo[playerid][Weapon6a]);
    dini_IntSet(file, "Weapon7",WeaponInfo[playerid][Weapon7]);
    dini_IntSet(file, "Weapon7a",WeaponInfo[playerid][Weapon7a]);
    dini_IntSet(file, "Weapon8",WeaponInfo[playerid][Weapon8]);
    dini_IntSet(file, "Weapon8a",WeaponInfo[playerid][Weapon8a]);
    dini_IntSet(file, "Weapon9",WeaponInfo[playerid][Weapon9]);
    dini_IntSet(file, "Weapon9a",WeaponInfo[playerid][Weapon9a]);
    dini_IntSet(file, "Weapon10",WeaponInfo[playerid][Weapon10]);
    dini_IntSet(file, "Weapon10a",WeaponInfo[playerid][Weapon10a]);
    dini_IntSet(file, "Weapon11",WeaponInfo[playerid][Weapon11]);
    dini_IntSet(file, "Weapon11a",WeaponInfo[playerid][Weapon11a]);
    dini_IntSet(file, "Weapon12",WeaponInfo[playerid][Weapon12]);
    dini_IntSet(file, "Weapon12a",WeaponInfo[playerid][Weapon12a]);
    return 1;
}
Reply
#2

Fixed the saving problem. Now they wont load.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)