26.01.2016, 07:44
HELP ME ... Please, How do I make RP Quiz finish and show dialog register
Define RP Quiz
Код:
if(dialogid == REG_DIALOG) {
if(RegistrationStep[playerid] == 1) {
if(response) {
PlayerInfo[playerid][pSex] = 1;
format(string, sizeof(string), "Alright %s, so you're a male.\n\nWhat is your date of birth ? (dd/mm/yyyy)", GetPlayerNameEx(playerid));
RegistrationStep[playerid] = 2;
}
else {
PlayerInfo[playerid][pSex] = 2;
format(string, sizeof(string), "Alright %s, so you're a female.\n\nWhat is your date of birth ? (dd/mm/yyyy)", GetPlayerNameEx(playerid));
RegistrationStep[playerid] = 2;
}
ShowPlayerDialog(playerid, REG_DIALOG, DIALOG_STYLE_INPUT, "Registration Process", string, "OK", "BACK");
}
else if (RegistrationStep[playerid] == 2 && GetPVarInt(playerid, "RegSuccess") != 1) {
if(response) {
new sgender[10];
if(PlayerInfo[playerid][pSex] == 1) {
format(string, sizeof(string), "Alright %s, so you're a male.\n\nWhat is your date of birth ? (dd/mm/yyyy)", GetPlayerNameEx(playerid));
format(sgender, sizeof(sgender), "Male");
}
else {
format(string, sizeof(string), "Alright %s, so you're a female.\n\nWhat is your date of birth ? (dd/mm/yyyy)", GetPlayerNameEx(playerid));
format(sgender, sizeof(sgender), "Female");
}
if(IsNull(inputtext)) return ShowPlayerDialog(playerid, REG_DIALOG, DIALOG_STYLE_INPUT, "Registration Process", string, "OK","BACK");
new year, month,day;
getdate(year, month, day);
new DateInfo[3][20];
splits(inputtext, DateInfo, '/');
if(year - strval(DateInfo[2]) > 100 || strval(DateInfo[2]) < 1 || strval(DateInfo[2]) >= year)
{
ShowPlayerDialog(playerid, REG_DIALOG, DIALOG_STYLE_INPUT, "Registration Process", string, "OK","BACK");
return 1;
}
new check = year - strval(DateInfo[2]);
if(check == year)
{
ShowPlayerDialog(playerid, REG_DIALOG, DIALOG_STYLE_INPUT, "Registration Process", string, "OK","BACK");
return 1;
}
if(strval(DateInfo[1]) > month)
{
check -= 1;
}
else if(strval(DateInfo[1]) == month && strval(DateInfo[0]) > day)
{
check -= 1;
}
PlayerInfo[playerid][pAge] = check;
PlayerInfo[playerid][pOrigin] = 0;
SetPVarInt(playerid, "RegSuccess", 1);
format(string, sizeof(string), "Name\r: %s\nGender\r: %s\nDate of birth\r: %s\nAge\r: %d", GetPlayerNameEx(playerid), sgender, inputtext, check);
ShowPlayerDialog(playerid, REG_DIALOG, DIALOG_STYLE_MSGBOX, "Registration Complete", string, "OK","");
}
else {
RegistrationStep[playerid] = 1;
ShowPlayerDialog(playerid, REG_DIALOG, DIALOG_STYLE_MSGBOX, "Registration Process", "Please choose are you a Male or Female?","Male","Female");
}
}
else if (RegistrationStep[playerid] == 2 && GetPVarInt(playerid, "RegSuccess") == 1) {
if(response) {
RegistrationStep[playerid] = 0;
SetPlayerVirtualWorld(playerid, 0);
ClearChatbox(playerid);
TutStep[playerid] = 1;
PlayerInfo[playerid][pTut] = 0;
if(PlayerInfo[playerid][pSex] == 1)
{
PlayerInfo[playerid][pModel] = MaleSkin[random(sizeof(MaleSkin))];
}
else if(PlayerInfo[playerid][pSex] == 2)
{
PlayerInfo[playerid][pModel] = FemaleSkin[random(sizeof(FemaleSkin))];
}
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
gOoc[playerid] = 0; gNews[playerid] = 0; gFam[playerid] = 0;
TogglePlayerControllable(playerid, 1);
SetCamBack(playerid);
DeletePVar(playerid, "MedicBill");
SetPlayerColor(playerid,TEAM_HIT_COLOR);
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid, 614.213439, 1330.374145, -51.917060);//first spawn
SetPlayerFacingAngle(playerid, 270.62);
SetCameraBehindPlayer(playerid);
SetPlayerVirtualWorld(playerid, 0);
GameTextForPlayer(playerid, "IG:R - Objects Loading ... ", 4000, 5);
SetPVarInt(playerid, "LoadingObjects", 1);
SetTimerEx("SafeLoadObjects", 4000, 0, "d", playerid);
}
}
}
Код:
#define DIALOG_QUIZ 5550 #define DIALOG_QUIZ1 5551
Код:
new QuizAnswers[MAX_PLAYERS];
Код:
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid, -1,"You will have to pass through a quiz"); // 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;
}
Код:
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(!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 RP quiz!");
}
SpawnPlayer(playerid);
// After the quiz is finish,the player will be spawned, you can change here.
}
}

