YSI - Creating files, but not writing to them?
#1

Right then, so during the past couple hours I've been trying to figure this thing out - It writes a new .ini file as it should in the correct specified location and names it according to 'stock user_account_path(playerid)'. Everything compiles nicely. I log on, 'register' and quit. I then return to '*/ScriptFiles/Accounts' to find the .ini file created, but completely blank? I've been over this with a few others and no one has been able to figure out why it isn't writing anything, such as the field names or even the variables.

On a side note, I've heard on multiple accounts that the base file system included with sa-mp is faster/a better choice in comparison with YSI, likewise I've heard YSI was the better choice over any of the other available .ini file writers. What's your opinion on the matter?

pawn Код:
#include <a_samp>
#include <sscanf2>
#include <foreach>
#include <YSI\y_ini>
#include <zcmd>
#define DIALOG_REGISTER 2

native WP_Hash(_buffer[], len, const str[]);
stock user_account_path(playerid)
{
    new string_path[128],player_name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,player_name,MAX_PLAYER_NAME);
    format(string_path,sizeof(string_path),"Accounts/%s.ini", player_name);
    return string_path;
}
// None of the above is located within a callback.
// ---------------------------------------------
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_REGISTER:
        {
            if(!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Welcome. Please log-in","You have entered an invalid password\nType your password here to log-in", #Register, #Quit);
                new hashed[129];
                WP_Hash(hashed,sizeof(hashed),inputtext);
                new INI:File = INI_Open(user_account_path(playerid));
                INI_SetTag(File,"statistics");
                INI_WriteString(File,"pPass", hashed);
                INI_WriteInt(File,"pCash",0);
                INI_WriteInt(File,"pAdmin",0);
                INI_WriteInt(File,"pHelper",0);
                INI_Close(File);
                return 1;
            }
        }
// The Login system takes it from here in a case statement.
Reply
#2

Don't you need to create first the file, and later open it?
Reply
#3

Well, yes. But creating the file isn't a problem. It's creating it here.
pawn Код:
new INI:File = INI_Open(user_account_path(playerid));
I haven't a clue how that works as I'm only following a tutorial, but it does.
Reply
#4

Maybe your files are messed up, try downloading YSI again.
Reply
#5

Removed the pre-existing .ini user file and re-downloaded YSI, but still coming up with a blank .ini file.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)