24.06.2011, 11:01
Hello everyone. I have some saving problems.
When I register and login for the first time, nothing saves into my userfile.
When I relog and do things it does save.
How to fix it that when you log in for the very first time everything will be saved as well?
Tell me if you need more.
Thanks in advance.
When I register and login for the first time, nothing saves into my userfile.
When I relog and do things it does save.
How to fix it that when you log in for the very first time everything will be saved as well?
pawn Код:
if(dialogid == 1)
{
GetPlayerName(playerid, Name, sizeof(Name));
format(file, sizeof(file), SERVER_USER_FILE, Name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Register", "Welcome, your not registered, please fill in a password", "Register", "Leave");
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(inputtext));
dini_IntSet(file, "AdminLevel",0);
dini_IntSet(file, "Money",0);
dini_IntSet(file, "Score",0);
dini_IntSet(file, "Gender",0);
dini_IntSet(file, "Age",0);
SpawnPlayer(playerid);
SetCameraBehindPlayer(playerid);
format(String, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s, you have been auto logged in.", Name, inputtext);
SendClientMessage(playerid, COLOR_GREEN, String);
gPlayerLogged[playerid] = 1;
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "_", "Welcome to Infinity Roleplay.\nBefore you can play and have fun with our players,\nwe have to ask you a few questions.", "Continue","");
}
if (dialogid == 2)
{
GetPlayerName(playerid, Name, sizeof(Name));
format(file, sizeof(file), SERVER_USER_FILE, Name);
if(!response) return Kick(playerid);
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login", "You're already registered, please login.", "Login", "Leave");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp)
{
SendClientMessage(playerid, COLOR_RED, "Wrong password");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login", "You're already registered, please login.", "Login", "Leave");
}
else
{
gPlayerLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
PlayerInfo[playerid][pScore] = dini_Int(file, "Score");
PlayerInfo[playerid][pCash] = dini_Int(file, "Money");
PlayerInfo[playerid][pGender] = dini_Int(file, "Gender");
PlayerInfo[playerid][pAge] = dini_Int(file, "Age");
Save[playerid] = SetTimerEx("SaveStats",1000,true,"i",playerid);
SendClientMessage(playerid,COLOR_GREEN, "Successfully logged in!");
SpawnPlayer(playerid);
SetCameraBehindPlayer(playerid);
}
}
Thanks in advance.