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


Messages In This Thread
YSI - Creating files, but not writing to them? - by Hawkseye - 29.04.2012, 18:31
Re: YSI - Creating files, but not writing to them? - by kikito - 29.04.2012, 18:33
Re: YSI - Creating files, but not writing to them? - by Hawkseye - 29.04.2012, 18:36
Re: YSI - Creating files, but not writing to them? - by Georgi166 - 29.04.2012, 18:41
Re: YSI - Creating files, but not writing to them? - by Hawkseye - 29.04.2012, 18:55

Forum Jump:


Users browsing this thread: 1 Guest(s)