stats are not saving upon disconnect - YINI
#1

Hello i have these codes ...
under OnPlayerDisconnect

pawn Код:
new name[MAX_PLAYER_NAME]; //Making a new variable called 'name'. name[MAX_PLAYER_NAME] is created so we can use it to get player's name.
        GetPlayerName(playerid,name,sizeof(name)); //Get player's name
        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);
        }

Stocks

pawn Код:
stock Path(playerid) //Will create a new stock so we can easily use it later to load/save user's data in user's path
{
    new str[128],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));

    for(new d,len = strlen(name); d != len; d++)
        name[d] = tolower(name[d]);

    format(str,sizeof(str),UserPath,name);
    return str;
}
the problem is.. that stats are not saving on disconnect and i don't get message in console
Код:
<SAVED> Stats for account: XYZ(x) has been saved successfully.
Reply
#2

first remove this from disconect if(fexist(Path(playerid))) ..its vs logic lol
and second would be problem this

the reason why you didnt get the mess is that ur using PRINT()
you may to use printf(str);

Код:
for(new d,len = strlen(name); d != len; d++)
name[d] = tolower(name[d]);
what the hell is this
Reply
#3

Quote:
Originally Posted by dEcooR
Посмотреть сообщение
first remove this from disconect if(fexist(Path(playerid))) ..its vs logic lol
and then how you can get message if ur disconnecting
the third would be problem this

Код:
for(new d,len = strlen(name); d != len; d++)
name[d] = tolower(name[d]);
what the hell is this
1). then it will save stats for UN-REGISTERED players...
2). PRINT!
3). it converts nick name to lower case before checking it.


... any other?
Reply
#4

LOL dude you wrote it rly nice,you cant just try the mine words?
Reply
#5

can you please explain what and why is causing problem.. .?
Reply
#6

As i wrote dude............

btw im using same system (Y_ini) so i know how it works lol
try to use my steps omg create an copy of ur gm and try that if it dont work delete it.. its problem?
Reply
#7

OK, SO HOW WILL YOU SOLVE MY STATS NOT SAVING PROBLEM >.. ? I wait for others...
Reply
#8

DUDE i cant solve ur problem if u dont wana test it rofl you dont believe me cuz im fuckin 3 reps wtf
Reply
#9

tested same problem remains .. any one?
Reply
#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


Forum Jump:


Users browsing this thread: 1 Guest(s)