User File Problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: User File Problem (
/showthread.php?tid=112422)
User File Problem -
Naruto4 - 07.12.2009
When i use a command that will change user file info then all gets delete from the user like:
I type /makeadmin and it succefly makes it and i /q.
but when i check the scripting files I find a black userfile.. It is full before the cmd.
i putted onplayerupdate after onplayerdisconnect:
Код:
public OnPlayerUpdate(playerid)
{
if(IsPlayerConnected(playerid))
{
if(AccountInfo[playerid][aLogged] == 1)
{
new string3[128];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), ACCOUNTS_FOLDER, playername3);
new ip[20];
GetPlayerIp(playerid,ip,sizeof(ip));
new File: hFile = fopen(string3, io_write);
if (hFile)
{
new var[128];
format(var, 128, "Password=%s\n", AccountInfo[playerid][aPassword]);fwrite(hFile, var);
format(var, 128, "IP=%s\n",ip);fwrite(hFile, var);
format(var, 128, "EE=%d\n", AccountInfo[playerid][aEE]);fwrite(hFile, var);
format(var, 128, "Admin=%d\n", AccountInfo[playerid][aAdmin]);fwrite(hFile, var);
format(var, 128, "Tut=%d\n", AccountInfo[playerid][aTut]);fwrite(hFile, var);
format(var, 128, "Faction=%d\n", AccountInfo[playerid][aFaction]);fwrite(hFile, var);
}
}
}
return 1;
}
this aint GF or any other gm
Re: User File Problem -
[Marevin*] - 07.12.2009
shouldn't you close the files after you write something on them?
Re: User File Problem -
Naruto4 - 07.12.2009
ohhhhhhhhhhhhhh gonna try that THX
edit:
works xD nice thx buddy
Re: User File Problem -
Correlli - 07.12.2009
This is a VERY bad way to do. You shouldn't save files at the OnPlayerUpdate-callback.
Re: User File Problem -
Naruto4 - 07.12.2009
how to do it in good way then
xd correlli pomoziiiiiiiiiiiiiii
Re: User File Problem -
[Marevin*] - 07.12.2009
Yeh I though that too lol.
Maybe the problem is in the /makeadmin command.
Re: User File Problem -
Correlli - 07.12.2009
Put the code to other self-made function.