OnPlayerDisconnect saving problem
#1

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new files[48],message[48];
    format(files,sizeof(files),"Last log/%s.ini",Name());
    new INI:file = INI_Open(files);
    format(message,sizeof(message),"%s",TimeDate());
    INI_WriteString(file,"Logged off",message);
    INI_Close(file);
    return 1;
}
pawn Код:
Name()
{
    new n[MAX_PLAYER_NAME];
    foreach (Player,i) GetPlayerName(i,n,MAX_PLAYER_NAME);
    return n;
}
It create file ".ini" instead with the name. I put it in OnPlayerConnect and it worked perfectly (Saved in playername.ini)
I know some people said "It's not a good idea to save in OnPlayerDisconnect" but as ****** said:
Quote:

I've never heard of any issues using OnPlayerDisconnect either. The only one issue you COULD have is if the server crashes, but that's got nothing to do with OnPlayerDisconnect (and neither does lag so I don't know why it was even mentioned as an argument).

EDIT: If I remove "foreach (Player,i)" it's work fine. Is that the problem?
Reply


Messages In This Thread
[Solved]OnPlayerDisconnect saving problem - by =WoR=Varth - 17.06.2011, 20:45
Re: OnPlayerDisconnect saving problem - by Sascha - 17.06.2011, 21:07
Re: OnPlayerDisconnect saving problem - by Calgon - 17.06.2011, 22:01
Re: OnPlayerDisconnect saving problem - by =WoR=Varth - 18.06.2011, 01:00

Forum Jump:


Users browsing this thread: 1 Guest(s)