12.07.2013, 14:37
Hello,
I have a problem.
If the player joins the game and is asked to register and he presses quit, he will get kicked.
But the system still save's his information exept for his password, so if he relogs his account is "registered" but it has no password. How can I fix this?
I have a problem.
If the player joins the game and is asked to register and he presses quit, he will get kicked.
But the system still save's his information exept for his password, so if he relogs his account is "registered" but it has no password. How can I fix this?
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response)
{
Kick(playerid);
}
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Registering",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type a password below to register a new account.","Register","Quit");
}
else
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Level",0);
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"VIP",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Ores", 0);
INI_WriteInt(File,"Metal", 0);
INI_WriteInt(File,"Wood", 0);
INI_WriteInt(File,"Rocks", 0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, -80.8000000,-1134.5999800,0.7000000, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SendClientMessage(playerid, COLOR_GREEN, "* Succesfully registered!");
}
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetSpawnInfo(playerid, 0, 0, -80.8000000,-1134.5999800,0.7000000, 269.15, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SendClientMessage(playerid, COLOR_GREEN, "* Succesfully logged in!");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login","Login","Quit");
}
return 1;
}
}
}
return 0;
}