stats are not saving upon disconnect - YINI
#10

hello... i have noticed that if i place my saving codes on top and it save and rest of functions don't respond .. idk what is blocking it .. here is full OnPlayerDisconnect Code..

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
        if(playerid == INVALID_PLAYER_ID || !IsPlayerConnected(playerid)) return SCM(playerid, -1,"");
        if(fexist(Path(playerid)))
        {// then
        new INI:file = INI_Open(Path(playerid)); //will open their file
        INI_SetTag(file,"Players_Data");//We will set a tag inside of user's account called "Players_Data"
        INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]); //If you've set his/her admin level, then his/her admin level will be saved inside of his/her account
        INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
        INI_WriteInt(file,"Money",GetPlayerMoney(playerid));//We will save his money inside of his account
        INI_WriteInt(file,"Scores",GetPlayerScore(playerid));//We will save his score inside of his account
        INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);//As explained above
        INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);//As explained above
        INI_WriteInt(file,"Adisable",pInfo[playerid][Adisable]);
        INI_WriteInt(file,"Banned",pInfo[playerid][Banned]);
        INI_WriteInt(file,"Pills",pInfo[playerid][Pills]);
        INI_WriteInt(file,"Savedskin",pInfo[playerid][Savedskin]);
        INI_WriteInt(file,"Last",pInfo[playerid][Last]);
        INI_WriteInt(file,"NoPM",pInfo[playerid][NoPM]);
        INI_WriteInt(file,"Drugs",pInfo[playerid][Drugs]);
        INI_Close(file);//Now after we've done saving their data, we now need to close the file
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid,playername,24);
        new str[120];
        format(str,sizeof(str),"<SAVED> Stats for account: %s(%d) has been saved successfully.", playername, playerid);
        print(str);
        }
       
        cage[playerid] = DestroyObject(cage[playerid]);
        cage2[playerid] = DestroyObject(cage2[playerid]);
        cage3[playerid] = DestroyObject(cage3[playerid]);
        cage4[playerid] = DestroyObject(cage4[playerid]);
        caged[playerid] = 0;


        LeaveGroup(playerid, 2);
        if(pInfo[playerid][Adminlevel] > 1)
           {
              if(blockedfix == 1)
              {
              blockedfix =0;
              SendClientMessageToAll(COLOR_HOTPINK, "/fix Has Been Unblocked.");
              }
              if(blockedsh == 1)
              {
              blockedsh =0;
              SendClientMessageToAll(COLOR_HOTPINK, "/sh Has Been Unblocked.");
              }
              if(blockedsar == 1)
              {
              blockedsar =0;
              SendClientMessageToAll(COLOR_HOTPINK, "/sar Has Been Unblocked.");
              }
              if(blockedgoto == 1)
              {
              blockedgoto =0;
              SendClientMessageToAll(COLOR_HOTPINK, "/goto Has Been Unblocked.");
              }
           }

        if(randomid == playerid)
        {
        randomid = -1;
        //SetTimer("BonusPlayer", 60*1000, 0);
        randmoney =0;
        SendClientMessage(playerid, COLOR_SKYBLUE, "* {00B9FF}BONUS: {FF0000} Player {FFFFFF}Has Been Disconnected.");
        }


        //new pname1 = strtolower(name);

        waved[playerid] =0;
        foffed[playerid] =0;
        farted[playerid] =0;
        flashed[playerid] =0;
        cried[playerid] =0;
        wanked[playerid] =0;
        rape[playerid] =0;
        cried[playerid] =0;
        givemoney[playerid] =0;

        KillTimer(login_timer1[playerid]);
        KillTimer(register_timer1[playerid]);
        KillTimer(ban1[playerid]);
        KillTimer(wave_timer1[playerid]);
        KillTimer(foff_timer1[playerid]);
        KillTimer(fart_timer1[playerid]);
        KillTimer(flash_timer1[playerid]);
        KillTimer(wank_timer1[playerid]);
        KillTimer(RapeRecent1[playerid]);
        KillTimer(cry_timer1[playerid]);

        pInfo[playerid][Last] =-1;


        pInfo[playerid][Adminlevel] =0;
        pInfo[playerid][VIPlevel] =0;
        pInfo[playerid][Money] =0;
        pInfo[playerid][Scores] =0;
        pInfo[playerid][Kills] =0;
        pInfo[playerid][Deaths] =0;
        pInfo[playerid][Pills] =0;
        pInfo[playerid][Savedskin] =-1;
        warns[playerid] =0;
        pInfo[playerid][Last] = -1;
        pInfo[playerid][NoPM] = 0;
        pInfo[playerid][Drugs] = 0;
        //pInfo[playerid][Adisable] =0;

        failattemps[playerid] =0;
        new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
        GetPlayerName(playerid, pname, sizeof(pname));
        switch(reason)
        {
        case 0: format(string, sizeof(string), "* %s has left the server. (Time Out)", pname);
        case 1: format(string, sizeof(string), "* %s has left the server. (Quit)", pname);
        case 2: format(string, sizeof(string), "* %s has left the server. (Kicked!)", pname);
        }
        //SendClientMessageToAll(COLOR_GREY, string);
        print("called at OnPlayerDisconnect");
        return 1;
}
http://pastebin.com/XqRT5pJR
Reply


Messages In This Thread
stats are not saving upon disconnect - YINI - by Anak - 29.07.2013, 14:00
Re: stats are not saving upon disconnect - YINI - by dEcooR - 29.07.2013, 14:10
Re: stats are not saving upon disconnect - YINI - by Anak - 29.07.2013, 14:12
Re: stats are not saving upon disconnect - YINI - by dEcooR - 29.07.2013, 14:18
Re: stats are not saving upon disconnect - YINI - by Anak - 29.07.2013, 14:21
Re: stats are not saving upon disconnect - YINI - by dEcooR - 29.07.2013, 14:22
Re: stats are not saving upon disconnect - YINI - by Anak - 29.07.2013, 14:24
Re: stats are not saving upon disconnect - YINI - by dEcooR - 29.07.2013, 14:25
Re: stats are not saving upon disconnect - YINI - by Anak - 29.07.2013, 15:08
Re: stats are not saving upon disconnect - YINI - by Anak - 29.07.2013, 15:21

Forum Jump:


Users browsing this thread: 4 Guest(s)