public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid){
case 1:
{
if(response){
new filestring[128];
format(filestring, sizeof(filestring), "Accounts/%s", GetPlayerName(playerid));
new password[256];
password = dini_Get(filestring, "Password");
if(strcmp(inputtext, password, false) == 0){
Player[playerid][Skin] = dini_Int(filestring, "Skin");
Player[playerid][LastX] = dini_Float(filestring, "LastX");
Player[playerid][LastY] = dini_Float(filestring, "LastY");
Player[playerid][LastZ] = dini_Float(filestring, "LastZ");
SetSpawnInfo(playerid, 0, Player[playerid][Skin], Player[playerid][LastX], Player[playerid][LastY], Player[playerid][LastZ]);
SpawnPlayer(playerid);
}else{
SendClientMessage(playerid, RED, "Wrong password!");
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login", "Enter your password below:", "Login", "Cancel");
}
}
}
case 2:
{
if(response){
new filestring[128];
format(filestring, sizeof(filestring), "Accounts/%s", GetPlayerName(playerid));
dini_Create(filestring);
new namestring[256];
new passstring[256];
format(namestring, sizeof(namestring), "%s", GetPlayerName(playerid));
format(passstring, sizeof(passstring), "%s", inputtext);
dini_Set(filestring, "Name", namestring);
dini_Set(filestring, "Password", passstring);
dini_FloatSet(filestring, "LastX", 1643.086181);
dini_FloatSet(filestring, "LastY", -2237.591796);
dini_FloatSet(filestring, "LastZ", 13.494955);
dini_IntSet(filestring, "Skin", 0);
dini_IntSet(filestring, "Level", 0);
dini_IntSet(filestring, "AdminLevel", 0);
SendClientMessage(playerid, GREEN, "You have been registered successfully! Please now go through some steps.");
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "Gender", "Please choose the gender of your character:", "Male", "Female");
}
}
case 3:
{
new filestring[128];
format(filestring, sizeof(filestring), "Accounts/%s", GetPlayerName(playerid));
if(response){
dini_Set(filestring, "Gender", "Male");
}else{
dini_Set(filestring, "Gender", "Female");
}
ShowPlayerDialog(playerid, 4, DIALOG_STYLE_INPUT, "Date of Birth", "Please type in the day of the month which your character were born on:", "Submit", "Cancel");
}
case 4:
{
new filestring[128];
format(filestring, sizeof(filestring), "Accounts/%s", GetPlayerName(playerid));
if(response){
new dob = strval(inputtext);
dini_IntSet(filestring, "DateOB", dob);
ShowPlayerDialog(playerid, 5, DIALOG_STYLE_INPUT, "Month of Birth", "Please type in the the month in which your character were born:", "Submit", "Cancel");
}
}
case 5:
{
new filestring[128];
format(filestring, sizeof(filestring), "Accounts/%s", GetPlayerName(playerid));
if(response){
new mob = strval(inputtext);
dini_IntSet(filestring, "MonthOB", mob);
ShowPlayerDialog(playerid, 6, DIALOG_STYLE_INPUT, "Year of Birth", "Please type in the the year in which your character were born:", "Submit", "Cancel");
}
}
case 6:
{
new filestring[128];
format(filestring, sizeof(filestring), "Accounts/%s", GetPlayerName(playerid));
if(response){
new yob = strval(inputtext);
dini_IntSet(filestring, "YearOB", yob);
SendClientMessage(playerid, GREEN, "You are now fully registered! Please log in with your password.");
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login", "Enter your password below:", "Login", "Cancel");
}
}
}
return 0;
}
printf("OnDialogResponse(%d, %d, %d, %d, \"%s\")", playerid, dialogid, response, listitem, inputtext);
print("case 2 works - this shows"); if(response){ print("if response works - this shows"); new filestring[128]; format(filestring, sizeof(filestring), "Accounts/%s", GetPlayerName(playerid)); dini_Create(filestring); new namestring[256]; new passstring[256]; format(namestring, sizeof(namestring), "%s", GetPlayerName(playerid)); format(passstring, sizeof(passstring), "%s", inputtext); dini_Set(filestring, "Name", namestring); dini_Set(filestring, "Password", passstring); dini_FloatSet(filestring, "LastX", 1643.086181); dini_FloatSet(filestring, "LastY", -2237.591796); dini_FloatSet(filestring, "LastZ", 13.494955); dini_IntSet(filestring, "Skin", 0); dini_IntSet(filestring, "Level", 0); dini_IntSet(filestring, "AdminLevel", 0); SendClientMessage(playerid, GREEN, "You have been registered successfully! Please now go through some steps."); ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "Gender", "Please choose the gender of your character:", "Male", "Female"); print("after code - this shows"); |
Alright, it seems that it's my dini functions that is not working... Any ideas here?
|