Hogy tudok megnyitni felhasználó file-t ezzel?
Így próbáltam:
#include <a_samp>
#include <dfile>
LOGGED_IN(playerid)
{
new PlayerName[MAX_PLAYER_NAME];
format(PlayerName, sizeof(PlayerName), \"/ladmin/users/%s.sav\" ,udb_encode(PlayerName(playerid)));
dfile_Open(PlayerName);
dfile_WriteString(\"logged\", \"1\");
dfile_SaveFile();
dfile_CloseFile();
}
LOGGED_OUT(playerid)
{
new PlayerName[MAX_PLAYER_NAME];
format(PlayerName, sizeof(PlayerName), \"/ladmin/users/%s.sav\" ,udb_encode(PlayerName(playerid)));
dfile_Open(PlayerName);
dfile_WriteString(\"logged\", \"0\");
dfile_SaveFile();
dfile_CloseFile();
}
PlayerName(playerid)
{
new player[MAX_PLAYER_NAME];
GetPlayerName(playerid, player, sizeof(player));
return player;
}
Gyakorlatilag annyit szeretnék elérni, hogy amikor belép a játékos, akkor átírja a file-ban a \"logged\" -et 1-re, ha kilép 0-ra.
Ezt a következõkkel szeretném megoldani:
LOGGED_IN(playerid); (OnPlayerConnect-nél)
LOGGED_OUT(playerid); (OnPlayerDisconnect-nél)
A problémám az, amikor a játékos belép, crashel a szerver, és ezt a hibaüzenetet írja ki:
[15:38:41] [debug] Server crashed while executing Script.amx
[15:38:41] [debug] AMX backtrace:
[15:38:41] [debug] #0 native fread () [00405770] from samp-server.exe
[15:38:41] [debug] #1 000004e4 in dfile_Open (fajl[]=@0x00227d10 \"\") at D:\\MyPC\\server1\\server1\\pawno\\include\\dfile.inc:204
[15:38:41] [debug] #2 00002990 in LOGGED_IN (playerid=0) at D:\\MyPC\\server1\\server1\\pawno\\include\\logged.inc:19
[15:38:41] [debug] #3 00030f50 in public FEP_OnPlayerConnect (playerid=0) at D:\\MyPC\\server1\\server1\\filterscripts\\Script.pwn:5303
[15:38:41] [debug] #4 native CallLocalFunction () [00472c00] from samp-server.exe
[15:38:41] [debug] #5 00007f54 in public OnPlayerConnect (playerid=0) at D:\\MyPC\\server1\\server1\\pawno\\include\\ForEachPlayer.inc:24
[15:38:41] [debug] System backtrace:
[15:38:41] [debug] #0 00493010 in ?? () from D:\\MyPC\\server1\\server1\\samp-server.exe
[15:38:41] [debug] #1 00493640 in ?? () from D:\\MyPC\\server1\\server1\\samp-server.exe
[15:38:41] [debug] #2 00404f14 in ?? () from D:\\MyPC\\server1\\server1\\samp-server.exe