Y_INI can't create file?
#1

pawn Code:
case DIALOG_READY:
        {
            if(response)
            {
                new string[128];
                format(string, sizeof(string), "Question 1: Gender\nAre you a Male or Female?\nPlease type the whether you are a Male or Female, BE HONEST!");
                ShowPlayerDialog(playerid, DIALOG_GENDER, DIALOG_STYLE_INPUT,""COL_WHITE"Welcome!",string,"Next","Cancel");
            }
           
        }
        case DIALOG_GENDER:
        {
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                if(strlen(inputtext))
                {
                    new INI:File = INI_Open(UserPath1(playerid));
                    INI_SetTag(File,"adminapp");
                    INI_WriteInt(File,"Gender",strlen(inputtext));
                    new string[128];
                    format(string, sizeof(string), "Okay so you are a %s\nQuestion 2: What is your current age?",inputtext);
                    ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT,""COL_WHITE"Welcome!",string,"Next","Cancel");
                }
            }

        }
        case DIALOG_AGE:
        {
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                if(strlen(inputtext))
                {
                    new INI:File = INI_Open(UserPath1(playerid));
                    INI_WriteInt(File,"Age",strlen(inputtext));
                    new string[128];
                    format(string, sizeof(string), "Okay so you are %s years old.\nQuestion 3: What is the current country you are living in?\nPlease type the current country you are living in: Ex: United States, Mexico, Spain, England etc..",inputtext);
                    ShowPlayerDialog(playerid, DIALOG_COUNTRY, DIALOG_STYLE_INPUT,""COL_WHITE"Welcome!",string,"Next","Cancel");
                }
            }
        }
        case DIALOG_COUNTRY:
        {
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                if(strlen(inputtext))
                {
                    new INI:File = INI_Open(UserPath1(playerid));
                    INI_WriteInt(File,"Country",strlen(inputtext));
                    new string[128];
                    format(string, sizeof(string), "Okay so you currently reside in %s.\nQuestion 3: Why do you want to become part of our admin team?\nWith a given reason, please type why you want to become part of our admin team",inputtext);
                    ShowPlayerDialog(playerid, DIALOG_REASON, DIALOG_STYLE_INPUT,""COL_WHITE"Welcome!",string,"Next","Cancel");
                }
            }
        }
        case DIALOG_REASON:
        {
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                if(strlen(inputtext))
                {
                    new INI:File = INI_Open(UserPath1(playerid));
                    INI_WriteInt(File,"Reason",strlen(inputtext));
                    INI_Close(File);
                    new string[128];
                    format(string, sizeof(string), "Thank you for using our ingame admin application");
                    format(string, sizeof(string), "You will recieve a reply within 24-48 hours, YOU MUST WAIT PATIENTLY");
                    ShowPlayerDialog(playerid, DIALOG_DONE, DIALOG_STYLE_MSGBOX,""COL_WHITE"Welcome!",string,"Next","Cancel");
                }
            }
        }
pawn Code:
stock UserPath1(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH1,playername);
    return string;
}
pawn Code:
#define PATH1 "/Applications/%s.ini"
pawn Code:
YCMD:adminapp(playerid, params[], help)
{
    #pragma unused help
    #pragma unused params
    if(fexist(UserPath1(playerid)))
    {
        SendClientMessage(playerid, -1, "ERROR: Your application already exists, Please be patient!");
    }
    else return ready(playerid);
    return 1;
}
Reply
#2

I actually don't need it to be loaded, I just want it created, then, saved after the questionare is done.
Reply
#3

Firstly, why don't you post back in my thread where you got this from?

Secondly, why are you renaming stuff which was originally there. 'UserPath1'. What difference does it make really? When you rename your stuff and you receive errors, you guys come back here confused.

Thirdly, why do you keep opening the player's file? Like, your constantly opening it and it's having no effect because you haven't really told it what to write.

There are easier ways in writing stuff like this, such as saving them in a variable.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)