register/login system problem -
fireboy - 25.05.2013
i putted this register/login system with yini in my gamemode:
https://sampforum.blast.hk/showthread.php?tid=273088
but i have a problem. the stats save, money, password etc. but when i login(i have set in my userfile money) it doesnt load the stats(money,score etc.)
how can i fix this problem?
Re: register/login system problem -
fireboy - 25.05.2013
anyone?
Re: register/login system problem -
NicholasA - 25.05.2013
Show your script, you can PM me if you want to keep it private
Re: register/login system problem -
Kestro - 25.05.2013
Show the part of code.
Re: register/login system problem -
fireboy - 26.05.2013
if you want to help me, send me a private message, and i will show the code.
Re: register/login system problem -
DobbysGamertag - 26.05.2013
Wait? you won't show the code, but you'll show the FS oO
pawn Код:
enum pInfo
{
pPass,
pCash,
pAdmin,
pKills,
pDeaths,
pScore
}
pawn Код:
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Score",PlayerInfo[playerid][pScore]);
return 1;
}
add this:
to the dialog register:
pawn Код:
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Score",0);
INI_Close(File);
Then to the OnPlayerDisconnect:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]);
INI_Close(File);
return 1;
}
Add this part to the login dialog.
pawn Код:
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid,PlayerInfo[playerid][pScore]);
Sorry about the crappy indentation. I was writing it in the reply box. I used the same userfile tutorial.
Re: register/login system problem -
fireboy - 26.05.2013
argh, i have already putted this filterscript in my gamemode, but stats like money/score dont set, when i login.
Re: register/login system problem -
DobbysGamertag - 26.05.2013
is it even saving?
Re: register/login system problem -
fireboy - 28.05.2013
Quote:
Originally Posted by DobbysGamertag
is it even saving?
|
it saves everything, but doesnt load.
Re: register/login system problem -
fireboy - 02.06.2013
Fixed myself, the INI_SetTag was guilty.