SA-MP Forums Archive
Need help with properly saving using SII - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need help with properly saving using SII (/showthread.php?tid=292170)



Need help with properly saving using SII - knackworst - 22.10.2011

Hi I need some help saving some stuff using SII (I'll understand using dini too, but I prefer SII)
ok so I made a little servershop system where the player buys items that they can use for advantages in my server...
everything has been wel-made and it works very good too...
only the saving leads me in some torubles...
ok look:
pawn Код:
//==============================================================================
//Shops
//==============================================================================
enum Shops
{
    shop_name[500],
    shop_costmoney,
    shop_costscore,
    shop_reward[500],
    shop_unlocked[MAX_PLAYERS]
}

new ServerShop[9][Shops]=
{
    {"No more speeding control",    150000, 10 ,    "you cannot be caught by speedtraps no more!",   0},
    {"Save Deathpos",   500000, 50 ,    "and you will be auto spawned to your death pos when you die!", 0},
    {"10 Score",    25000,  0 , "You have gained 10 score points",  0},
    {"50 Score",    100000, 0, "You have gained 50 score points",  0},
    {"100 Score",   1750000,    0 , "You have gained 100 score points", 0},
    {"Free Weather",   10000,    5 , "and u can now use /fweather to chose ur weather!", 0},
    {"Free Driver Mission selection",   700000,    5 , "and u can now Choose wich driver mission you want to play!", 0},
    {"Auto Armour", 50000,  7 , "and u can now use the command: /auto armour once every 10 minuts",   0},
    {"Auto Health", 750000, 12 ,    "and u can now use the command: /autp health once every 10 minuts",   0}//removed the ',' here too
};
that's the array and the enum, with all the items
as you can see the last thing of the enum is with a playerid array.
that should check if the player has unlocked the achievemnt, for example:
pawn Код:
if(ServerShop[6][shop_unlocked][playerid] == 0)
        {
            if(StartMissionBox[playerid] == false)
            {
                ShowPlayerDialog(playerid, 3270, DIALOG_STYLE_MSGBOX, "Driving Mission", "You are about to start a drivers mission\nClick on 'start' to proceed\n\nSee /help for furture help...", "Start", "Cancle");
                TogglePlayerControllable(playerid, 0);
            }
        }
        else if(ServerShop[6][shop_unlocked][playerid] == 1)
        {
            ShowPlayerDialog(playerid, 3280, DIALOG_STYLE_LIST,"{FFFF00}Choose type", "Random Mission\nSelf Chosen Mission", "Select", "Cancel");
            TogglePlayerControllable(playerid, 0);
        }
this code works perfectly too and and is just an example of how I use this shop_unlocked[playerid] thing...
now I need that when a player disconnects the for the player unlocked shop items get saved into this directory:
Код:
format(file,sizeof(file),"LuxKnack/TeamStats/%s.ini",name);
    INI_Open(file);
and when the player connect, It should load the unlocked shop items for the player...
can anyone help me please?
thanks in advance
Reputation for the helper