19.11.2010, 04:43
So i made a Dialog Account system, and it saves everything ok, but loads everything all wrong. example: if i had 5000 cash, and i log out and log in, it comes up as negative 5000, and my skin and score doesnt load. , heres the code.
this is the login.
this is the login.
pawn Код:
if (dialogid == 2)
{
new name[MAX_PLAYER_NAME], file[256];
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, "Hi your registered", "Great! Login with your password!", "Login", "Leave");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp)
{
SendClientMessage(playerid, COLOR_RED, "Wrong PW sir.");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi your registered", "Great! Login with your password!", "Login", "Leave");
}
else
{
gPlayerLogged[playerid] = 1;
PlayerInfo[playerid][PosX] = dini_Float(file, "PosX");
PlayerInfo[playerid][PosY] = dini_Float(file, "PosY");
PlayerInfo[playerid][PosZ] = dini_Float(file, "PosZ");
SetPlayerPos(playerid, PlayerInfo[playerid][PosX],PlayerInfo[playerid][PosY],PlayerInfo[playerid][PosZ]);
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
SetPlayerScore(playerid, dini_Int(file, "pscore"));
GivePlayerMoney(playerid, dini_Int(file, "Money"));
SendClientMessage(playerid,COLOR_RED, "[SYSTEM]: Successfully logged in!");
SpawnPlayer(playerid);
}
}
return 1;
}