Roleplay Quiz won't save? Please help
#1

Hey guys, I got a Roleplay quiz system, for example: when someone logs on, they have to answer a few questions about roleplay. It works fine, and much better than I expected. But, when someone passes the test, and they re-log, they have to re-do the whole quiz again. Here is the code:

Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#define DIALOG_QUIZ 5550
#define DIALOG_QUIZ1 5551
#define DIALOG_QUIZ2 5552
#define DIALOG_QUIZ3 5553
#define DIALOG_QUIZ4 5554

new QuizAnswers[MAX_PLAYERS];

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Blank Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerConnect(playerid)
{
        SendClientMessage(playerid, -1,"You will have to pass through a quiz before playing!"); // Added -1 color as default.
        ShowPlayerDialog(playerid,DIALOG_QUIZ,DIALOG_STYLE_LIST,"What does RP stands for?"," Real Pussy \n Role Play \n Real Money","Select","Leave Game");
        QuizAnswers[playerid] = 0; // We set the player quiz answers to 0 when he connects.
        return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
	return 1;
}

public OnPlayerUpdate(playerid)
{
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_QUIZ) // If first dialog shows up
    {
        if(!response) return Kick(playerid); // If he click "Leave Game" he will be kicked.
        if(response) // If he click first button
        {
            if(listitem == 0) // If he choose first answer, wich is: Real Pussy
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                ShowPlayerDialog(playerid,DIALOG_QUIZ1,DIALOG_STYLE_LIST,"It is LOL a frequently used word in role play server?"," Yes \n No, it's a NON-RP word \n LOL I like this word!","Select","Leave Game");
                // Second question will show up
            }
            if(listitem == 1) // If he choose 2nd answers, which is: Role Play (correct one)
            {
                SendClientMessage(playerid, -1,"That's the correct answer"); // He will get a message that he answered correct
                ShowPlayerDialog(playerid,DIALOG_QUIZ1,DIALOG_STYLE_LIST,"It is LOL a frequently used word in role play server?"," Yes \n No, it's a NON-RP word \n LOL I like this word!","Select","Leave Game");
                // Second question will show up
            }
            if(listitem == 2)
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                ShowPlayerDialog(playerid,DIALOG_QUIZ1,DIALOG_STYLE_LIST,"It is LOL a frequently used word in role play server?"," Yes \n No, it's a NON-RP word \n LOL I like this word!","Select","Leave Game");
                // Second question will show up
            }
        }
    }
    if(dialogid == DIALOG_QUIZ1) // If second dialog shows up
    {
        if(!response) return Kick(playerid); // If he press second button he get kicked
        if(response) // If he press first button
        {
            if(listitem == 0) // If he choose first answer wich is: Yes
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST,"Which /me is used correct?"," /me laughs \n /me rofl \n /me wtf","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 1) // If he choose first answer wich is: No, it's a NON-RP word (correct one)
            {
                SendClientMessage(playerid, -1,"That's the correct answer"); // He will get a message that he answered correct
                ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST,"Which /me is used correct?"," /me laughs \n /me rofl \n /me wtf","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 2)
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST,"Which /me is used correct?"," /me laughs \n /me rofl \n /me wtf","Select","Leave Game");
                // Next dialog will show up
            }
        }
    }
    if(dialogid == DIALOG_QUIZ2) // If 3rd dialog shows up
    {
        if(!response) return Kick(playerid); // If he click second button he get kicked
        if(response) // If he click first button
        {
            if(listitem == 0) // If he choose first answer wich is: /me laugs (correct one)
            {
                SendClientMessage(playerid, -1,"That's the correct answer");
                ShowPlayerDialog(playerid, DIALOG_QUIZ3, DIALOG_STYLE_LIST,"What IC stands for?"," Information Centre \n In Character \n I'm Cool","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 1)
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                ShowPlayerDialog(playerid, DIALOG_QUIZ3, DIALOG_STYLE_LIST,"What IC stands for?"," Information Centre \n In Character \n I'm Cool","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 2)
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                ShowPlayerDialog(playerid, DIALOG_QUIZ3, DIALOG_STYLE_LIST,"What IC stands for?"," Information Centre \n In Character \n I'm Cool","Select","Leave Game");
                // Next dialog will show up
            }
            if(QuizAnswers[playerid] >= 3) // If he reached 3 wrong answers
            {
                SendClientMessage(playerid, -1,"Sorry mate, you answered 3 times wrong.Maybe another time");
                Kick(playerid); // He will be kicked
            }
        }
    }
    if(dialogid == DIALOG_QUIZ3) // If 4rd dialog shows up
    {
        if(!response) return Kick(playerid); // If he click second button he get kicked
        if(response) // If he click first button
        {
            if(listitem == 0) // If he choose first answer wich is: Information Centre
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                ShowPlayerDialog(playerid, DIALOG_QUIZ4, DIALOG_STYLE_LIST,"What OOC stands for?"," Out of Chat \n Out of Character \n Ow ow cool","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 1) // If he choose first answer wich is: In Character (correct one)
            {
                SendClientMessage(playerid, -1,"That's the correct answer!");
                ShowPlayerDialog(playerid, DIALOG_QUIZ4, DIALOG_STYLE_LIST,"What OOC stands for?"," Out of Chat \n Out of Character \n Ow ow cool","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 2) // If he choose first answer wich is: I'm Cool
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                ShowPlayerDialog(playerid, DIALOG_QUIZ4, DIALOG_STYLE_LIST,"What OOC stands for?"," Out of Chat \n Out of Character \n Ow ow cool","Select","Leave Game");
                // Next dialog will show up
            }
            if(QuizAnswers[playerid] >= 3) // If he reached 3 wrong answers or more
            {
                SendClientMessage(playerid, -1,"Sorry mate, you answered 3 times wrong.Maybe another time");
                Kick(playerid); // He will be kicked
            }
        }
    }
    if(dialogid == DIALOG_QUIZ4)
    {
        if(!response) return Kick(playerid); // If he click second button he get kicked
        if(response) // If he click first button
        {
            if(listitem == 0) // If he choose first answers wich is: Out of Chat
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
            }
            if(listitem == 1) // If he choose second answers wich is: Out of Character (correct one)
            {
                SendClientMessage(playerid, -1,"That's the correct answer");
            }
            if(listitem == 2) // If he choose 3rd answer wich is: Ow ow cool
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
            }
            if(QuizAnswers[playerid] >= 3) // If he reached 3 wrong answers or more
            {
                SendClientMessage(playerid, -1,"Sorry mate, you answered 3 times wrong.Maybe another time");
                Kick(playerid); // He will be kicked
            }
            else // If he didn't have at least 3 wrong answers
            {
                SendClientMessage(playerid, -1,"Congratulations, you have passed the Role Play quiz, you may now enter the game to start playing!");
            }
            SpawnPlayer(playerid);
            // After the quiz is finish,the player will be spawned, you can change here.
        }
    }
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}
All I want is you to help me, so if someone relogs, they do not have to redo the whole thing again. Thanks
Reply
#2

Make a account saving system.
Reply
#3

Quote:
Originally Posted by Goldino
Посмотреть сообщение
Hey guys, I got a Roleplay quiz system, for example: when someone logs on, they have to answer a few questions about roleplay. It works fine, and much better than I expected. But, when someone passes the test, and they re-log, they have to re-do the whole quiz again. Here is the code:

Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#define DIALOG_QUIZ 5550
#define DIALOG_QUIZ1 5551
#define DIALOG_QUIZ2 5552
#define DIALOG_QUIZ3 5553
#define DIALOG_QUIZ4 5554

new QuizAnswers[MAX_PLAYERS];

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Blank Filterscript by your name here");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	SetGameModeText("Blank Script");
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerConnect(playerid)
{
        SendClientMessage(playerid, -1,"You will have to pass through a quiz before playing!"); // Added -1 color as default.
        ShowPlayerDialog(playerid,DIALOG_QUIZ,DIALOG_STYLE_LIST,"What does RP stands for?"," Real Pussy \n Role Play \n Real Money","Select","Leave Game");
        QuizAnswers[playerid] = 0; // We set the player quiz answers to 0 when he connects.
        return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
	return 1;
}

public OnPlayerUpdate(playerid)
{
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_QUIZ) // If first dialog shows up
    {
        if(!response) return Kick(playerid); // If he click "Leave Game" he will be kicked.
        if(response) // If he click first button
        {
            if(listitem == 0) // If he choose first answer, wich is: Real Pussy
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                ShowPlayerDialog(playerid,DIALOG_QUIZ1,DIALOG_STYLE_LIST,"It is LOL a frequently used word in role play server?"," Yes \n No, it's a NON-RP word \n LOL I like this word!","Select","Leave Game");
                // Second question will show up
            }
            if(listitem == 1) // If he choose 2nd answers, which is: Role Play (correct one)
            {
                SendClientMessage(playerid, -1,"That's the correct answer"); // He will get a message that he answered correct
                ShowPlayerDialog(playerid,DIALOG_QUIZ1,DIALOG_STYLE_LIST,"It is LOL a frequently used word in role play server?"," Yes \n No, it's a NON-RP word \n LOL I like this word!","Select","Leave Game");
                // Second question will show up
            }
            if(listitem == 2)
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                ShowPlayerDialog(playerid,DIALOG_QUIZ1,DIALOG_STYLE_LIST,"It is LOL a frequently used word in role play server?"," Yes \n No, it's a NON-RP word \n LOL I like this word!","Select","Leave Game");
                // Second question will show up
            }
        }
    }
    if(dialogid == DIALOG_QUIZ1) // If second dialog shows up
    {
        if(!response) return Kick(playerid); // If he press second button he get kicked
        if(response) // If he press first button
        {
            if(listitem == 0) // If he choose first answer wich is: Yes
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST,"Which /me is used correct?"," /me laughs \n /me rofl \n /me wtf","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 1) // If he choose first answer wich is: No, it's a NON-RP word (correct one)
            {
                SendClientMessage(playerid, -1,"That's the correct answer"); // He will get a message that he answered correct
                ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST,"Which /me is used correct?"," /me laughs \n /me rofl \n /me wtf","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 2)
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST,"Which /me is used correct?"," /me laughs \n /me rofl \n /me wtf","Select","Leave Game");
                // Next dialog will show up
            }
        }
    }
    if(dialogid == DIALOG_QUIZ2) // If 3rd dialog shows up
    {
        if(!response) return Kick(playerid); // If he click second button he get kicked
        if(response) // If he click first button
        {
            if(listitem == 0) // If he choose first answer wich is: /me laugs (correct one)
            {
                SendClientMessage(playerid, -1,"That's the correct answer");
                ShowPlayerDialog(playerid, DIALOG_QUIZ3, DIALOG_STYLE_LIST,"What IC stands for?"," Information Centre \n In Character \n I'm Cool","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 1)
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                ShowPlayerDialog(playerid, DIALOG_QUIZ3, DIALOG_STYLE_LIST,"What IC stands for?"," Information Centre \n In Character \n I'm Cool","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 2)
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                ShowPlayerDialog(playerid, DIALOG_QUIZ3, DIALOG_STYLE_LIST,"What IC stands for?"," Information Centre \n In Character \n I'm Cool","Select","Leave Game");
                // Next dialog will show up
            }
            if(QuizAnswers[playerid] >= 3) // If he reached 3 wrong answers
            {
                SendClientMessage(playerid, -1,"Sorry mate, you answered 3 times wrong.Maybe another time");
                Kick(playerid); // He will be kicked
            }
        }
    }
    if(dialogid == DIALOG_QUIZ3) // If 4rd dialog shows up
    {
        if(!response) return Kick(playerid); // If he click second button he get kicked
        if(response) // If he click first button
        {
            if(listitem == 0) // If he choose first answer wich is: Information Centre
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                ShowPlayerDialog(playerid, DIALOG_QUIZ4, DIALOG_STYLE_LIST,"What OOC stands for?"," Out of Chat \n Out of Character \n Ow ow cool","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 1) // If he choose first answer wich is: In Character (correct one)
            {
                SendClientMessage(playerid, -1,"That's the correct answer!");
                ShowPlayerDialog(playerid, DIALOG_QUIZ4, DIALOG_STYLE_LIST,"What OOC stands for?"," Out of Chat \n Out of Character \n Ow ow cool","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 2) // If he choose first answer wich is: I'm Cool
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                ShowPlayerDialog(playerid, DIALOG_QUIZ4, DIALOG_STYLE_LIST,"What OOC stands for?"," Out of Chat \n Out of Character \n Ow ow cool","Select","Leave Game");
                // Next dialog will show up
            }
            if(QuizAnswers[playerid] >= 3) // If he reached 3 wrong answers or more
            {
                SendClientMessage(playerid, -1,"Sorry mate, you answered 3 times wrong.Maybe another time");
                Kick(playerid); // He will be kicked
            }
        }
    }
    if(dialogid == DIALOG_QUIZ4)
    {
        if(!response) return Kick(playerid); // If he click second button he get kicked
        if(response) // If he click first button
        {
            if(listitem == 0) // If he choose first answers wich is: Out of Chat
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
            }
            if(listitem == 1) // If he choose second answers wich is: Out of Character (correct one)
            {
                SendClientMessage(playerid, -1,"That's the correct answer");
            }
            if(listitem == 2) // If he choose 3rd answer wich is: Ow ow cool
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
            }
            if(QuizAnswers[playerid] >= 3) // If he reached 3 wrong answers or more
            {
                SendClientMessage(playerid, -1,"Sorry mate, you answered 3 times wrong.Maybe another time");
                Kick(playerid); // He will be kicked
            }
            else // If he didn't have at least 3 wrong answers
            {
                SendClientMessage(playerid, -1,"Congratulations, you have passed the Role Play quiz, you may now enter the game to start playing!");
            }
            SpawnPlayer(playerid);
            // After the quiz is finish,the player will be spawned, you can change here.
        }
    }
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}
All I want is you to help me, so if someone relogs, they do not have to redo the whole thing again. Thanks
It`s very easy why you have to do the quiz again because you have to save a
value and you need a accountsystem or you can save it temporary but i don't think that you want that an other player logged in with the id of an player who finish this quiz then don't have to do that quiz

PHP код:
        if(QuizAnswers[playerid] >= 4){
            
SendClientMessage(playerid, -1,"You will have to pass through a quiz before playing!"); // Added -1 color as default.
            
ShowPlayerDialog(playerid,DIALOG_QUIZ,DIALOG_STYLE_LIST,"What does RP stands for?"," Real Pussy \n Role Play \n Real Money","Select","Leave Game");
            
QuizAnswers[playerid] =0;
        } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)