03.05.2015, 04:49
My code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == dregister) //If dialog id is a register dialog
{//then
if(!response) return Kick(playerid);
if(response) //if they clicked the first button "Register"
{//then
if(!strlen(inputtext)) //If they didn't enter any password
{// then we will tell to them to enter the password to register
ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_I NPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
return 1;
}
new pass[128];
GetPlayerName(playerid, pname, sizeof(pname));
/*format(str, sizeof(str), "%s.user", pname);
if(dini_Exists(str)) return SCM(playerid, red, "ERROR: This nickname is already registered. Please reconnect with another nickname.");
else if(strlen(params) < 5) return SCM(playerid, red, "ERROR: Your password must be at least 5 characters long!");
else if(sscanf(params, "s[128]", pass)) return SCM(playerid, yellow, "SYNTAX: /register <password>");
WP_Hash(buf, sizeof(buf), pass);*/
dini_Create(str);
dini_IntSet(str, "registered", 1);
dini_IntSet(str, "level", 0);
dini_IntSet(str, "muted", PData[playerid][Muted]);
dini_IntSet(str, "jailed", PData[playerid][Jailed]);
dini_Set(str, "password", buf);
format(str2, sizeof(str2), "You have successfully registered your nickname with the password \"%s\" - please write it down incase you forget it.", pass);
SCM(playerid, green, str2);
SCM(playerid, green, "Don't worry, your password is saved hashed (whirlpool), and admins cannot see it. You have also been automatically logged in!");
PData[playerid][Loggedin] = 1;
PData[playerid][Registered] = 1;
dini_Set(str, "lastip", pip);
TogglePlayerControllable(playerid, 1);
format(str2, sizeof(str2), "%s has joined the server and registered.", pname);
SendClientMessageToAll(green, str2);
return 1;
}
}
if(dialogid == dlogin) //If dialog id is a login dialog
{//then
if(!response) return Kick(playerid);
if(response) //if they clicked the first button "Register"
{//then
PData[playerid][Muted] = dini_Int(str, "muted");
dini_IntSet(str, "registered", 1);
PData[playerid][Jailed] = dini_Int(str, "jailed");
GetPlayerIp(playerid, pip, sizeof(pip));
PData[playerid][Loggedin] = 1;
PData[playerid][Level] = dini_Int(str, "level");
PData[playerid][Registered] = 1;
format(str2, sizeof(str2), "You have been successfully logged in! Welcome back, %s!", pname);
SCM(playerid, green, str2);
GetPlayerIp(playerid, pip, sizeof(pip));
dini_Set(str, "lastip", pip);
format(str2, sizeof(str2), "%s has joined the server and logged in.", pname);
}
if(PData[playerid][Level] < 1 && !IsPlayerAdmin(playerid)) return SendClientMessageToAll(green, str2);
{
format(str2, sizeof(str2), "** {33CCFF}Administrator {FFFF00}%s {00FF00}has joined the server.", pname);
SendClientMessageToAll(red, str2);
}
return 1;
}
else //If they've entered an incorrect password
{//then
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPU T,"{33AA33}Login:","{FF9900}Welcome back! {33CCFF}This account is already registered. \n{B8860B}Please insert your password:\n{D50000}Incorrect password!","Login","Quit");//We will tell to them that they've entered an incorrect password
SendClientMessage(playerid, red, "[INFO]: Incorrect password!");
return 1;
}
}
return 1;
}
And on the last return 1 here up ^^ I get error 010. Please somebody tell me where I am wrong.
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == dregister) //If dialog id is a register dialog
{//then
if(!response) return Kick(playerid);
if(response) //if they clicked the first button "Register"
{//then
if(!strlen(inputtext)) //If they didn't enter any password
{// then we will tell to them to enter the password to register
ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_I NPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
return 1;
}
new pass[128];
GetPlayerName(playerid, pname, sizeof(pname));
/*format(str, sizeof(str), "%s.user", pname);
if(dini_Exists(str)) return SCM(playerid, red, "ERROR: This nickname is already registered. Please reconnect with another nickname.");
else if(strlen(params) < 5) return SCM(playerid, red, "ERROR: Your password must be at least 5 characters long!");
else if(sscanf(params, "s[128]", pass)) return SCM(playerid, yellow, "SYNTAX: /register <password>");
WP_Hash(buf, sizeof(buf), pass);*/
dini_Create(str);
dini_IntSet(str, "registered", 1);
dini_IntSet(str, "level", 0);
dini_IntSet(str, "muted", PData[playerid][Muted]);
dini_IntSet(str, "jailed", PData[playerid][Jailed]);
dini_Set(str, "password", buf);
format(str2, sizeof(str2), "You have successfully registered your nickname with the password \"%s\" - please write it down incase you forget it.", pass);
SCM(playerid, green, str2);
SCM(playerid, green, "Don't worry, your password is saved hashed (whirlpool), and admins cannot see it. You have also been automatically logged in!");
PData[playerid][Loggedin] = 1;
PData[playerid][Registered] = 1;
dini_Set(str, "lastip", pip);
TogglePlayerControllable(playerid, 1);
format(str2, sizeof(str2), "%s has joined the server and registered.", pname);
SendClientMessageToAll(green, str2);
return 1;
}
}
if(dialogid == dlogin) //If dialog id is a login dialog
{//then
if(!response) return Kick(playerid);
if(response) //if they clicked the first button "Register"
{//then
PData[playerid][Muted] = dini_Int(str, "muted");
dini_IntSet(str, "registered", 1);
PData[playerid][Jailed] = dini_Int(str, "jailed");
GetPlayerIp(playerid, pip, sizeof(pip));
PData[playerid][Loggedin] = 1;
PData[playerid][Level] = dini_Int(str, "level");
PData[playerid][Registered] = 1;
format(str2, sizeof(str2), "You have been successfully logged in! Welcome back, %s!", pname);
SCM(playerid, green, str2);
GetPlayerIp(playerid, pip, sizeof(pip));
dini_Set(str, "lastip", pip);
format(str2, sizeof(str2), "%s has joined the server and logged in.", pname);
}
if(PData[playerid][Level] < 1 && !IsPlayerAdmin(playerid)) return SendClientMessageToAll(green, str2);
{
format(str2, sizeof(str2), "** {33CCFF}Administrator {FFFF00}%s {00FF00}has joined the server.", pname);
SendClientMessageToAll(red, str2);
}
return 1;
}
else //If they've entered an incorrect password
{//then
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPU T,"{33AA33}Login:","{FF9900}Welcome back! {33CCFF}This account is already registered. \n{B8860B}Please insert your password:\n{D50000}Incorrect password!","Login","Quit");//We will tell to them that they've entered an incorrect password
SendClientMessage(playerid, red, "[INFO]: Incorrect password!");
return 1;
}
}
return 1;
}
And on the last return 1 here up ^^ I get error 010. Please somebody tell me where I am wrong.