12.01.2011, 11:35
I'v recently been trying to learn y_ini and have come across some problems.
Everything saves perfectly fine but when the player logs in he doesn't recieve his cash/score.
Heres the login dialog.
I'v been editing Zh3r0's system - https://sampforum.blast.hk/showthread.php?tid=206830
Cheers for any help.
Everything saves perfectly fine but when the player logs in he doesn't recieve his cash/score.
Heres the login dialog.
pawn Code:
case LOGIN:
{
if(!response) return Kick(playerid);
if(response)
{
if(strlen(inputtext) == 0) return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT,"Incorrect password.","Please enter your current password to login." ,"Login", "Disconnect");
new PlayerFile[35], Password[21];
format(PlayerFile, 35, "Users/%s.ini",Encode(pName(playerid)));
INI_ParseFile(PlayerFile, "ParsePlayerPass", false, true, playerid);
GetPVarString(playerid, "pPass", Password, sizeof Password);
if(!strcmp(inputtext,Password,false))
{
logged[playerid] = 1;
format(PlayerFile,35, "Users/%s.ini",Encode(pName(playerid)));
INI_ParseFile(PlayerFile, "LoadUser", false, true, playerid, true, false);
GivePlayerMoney(playerid, Money[playerid]);
SetPlayerScore(playerid, Score[playerid]);
SendClientMessage(playerid, COLOR_ORANGE,"Welcome, you have sucessfully logged in.");
}
else ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Incorrect password", "Enter the correct password below.", "Login", "Disconnect");
}
}
}
forward ParsePlayerPass(playerid, name[], value[]);
public ParsePlayerPass(playerid, name[], value[])
{
if(!strcmp(name, "PASSWORD"))
{
SetPVarString(playerid, "pPass", value);
}
}
forward LoadUser(playerid, name[], value[]);
public LoadUser(playerid, name[], value[])
{
if(!strcmp(name, "MONEYS"))SetPVarInt(playerid, "Moneys", strval(value));
if(!strcmp(name, "SCORE"))SetPVarInt(playerid, "Score", strval(value));
}
Cheers for any help.