10.08.2012, 21:04
Okay my problem is if I run it in another FS it shows me quiz every time i want only Unregisterd users see it help me please how can I compile both were to put which think if I need to add something
This is my quiz system
pawn Код:
public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid)) return 1;
SetPlayerCameraPos(playerid, -2828.9058,-397.5271,7.1875);
SetPlayerCameraLookAt(playerid, -2828.9058,-397.5271,7.1875);
gPlayerLoggedIn[playerid] = 0;
PlayerSpectating[playerid] = 0;
gLastCar[playerid] = 0;
KnowsIt[playerid] = 0;
BigEar[playerid] = 0;
if(fexist(UserPath(playerid)))
{
SendClientMessage(playerid, COLOR_YELLOW, "SERVER: Welcome College Of SuperNatural Roleplay,Enjoy your stay.");
SendClientMessage(playerid, COLOR_YELLOW, "SERVER: For help use /help or /ask.");
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowDialog(playerid, 2, DIALOG_PASS, "Welcome back to College Of Supernatural", "That username is registered,\nInput your password to login and continue!", "Login", "Exit");
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: Welcome to College Of Supernatural Roleplay, please register!");
ShowDialog(playerid, 1, DIALOG_PASS, "Hi there, Welcome to College of Supernatural.", "Hello new citizen!\n\nWelcome to College Of SuperNatural roleplay.\nPlease register.", "Register", "Exit");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch (dialogid)
{
case 1: // Register
{
if(!response) {
SendClientMessage(playerid, COLOR_WHITE," Thanks for coming...");
Kick(playerid);
}
else if(response) {
if(!strlen(inputtext)) return ShowDialog(playerid, 1, DIALOG_PASS, "Hi there, Welcome to College ", "Hello new citizen!\n\nWelcome to Supernatural College.\nPlease register.", "Register", "Exit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File, "Password",udb_hash(inputtext));
INI_WriteInt(File, "Admin", 0);
INI_WriteInt(File, "Origin", 0);
INI_WriteInt(File, "Gender", 0);
INI_WriteInt(File, "Age", 0);
INI_WriteFloat(File, "sPosX", 194.485778);
INI_WriteFloat(File, "sPosY", 1103.993408);
INI_WriteFloat(File, "sPosZ", 16.347635);
INI_WriteFloat(File, "sPosA", 30.403614);
INI_WriteFloat(File, "sHealth", 100);
INI_WriteFloat(File, "sArmor", 0);
INI_WriteInt(File, "Money", 2000);
INI_WriteInt(File, "BankBalance", 20000);
INI_WriteInt(File, "BankPin", 0);
INI_WriteInt(File, "Cellphone", 0);
INI_WriteInt(File, "HouseID", 0);
INI_WriteInt(File, "CarID", 0);
INI_WriteInt(File, "Gun1", 0);
INI_WriteInt(File, "Gun2", 0);
INI_WriteInt(File, "Gun3", 0);
INI_WriteInt(File, "Gun4", 0);
INI_WriteInt(File, "Gun5", 0);
INI_WriteInt(File, "Gun6", 0);
INI_WriteInt(File, "Gun7", 0);
INI_WriteInt(File, "Gun8", 0);
INI_WriteInt(File, "Gun9", 0);
INI_WriteInt(File, "Gun10", 0);
INI_WriteInt(File, "Gun11", 0);
INI_WriteInt(File, "Gun12", 0);
INI_WriteInt(File, "Gun13", 0);
INI_WriteInt(File, "WTChannel", 0);
INI_WriteInt(File, "Faction", 0);
INI_WriteInt(File, "FLeader", 0);
INI_WriteInt(File, "Job", 0);
INI_WriteInt(File, "sInterior", 0);
INI_WriteInt(File, "sVW", 0);
INI_WriteInt(File, "Skin", 1);
INI_WriteInt(File, "Muted", 0);
INI_WriteInt(File, "nMute", 0);
INI_WriteInt(File, "Helper", 0);
INI_WriteInt(File, "Developer", 0);
INI_WriteInt(File, "Wolf",0);
INI_WriteInt(File, "SFCS",0);
INI_WriteInt(File, "SFCMS",0);
INI_WriteInt(File, "Staff",0);
INI_WriteInt(File, "RentingID", 0);
INI_Close(File);
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][Money]);
ClearScreen(playerid);
SendClientMessage(playerid, COLOR_WHITE, "Principal: Thank you for registering in our College.");
SendClientMessage(playerid, COLOR_WHITE, "We now require you to fill out some basic identification!");
SetPlayerCameraPos(playerid, -2828.9058,-397.5271,7.1875);
SetPlayerCameraLookAt(playerid, -2828.9058,-397.5271,7.1875);
SetPlayerVirtualWorld(playerid, 0);
ShowDialog(playerid, 3, DIALOG_INFO, "College Identification", "Are you a male or female?", "Male", "Female");
}
return 1;
}
case 2: //Login
{
if(!response) {
SendClientMessage(playerid, COLOR_LIGHTRED, " Come back soon...");
Kick(playerid);
}
if(response) {
if(udb_hash(inputtext) == PlayerInfo[playerid][Password])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
SetPlayerHealth(playerid, PlayerInfo[playerid][sHealth]);
SetPlayerArmour(playerid, PlayerInfo[playerid][sArmor]);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][Money]);
ClearScreen(playerid);
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You've logged into College Of Supernatural Roleplay.");
SetSpawnInfo(playerid, 0, 0,-2828.9058,-397.5271,7.1875,357.3467, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
else {
SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: Incorrect password. Kicked, please try again!");
Kick(playerid);
}
}
return 1;
}
case 3: // Gender
{
if(response) {
PlayerInfo[playerid][Gender] = 1; // Male
ShowDialog(playerid, 4, DIALOG_INPUT, "College Identification", "You identified yourself as a Male.\n\nNow how old are you?", "Enter", "");
PlayerInfo[playerid][Skin] = 1;
SetSpawnInfo(playerid, 0, 1, -2828.9058,-397.5271,7.1875,357.3467, 0, 0, 0, 0, 0, 0);
}
else {
PlayerInfo[playerid][Gender] = 2; // Female
ShowDialog(playerid, 4, DIALOG_INPUT, "College Identification", "You identified yourself as a Female.\n\nNow how old are you?", "Enter", "");
PlayerInfo[playerid][Skin] = 12;
SetSpawnInfo(playerid, 0, 12, -2828.9058,-397.5271,7.1875,357.3467, 0, 0, 0, 0, 0, 0);
}
}
case 4: // Age
{
new age = strval(inputtext);
if(!strlen(inputtext)) return ShowDialog(playerid, 4, DIALOG_INPUT, "College Identification", "Please tell us how old you are!", "Enter", "");
//if(!IsNumeric(age)) return ShowDialog(playerid, 4, DIALOG_INPUT, "Fort Carson Identification", "Please tell us how old you are!", "Enter", "");
if(age < 13 || age > 99) return ShowDialog(playerid, 4, DIALOG_INPUT, "College Identification", "Please enter a realistic age (14-21)", "Enter", "");
PlayerInfo[playerid][Age] = age;
ShowDialog(playerid, 5, DIALOG_LIST, "College Identification - Where are you from?", "America\nEurope\nAustralia\nAfrica\nRussia", "Okay", "");
}
case 5: // Origin
{
if(response)
{
switch(listitem)
{
case 0: //America
{
PlayerInfo[playerid][Origin] = 1;
}
case 1: //Europe
{
PlayerInfo[playerid][Origin] = 2;
}
case 2: //Australia
{
PlayerInfo[playerid][Origin] = 3;
}
case 3: //Africa
{
PlayerInfo[playerid][Origin] = 4;
}
case 4: //Russia
{
PlayerInfo[playerid][Origin] = 5;
}
}
ShowDialog(playerid, 6, DIALOG_INFO, "College Identifcation", "Thank you for identifying yourself.\n\nIf you require help, please use /help or /ask.\nIf you do not Roleplay, we will punish you.\n\nVisit our forums, cosrp.co.cc", "Okay", "");
gPlayerLoggedIn[playerid] = 1;
SpawnPlayer(playerid);
}
else
{
ShowDialog(playerid, 5, DIALOG_LIST, "College Identification - Where are you from?", "America\nEurope\nAustralia\nAfrica\nRussia", "Okay", "");
}
}
}
return 1;
}
This is my quiz system
pawn Код:
#define DIALOG_QUIZ 5550
#define DIALOG_QUIZ1 5551
#define DIALOG_QUIZ2 5552
#define DIALOG_QUIZ3 5553
#define DIALOG_QUIZ4 5554
new QuizAnswers[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
ShowPlayerDialog(playerid,DIALOG_QUIZ,DIALOG_STYLE_LIST,"Powergamming is...","...Roleplaying realistic actions upon another player.\n...Roleplaying unrealistic actions or forcing another player to do something.\n...Forcing another player to do something in realistic manner. ","Confirm","Quit");
QuizAnswers[playerid] = 0; // We set the player quiz answers to 0 when he connects.
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_QUIZ: // If first dialog shows up
{
if(!response) return Kick(playerid); // If he click "Leave " he will be kicked.
if(response) // If he click first button
{
switch(listitem) // We switch the available answers
{
case 0:// If he choose first answer, wich is: Real Pussy
{
QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
ShowPlayerDialog(playerid,DIALOG_QUIZ1,DIALOG_STYLE_LIST,"Metagaming is...","...Using OOC for IC Purpose.\n...Both of them. \n...Using IC for OOC purpose.","Select","Quit");
// Second question will show up
}
case 1: // If he choose 2nd answers, which is: Role Play (correct one)
{
// He will get a message that he answered correct
ShowPlayerDialog(playerid,DIALOG_QUIZ1,DIALOG_STYLE_LIST,"Metagaming is...","...Using OOC for IC Purpose.\n...Both of them. \n...Using IC for OOC purpose.","Select","Quit");
// Second question will show up
}
case 2:
{
SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered
QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
ShowPlayerDialog(playerid,DIALOG_QUIZ1,DIALOG_STYLE_LIST,"Metagaming is...","...Using OOC for IC Purpose.\n...Both of them. \n...Using IC for OOC purpose.","Select","Quit");
// Second question will show up
}
}
}
}
case 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
{
switch(listitem) // We switch the available answers
{
case 0: // If he choose first answer wich is: Yes
{
QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST,"Are you allowed to driveby?","Only as a passanger\nNo,you get punished for that.\nOnly if you are roleplaying as a human.","Select","Quit");
// Next dialog will show up
}
case 1: // If he choose first answer wich is: No, it's a NON-RP word (correct one)
{
// He will get a message that he answered correct
ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST,"Are you allowed to driveby?","Only as a passanger\nNo,you get punished for that.\nOnly if you are roleplaying as a human.","Select","Quit");
// Next dialog will show up
}
case 2:
{
QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST,"Are you allowed to driveby?","Only as a passanger\nNo,you get punished for that.\nOnly if you are roleplaying as a human.","Select","Quit");
// Next dialog will show up
}
}
}
}
case 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
{
switch(listitem) // We switch the available answers
{
case 0: // If he choose first answer wich is: /me laugs (correct one)
{
ShowPlayerDialog(playerid, DIALOG_QUIZ3, DIALOG_STYLE_LIST,"What IC stands for?","Inner Characteristic \nIn Character\nInside Class","Select","Quit");
// Next dialog will show up
}
case 1:
{
QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
ShowPlayerDialog(playerid, DIALOG_QUIZ3, DIALOG_STYLE_LIST,"What IC stands for?","Inner Characteristic \nIn Character\nInside Class","Select","Quit");
// Next dialog will show up
}
case 2:
{
QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
ShowPlayerDialog(playerid, DIALOG_QUIZ3, DIALOG_STYLE_LIST,"What IC stands for?","Inner Characteristic \nIn Character\nInside Class","Select","Quit");
// Next dialog will show up
}
}
if(QuizAnswers[playerid] >= 1) // 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
}
}
}
case 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
{
switch(listitem) // We switch the available answers
{
case 0: // If he choose first answer wich is: Information Centre
{
QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
ShowPlayerDialog(playerid, DIALOG_QUIZ4, DIALOG_STYLE_LIST,"Deathmatching is attempting to kill another player...","...Who is trying to kill you.\n...Whithout a good roleplay reason.\nWith a good roleplay reason.","Select","Quit");
// Next dialog will show up
}
case 1: // If he choose first answer wich is: In Character (correct one)
{
ShowPlayerDialog(playerid, DIALOG_QUIZ4, DIALOG_STYLE_LIST,"Deathmatching is attempting to kill another player...","...Who is trying to kill you.\n...Whithout a good roleplay reason.\nWith a good roleplay reason.","Select","Quit");
// Next dialog will show up
}
case 2: // If he choose first answer wich is: I'm Cool
{
QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
ShowPlayerDialog(playerid, DIALOG_QUIZ4, DIALOG_STYLE_LIST,"Deathmatching is attempting to kill another player...","...Who is trying to kill you.\n...Whithout a good roleplay reason.\nWith a good roleplay reason.","Select","Quit");
// Next dialog will show up
}
}
if(QuizAnswers[playerid] >= 1) // If he reached 3 wrong answers or more
{
Kick(playerid); // He will be kicked
}
}
}
case DIALOG_QUIZ4: // If 5 dialog shows up
{
if(!response) return Kick(playerid); // If he click second button he get kicked
if(response) // If he click first button
{
switch(listitem) // We switch the available answers
{
case 0: // If he choose first answers wich is: Out of Chat
{
QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
}
case 1: // If he choose second answers wich is: Out of Character (correct one)
{
}
case 2: // If he choose 3rd answer wich is: Ow ow cool
{
QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
}
}
if(QuizAnswers[playerid] >= 1) // If he reached 3 wrong answers or more
{
SendClientMessage(playerid, -1,"You have answerd wrong");
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.
}
}
}
}
return 1;
}