25.10.2012, 11:17
pawn Код:
if(fexist(UserSavePath(playerid)))
{
format(string1, sizeof(string1), "Hello %s, welcome back!", GetPlayerNameEx(playerid));
format(string2, sizeof(string2), "Welcome back %s, to "GM_NAME"! We have found your account registered in the database.\n\nEnter your password to login!", GetPlayerNameEx(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, string1, string2, "Login!", "Cancel");
}
else
{
format(string1, sizeof(string1), "Hello there %s!", GetPlayerNameEx(playerid));
format(string2, sizeof(string2), "Welcome %s to "GM_NAME", it seem's you have not registered yet!\n\nEnter your desired password below to do so!", GetPlayerNameEx(playerid));
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, string1, string2, "Register!", "Cancel");
}
then
pawn Код:
if(dialogid == DIALOG_REGISTER)
{
if(!response) return Kick(playerid);
if(response)
{
if(strlen(inputtext) > 5)
{
new string[96];
format(string, sizeof(string), "%s, choose your gender!", GetPlayerNameEx(playerid));
ShowPlayerDialog(playerid, DIALOG_REGISTERGENDER, DIALOG_STYLE_LIST, string, "1) I am a male.\n2) I am a female.", "Select", "Cancel");
new INI:File = INI_Open(UserSavePath(playerid));
INI_WriteInt(File, "Password", strlen(inputtext));
INI_WriteInt(File, "Level", PlayerInfo[playerid][pLevel] = 0);
INI_WriteInt(File, "Administration", PlayerInfo[playerid][pAdmin] = 0);
INI_WriteInt(File, "VIP Level", PlayerInfo[playerid][pVIP] = 0);
INI_WriteInt(File, "Skin ID", PlayerInfo[playerid][pSkinID] = 299);
INI_WriteInt(File, "Playing Hours", PlayerInfo[playerid][pConnectTime] = 0);
INI_WriteInt(File, "House Key", PlayerInfo[playerid][pHouseKey] = -1);
INI_WriteInt(File, "Kills", PlayerInfo[playerid][pKills] = 0);
INI_WriteInt(File, "Deaths", PlayerInfo[playerid][pDeaths] = 0);
INI_Close(File);
}
}
}