SA-MP Forums Archive
How to avoid? Or is that a bug? - 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: How to avoid? Or is that a bug? (/showthread.php?tid=204519)



public OnPlayerDisconnect problem - blackwave - 29.12.2010

When I do:
Код:
/rcon reloadfs adminx
The script reloadfs normally. But when a player disconects, a message doesn't shows up. Also their status don't save. But normally before the reloadfs, shows the msg of disconection and save status. All works normally after this command, except the callback OnPlayerDisconnect. Is that a bug or is there any other way to avoid?
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new n[MAX_PLAYER_NAME];
    GetPlayerName(playerid,n,MAX_PLAYER_NAME);
    format(file,sizeof(file),SERVER_USER_FILE,n);
    if(dini_Exists(file)) {
    printf("spawn: %d | registrado: %d | logado: %d",dini_Int(file,"Spawnou"),dini_Int(file,"Registrado"),gPlayerLogged[playerid]);
    SavePlayerStats(playerid);
    SoundForAll(1084);
    plantada[playerid]=0;
    detonada[playerid]=1;
    jail[playerid]=0;
    block_pms[playerid]=0;
    mostrou[playerid]=0;
    fix[playerid]=0;
    gPlayerLogged[playerid] = 0;
    pausa[playerid]=0;
    ToggleVClock(0);
    banco[playerid]=0;
    IsInSafe[playerid]=0;
    new string[128];
    format(string,sizeof(string),"Logged: %d | Spawnou: %d | Jail: %d",gPlayerLogged[playerid],PlayerInfo[playerid][Spawnou],PlayerInfo[playerid][Jail]);
    printf(string);
    }
    new nome[30],string[128];
    GetPlayerName(playerid, nome, 30);
    switch(reason)
    {
      case 0: format(string,sizeof(string),"| {00FFA2}%s [ID: %d] {D60AFF}has disconnected {EBFF0A}[Timeout]", nome, playerid);
      case 1: format(string,sizeof(string),"| {00FFA2}%s [ID: %d] {D60AFF}has disconnected {0AFFFF}[Logged out]", nome, playerid);
      case 2: format(string,sizeof(string),"| {00FFA2}%s [ID: %d] {D60AFF}has disconnected {FF0A43}[Kick/Ban]", nome, playerid);
    }
    SendClientMessageToAll(color, string);
    return 1;
}



Re: How to avoid? Or is that a bug? - Jochemd - 29.12.2010

It's cause you have closed the callback before the messages can come


Re: How to avoid? Or is that a bug? - Mauzen - 29.12.2010

Probably the script crashes somewhere before saving and sending the message.
Add a print("<line number here>"); after every line, or every second, so you can see what is executed last (this causes the crash).


Re: How to avoid? Or is that a bug? - blackwave - 29.12.2010

Dude, I made an FS, doing the same functions on my admin FS, and worked perfectly. My problem is on the admin FS, so. The callbacks which are ran through the timer: Click here for see


Re: How to avoid? Or is that a bug? - blackwave - 30.12.2010

Bump. 12 Hours.