new OnQuiz[MAX_PLAYERS], QuizSection[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
QuizSection[playerid] = -1;
OnQuiz[playerid] = -1;
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid, WHITE, "What do Roleplaying means?");
SendClientMessage(playerid, WHITE, "A. To Roll around");
SendClientMessage(playerid, WHITE, "B. To take a role of a Object");
SendClientMessage(playerid, WHITE, "C. To Take a role of a Player ");//This sends the first quiz message
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
//You will want to add the following:
OnQuiz[playerid] = 0;
QuizSection[playerid] = 0;
return 1;
}
//Test Questions
public OnPlayerText(playerid, text[])
{
if(OnQuiz[playerid] == 1) //This is checking if the player is on the quiz.
{
if(QuizSection[playerid] == 1) //This is checking if the player is on part 1.
{
if(!strcmp(text, "a", true)) //This is checking if the player typed A.
{
SendClientMessage(playerid, WHITE, " ");
SendClientMessage(playerid, WHITE, "Correct! Next Question:");
QuizSection[playerid] = 2; //This is setting the player to be on part 2.
SendClientMessage(playerid, WHITE, "What is the creator of SA-MP's name?");
SendClientMessage(playerid, WHITE, "A. Kalcor");
SendClientMessage(playerid, WHITE, "B. Dugi");
SendClientMessage(playerid, WHITE, "C. JaTochNietDan");
return 0;
}
else if(!strcmp(text, "b", true)) //This is checking the player typed B
{
SendClientMessage(playerid, WHITE, " ");
SendClientMessage(playerid, WHITE, "Wrong! You were kicked because you got it wrong.");
Kick(playerid);
return 0;
}
else if(!strcmp(text, "c", true)) //This is checking the player typed C
{
SendClientMessage(playerid, WHITE, " ");
SendClientMessage(playerid, WHITE, "Wrong! You were kicked because you got it wrong.");
Kick(playerid);
return 0;
}
else
{
SendClientMessage(playerid, WHITE, "Error: You can only use A, B or C."); //This is checking the player typed A B or C else it sends this
return 0;
}
}
if(QuizSection[playerid] == 2) //This is checking if the player is on section 2.
{
if(!strcmp(text, "a", true)) //This is checking the player typed A
{
SendClientMessage(playerid, WHITE, " ");
SendClientMessage(playerid, WHITE, "Correct! Next:");
QuizSection[playerid] = 3;
SendClientMessage(playerid, WHITE, "What is a Bullet?");
SendClientMessage(playerid, WHITE, "A. Car");
SendClientMessage(playerid, WHITE, "B. Truck");
SendClientMessage(playerid, WHITE, "C. Weapon");
return 0;
}
else if(!strcmp(text, "b", true)) //This is checking the player typed B
{
SendClientMessage(playerid, WHITE, " ");
SendClientMessage(playerid, WHITE, "Wrong! You were kicked because you got it wrong.");
Kick(playerid);
return 0;
}
else if(!strcmp(text, "c", true)) //This is checking the player typed C
{
SendClientMessage(playerid, WHITE, " ");
SendClientMessage(playerid, WHITE, "Wrong! You were kicked because you got it wrong.");
Kick(playerid);
return 0;
}
else
{
SendClientMessage(playerid, WHITE, " ");
SendClientMessage(playerid, WHITE, "Error: You can only use A, B or C."); //This is checking the player typed A B or C, else sends this message.
return 0;
}
}
if(QuizSection[playerid] == 3) //This is checking if the player is on section 3.
{
if(!strcmp(text, "a", true)) //This is checking the player typed A
{
SendClientMessage(playerid, WHITE, " ");
SendClientMessage(playerid, WHITE, "Correct! You can spawn!");
QuizSection[playerid] = 0;
OnQuiz[playerid] = 0;
TogglePlayerSpectating(playerid, false);//This is telling the script that the player isn't spectating anymore,
SetSpawnInfo(playerid, 0, 1, 123.4, 123.4, 123.4, 123.54, 0, 0, 0, 0, 0, 0); //This sets the players position, team and weapons.
SpawnPlayer(playerid); //This spawns the player
return 0;
}
else if(!strcmp(text, "b", true)) //This is checking the player typed B
{
SendClientMessage(playerid, WHITE, " ");
SendClientMessage(playerid, WHITE, "Wrong! You were kicked because you got it wrong.");
Kick(playerid);
return 0;
}
else if(!strcmp(text, "c", true)) //This is checking the player typed C
{
SendClientMessage(playerid, WHITE, " ");
SendClientMessage(playerid, WHITE, "Wrong! You were kicked because you got it wrong.");
Kick(playerid);
return 0;
}
else
{
SendClientMessage(playerid, WHITE, " ");
SendClientMessage(playerid, WHITE, "Error: You can only use A, B or C."); //This is checking the player typed A B or C, else sends this message.
return 0;
}
}
}
return 1;
}
|