RPQuiz setting back to 0 (y_ini)
#1

well today i'm making my GM with y_ini the problem
is when i left the RPQuiz reset to 0 idk why it should be set to 1 after the
DIALOG_QUIZ4, pawn codes

pawn Код:
#define PAYFREE         1000
#define DIALOG_REGISTER 411
#define DIALOG_LOGIN    412
#define DIALOG_QUIZ     413
#define DIALOG_QUIZ1    414
#define DIALOG_QUIZ2    415
#define DIALOG_QUIZ3    416
#define DIALOG_QUIZ4    417

public OnPlayerDisconnect(playerid, reason)
{
    new string[120],INI:iFile = INI_Open(PlayerPath(playerid));
    switch(reason)
    {
        case 0: format(string, sizeof(string), "%s has left LS Reality RP (Timeout/Crash)", GetName(playerid));
        case 1: format(string, sizeof(string), "%s has left LS Reality RP (Leave)", GetName(playerid));
        case 2: format(string, sizeof(string), "%s has left LS Reality RP (Kick/Ban)", GetName(playerid));
    }
    SendClientMessageToAll(COLOR_WHITE, string);
    if(pInfo[playerid][Log] == 1)
    {
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"Cash",GetPlayerMoney(playerid));
        INI_WriteInt(iFile,"Score",GetPlayerScore(playerid));
        INI_WriteInt(iFile, "RPQuiz", pInfo[playerid][RPQuiz]);
        INI_Close(iFile);
    }
    pInfo[playerid][Log] = 0;
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new string[128];
    new INI:iFile = INI_Open(PlayerPath(playerid));

    if(dialogid == DIALOG_REGISTER)
    {
        if(!response) Kick(playerid);
        if(!strlen(inputtext))
        {
            format(string, sizeof(string), "%s, Welcome to LS Reality RP\n"red"Please register by putting your new password for you account", GetName(playerid));
            ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD, ""red"LSRRP - Register", string ,"Register","Leave");
            return 1;
        }
        GivePlayerMoney(playerid, PAYFREE);
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"Pass",udb_hash(inputtext));
        INI_WriteInt(iFile,"Cash", PAYFREE);
        INI_WriteInt(iFile,"Score", 0);
        INI_WriteInt(iFile,"RPQuiz", 0);
        INI_Close(iFile);
        pInfo[playerid][Log] = 1;
        format(string,sizeof(string),"You've successfully registered with the password \"%s\".",inputtext);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        return 1;
    }
    if(dialogid == DIALOG_LOGIN)
    {
        if(!response) Kick(playerid);
        if(!strlen(inputtext))
        {
            SendClientMessage(playerid, COLOR_RED, "Please enter your password!");
            format(string, sizeof(string), "%s, Welcome back to LS Reality RP\n"yellow"Please enter your password below", GetName(playerid));
            ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD, "LSRRP - Login", string, "Login","Leave");
            return 1;
        }
        if(udb_hash(inputtext) == pInfo[playerid][Pass])
        {
            pInfo[playerid][Log] = 1;
            SendClientMessage(playerid,COLOR_YELLOW,"You've successfully logged in.");
        } else {
            SendClientMessage(playerid, COLOR_RED, "Incorrect or Wrong Password!");
            format(string, sizeof(string), "%s, Welcome back to LS Reality RP\n"yellow"Please enter your password below", GetName(playerid));
            ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD, "LSRRP - Login", string, "Login","Leave");
            return 1;
        }
    }
    if(dialogid == DIALOG_QUIZ)
    {
        if(!response)
        {
             INI_WriteInt(iFile, "RPQuiz", pInfo[playerid][RPQuiz] = 0);
             Kick(playerid);
             return 0;
        }
        if(response)
        {
            if(listitem == 0)
            {
                SendClientMessage(playerid, COLOR_RED, "Wrong answer!");
                SendClientMessage(playerid, COLOR_RED, "You have been kick from LS Reality Roleplay!");
                Kick(playerid);
                return 1;
            }
            if(listitem == 1)
            {
                SendClientMessage(playerid, COLOR_GREEN, "The correct answer is Roleplay, your answer is correct, next...");
                pInfo[playerid][QuizAnswers] += 1;
                ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST, "What are you doing in RP?", "Stunt\nDeathmatch\nActing like in real-life\nFreeroam\nDrift", "Select", "Leave");
                return 1;
            }
            if(listitem == 2)
            {
                SendClientMessage(playerid, COLOR_RED, "Wrong answer!");
                SendClientMessage(playerid, COLOR_RED, "You have been kick from LS Reality Roleplay!");
                Kick(playerid);
                return 1;
            }
            if(listitem == 3)
            {
                SendClientMessage(playerid, COLOR_RED, "Wrong answer!");
                SendClientMessage(playerid, COLOR_RED, "You have been kick from LS Reality Roleplay!");
                Kick(playerid);
                return 1;
            }
        }
    }
    if(dialogid == DIALOG_QUIZ2)
    {
        if(!response)
        {
             INI_WriteInt(iFile, "RPQuiz", pInfo[playerid][RPQuiz] = 0);
             Kick(playerid);
             return 0;
        }
        if(response)
        {
            if(listitem == 0)
            {
                SendClientMessage(playerid, COLOR_RED, "Wrong answer!");
                SendClientMessage(playerid, COLOR_RED, "You have been kick from LS Reality Roleplay!");
                Kick(playerid);
                return 1;
            }
            if(listitem == 1)
            {
                SendClientMessage(playerid, COLOR_RED, "Wrong answer!");
                SendClientMessage(playerid, COLOR_RED, "You have been kick from LS Reality Roleplay!");
                Kick(playerid);
                return 1;
            }
            if(listitem == 2)
            {
                SendClientMessage(playerid, COLOR_GREEN, "The correct answer is Acting in real-life, your answer is correct, next");
                ShowPlayerDialog(playerid, DIALOG_QUIZ3, DIALOG_STYLE_LIST, "What is the correct usage for /me?", "/me Hahaha gotcha\n* Reklez I'm good at running\n* Reklez is eating Donuts\n* Reklez nvm guys", "Select", "Leave");
                pInfo[playerid][QuizAnswers] += 1;
                return 1;
            }
            if(listitem == 3)
            {
                SendClientMessage(playerid, COLOR_RED, "Wrong answer!");
                SendClientMessage(playerid, COLOR_RED, "You have been kick from LS Reality Roleplay!");
                Kick(playerid);
                return 1;
            }
            if(listitem == 4)
            {
                SendClientMessage(playerid, COLOR_RED, "Wrong answer!");
                SendClientMessage(playerid, COLOR_RED, "You have been kick from LS Reality Roleplay!");
                Kick(playerid);
                return 1;
            }
        }
    }
    if(dialogid == DIALOG_QUIZ3)
    {
        if(!response)
        {
             INI_WriteInt(iFile, "RPQuiz", pInfo[playerid][RPQuiz] = 0);
             Kick(playerid);
             return 0;
        }
        if(response)
        {
            if(listitem == 0)
            {
                SendClientMessage(playerid, COLOR_RED, "Wrong answer!");
                SendClientMessage(playerid, COLOR_RED, "You have been kick from LS Reality Roleplay!");
                Kick(playerid);
                return 1;
            }
            if(listitem == 1)
            {
                SendClientMessage(playerid, COLOR_RED, "Wrong answer!");
                SendClientMessage(playerid, COLOR_RED, "You have been kick from LS Reality Roleplay!");
                Kick(playerid);
                return 1;
            }
            if(listitem == 2)
            {
                SendClientMessage(playerid, COLOR_GREEN, "The correct answer is /me is eating Donuts, your answer is correct, next...");
                ShowPlayerDialog(playerid, DIALOG_QUIZ4, DIALOG_STYLE_LIST, "Is RP just like Stunt?", "Yes\nNo", "Select", "Leave");
                pInfo[playerid][QuizAnswers] += 1;
                return 1;
            }
            if(listitem == 3)
            {
                SendClientMessage(playerid, COLOR_RED, "Wrong answer!");
                SendClientMessage(playerid, COLOR_RED, "You have been kick from LS Reality Roleplay!");
                Kick(playerid);
                return 1;
            }
        }
    }
    if(dialogid == DIALOG_QUIZ4)
    {
        if(!response)
        {
             INI_WriteInt(iFile, "RPQuiz", pInfo[playerid][RPQuiz] = 0);
             Kick(playerid);
             return 0;
        }
        if(response)
        {
            if(listitem == 0)
            {
                SendClientMessage(playerid, COLOR_RED, "Wrong answer!");
                SendClientMessage(playerid, COLOR_RED, "You have been kick from LS Reality Roleplay!");
                Kick(playerid);
                return 1;
            }
            if(listitem == 1)
            {
                pInfo[playerid][RPQuiz] = 1;
                SendClientMessage(playerid, COLOR_GREEN, "The correct answer is No, your answer is correct!, Now, you will process to Age Asking...");
                INI_WriteInt(iFile, "RPQuiz", pInfo[playerid][RPQuiz]);
                return 1;
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
RPQuiz setting back to 0 (y_ini) - by Reklez - 18.03.2012, 11:28

Forum Jump:


Users browsing this thread: 1 Guest(s)