22.12.2010, 10:44
Right different id's
it should be
OnPlayerConnect
OnDialogResponse
it should be
OnPlayerConnect
pawn Код:
if(!udb_Exists(GetName(playerid)))
{
ShowPlayerDialog(playerid, 2002, DIALOG_STYLE_INPUT, "Register", "This name is not registered!\nYou can register it for you by typing in a password for it below.\nYou will use this password evry time you connect to this server.", "Register", "Cancel");
}
if(udb_Exists(GetName(playerid)))
{
ShowPlayerDialog(playerid, 2003, DIALOG_STYLE_INPUT, "Login", "This name is already registered!\nPlease type in your password below.", "Login", "Cancel");
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 2002)
{
if(response)
{
new file[256];
udb_Create(GetName(playerid), inputtext);
GameTextForPlayer(playerid, "Registered", 3000, 4);
format(file,sizeof(file),"%s.sav",udb_encode(GetName(playerid)));
dini_Set(file,"password",inputtext);
PlayerPlaySound(playerid, 1056, 0, 0, 0);
ShowPlayerDialog(playerid, 2002, DIALOG_STYLE_INPUT, "Login", "This name is already registered!\nPlease type in your password below.", "Login", "Cancel");
}
if(!response)
{
Kick(playerid);
}
return 1;
}
if(dialogid == 2003)
{
if(response)
{
if(udb_CheckLogin(GetName(playerid), inputtext))
{
GameTextForPlayer(playerid, "Logged in!", 3000, 4);
PlayerPlaySound(playerid, 1057, 0, 0, 0);
}
}
if(!response)
{
Kick(playerid);
}
return 1;
}
return 0;
}