OnPlayerDisconnect Problem
#1

hello there i want to make a temp vip for my server but i got a problem the stats wont saved when player disconnect
Crashdetect ERROR
pawn Code:
[debug] Run time error 6: "Invalid instruction"
[17:47:31] [debug]  Unknown opcode 0x2c66eb8 at address 0x00000038
[17:47:31] [debug] AMX backtrace:
[17:47:31] [debug] #0 00000038 in public SAT_OnPlayerDisconnect () from v2_VIPBackup.amx
[17:47:31] [debug] #1 native CallLocalFunction () from samp-server.exe
[17:47:31] [debug] #2 0001f284 in public Streamer_OnPlayerDisconnect (0, 1) from v2_VIPBackup.amx
[17:47:31] [debug] #3 native CallLocalFunction () from samp-server.exe
[17:47:31] [debug] #4 00017264 in public Itter_OnPlayerDisconnect (0, 1) from v2_VIPBackup.amx
[17:47:31] [debug] #5 000166d8 in public SSCANF_OnPlayerDisconnect (0, 1) from v2_VIPBackup.amx
[17:47:31] [debug] #6 00010270 in ?? (0, 1) from v2_VIPBackup.amx
[17:47:31] [debug] #7 000059f8 in public OnPlayerDisconnect (0, 1) from v2_VIPBackup.amx
here my command script
pawn Code:
COMMAND:settempvip(playerid, params[])
{
        if(pInfo[playerid][Adminlevel] <= 5) return SendClientMessage(playerid, -1, ""COL_BLUE"AdmCmd: You don't have the privilege to use this command.");
        new
            string[1000],pplayerid,level,day,date[6],ts_unvip = gettime() + (day * 86400);
        if(sscanf(params, "uii", pplayerid, level, day)) return SCM(playerid, COLOR_RED, ""COL_CYAN"Info: "COL_WHITE"/Setvip (Playerid) (Viplevel) (Day)");
        if(pplayerid == IPI) return SCM(playerid, -1, ""COL_RED"Error: "COL_WHITE"Wrong Playerid.");
        if(level > 3 || level < 0) return SCM(playerid, COLOR_RED, ""COL_RED"Error: "COL_WHITE"Wrong Level Id.");
        pInfo[pplayerid][VIPlevel] = level;
        pInfo[pplayerid][waktu] = ts_unvip;
        //DateToTimestamp();
        TimestampToDate(ts_unvip,date[0],date[1],date[2],date[3],date[4],date[5],0);
        format(string,sizeof(string),"- Your VIP Valid Until: %02d/%02d/%02d %02d:%02d:%02d (%d day(s))",date[2],date[1],date[0],date[3],date[4],date[5],day);
        SendClientMessage(pplayerid,-1,string);
        format(string,sizeof(string),""COL_BLUE"AdmCmd: Administrator \"%s (%d)\" has set your VIP level to ( Level: %d ).",GetName(playerid),playerid,level);
        SCM(pplayerid,-1,string);
        format(string,sizeof(string),""COL_BLUE"AdmCmd: You have set player \"%s (%d)\" VIP level to (Level: %d).",GetName(pplayerid),pplayerid,level);
        SCM(playerid,-1,string);
        return 1;
}
this is onplayerdisconnect script
pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
    if(Team[playerid]==ASIA)
    { teamplayers[ASIA]--; }
    else if(Team[playerid]==AFRICA)
    { teamplayers[AFRICA]--; }
    else if(Team[playerid]==AMERICA)
    { teamplayers[AMERICA]--; }
    else if(Team[playerid]==EUROPE)
    { teamplayers[EUROPE]--; }
    else if(Team[playerid]==AUSTRALIA)
    { teamplayers[AUSTRALIA]--; }
    else if(Team[playerid]==MERCENARY)
    { teamplayers[MERCENARY]--; }

    if(fexist(Path(playerid)))
    {
        new INI:file = INI_Open(Path(playerid));
        INI_SetTag(file,"Player's Data");
        INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]);
        INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);
        INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
        INI_WriteInt(file,"Scores",GetPlayerScore(playerid));
        INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
        INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
        INI_WriteInt(file,"Time-Seconds",pInfo[playerid][Seconds]);
        INI_WriteInt(file,"Time-Minutes",pInfo[playerid][Minutes]);
        INI_WriteInt(file,"Time-Hours",pInfo[playerid][Hours]);
        INI_WriteInt(file,"Banned",pInfo[playerid][Banned]);
        INI_WriteInt(file,"waktu",pInfo[playerid][waktu]);
        INI_WriteInt(file,"Warlord-I",pInfo[playerid][Warlord1]);
        INI_WriteInt(file,"Warlord-II",pInfo[playerid][Warlord2]);
        INI_WriteInt(file,"Warlord-III",pInfo[playerid][Warlord3]);
        INI_Close(file);
    }

    new pFile[35];
    format(pFile, 35, Player_File, GetName(playerid));
    new
    INI:UserFile = INI_Open(pFile);
    INI_WriteInt(UserFile, "Admin", P_Data[playerid][pAdmin]);
    INI_WriteInt(UserFile, "Money", GetPlayerMoney(playerid));
    INI_WriteInt(UserFile, "Score", GetPlayerScore(playerid));
    INI_WriteInt(UserFile, "Skin", P_Data[playerid][pSkin]);
    INI_WriteInt(UserFile, "Warn", P_Data[playerid][pWarn]);
    INI_Close(UserFile);

    if(fexist(Path_2(playerid)))
    {
        new INI:file = INI_Open(Path_2(playerid));
        INI_SetTag(file,"Player Car-Saver Data");

        INI_WriteFloat(file,"(1)Postion-PosX",PositionSaver[playerid][PosX1]);
        INI_WriteFloat(file,"(1)Postion-PosY",PositionSaver[playerid][PosY1]);
        INI_WriteFloat(file,"(1)Postion-PosZ",PositionSaver[playerid][PosZ1]);
        INI_WriteInt(file,"(1)Interior",PositionSaver[playerid][Interior1]);

        INI_WriteFloat(file,"(2)Postion-PosX",PositionSaver[playerid][PosX2]);
        INI_WriteFloat(file,"(2)Postion-PosY",PositionSaver[playerid][PosY2]);
        INI_WriteFloat(file,"(2)Postion-PosZ",PositionSaver[playerid][PosZ2]);
        INI_WriteInt(file,"(2)Interior",PositionSaver[playerid][Interior2]);

        INI_WriteFloat(file,"(3)Postion-PosX",PositionSaver[playerid][PosX3]);
        INI_WriteFloat(file,"(3)Postion-PosY",PositionSaver[playerid][PosY3]);
        INI_WriteFloat(file,"(3)Postion-PosZ",PositionSaver[playerid][PosZ3]);
        INI_WriteInt(file,"(3)Interior",PositionSaver[playerid][Interior3]);

        INI_WriteFloat(file,"(4)Postion-PosX",PositionSaver[playerid][PosX4]);
        INI_WriteFloat(file,"(4)Postion-PosY",PositionSaver[playerid][PosY4]);
        INI_WriteFloat(file,"(4)Postion-PosZ",PositionSaver[playerid][PosZ4]);
        INI_WriteInt(file,"(4)Interior",PositionSaver[playerid][Interior4]);

        INI_WriteFloat(file,"(5)Postion-PosX",PositionSaver[playerid][PosX5]);
        INI_WriteFloat(file,"(5)Postion-PosY",PositionSaver[playerid][PosY5]);
        INI_WriteFloat(file,"(5)Postion-PosZ",PositionSaver[playerid][PosZ5]);
        INI_WriteInt(file,"(5)Interior",PositionSaver[playerid][Interior5]);

        INI_Close(file);
    }
    KillTimer(gAirdropTimer[playerid]);
    RemovePlayerAttachedObject(playerid, 0);
    DestroyDynamicCP(cekpoint[playerid][ASIA]);
    DestroyDynamicCP(cekpoint[playerid][AFRICA]);
    DestroyDynamicCP(cekpoint[playerid][AMERICA]);
    DestroyDynamicCP(cekpoint[playerid][EUROPE]);
    DestroyDynamicCP(cekpoint[playerid][AUSTRALIA]);
    return 1;
}
i dont know whats wrong in my script pls help
Reply
#2

Are you sure that crashdetect did not print more information before "[debug] #0 00000038 in public SAT_OnPlayerDisconnect () from v2_VIPBackup.amx" line? From your current code in OnPlayerDisconnect, the only thing I can think of is run time error 6 that used to be a problem with YSI 3.1 version. So if you use this version, update to YSI 4: http://forum.sa-mp.com/showpost.php?...99&postcount=2

On another note, to get more detailed logs from crashdetect plugin you will need to compile your scripts with debug info. Create a file called pawn.cfg in pawno folder and write -d3 in it. Re-compile your scripts and run the server to test it. After disconnecting and getting an output from crashdetect plugin, post your server log.
Reply
#3

opss sry
ok ill edit
here is the error
pawn Code:
[debug] Run time error 6: "Invalid instruction"
[17:47:31] [debug]  Unknown opcode 0x2c66eb8 at address 0x00000038
[17:47:31] [debug] AMX backtrace:
[17:47:31] [debug] #0 00000038 in public SAT_OnPlayerDisconnect () from v2_VIPBackup.amx
[17:47:31] [debug] #1 native CallLocalFunction () from samp-server.exe
[17:47:31] [debug] #2 0001f284 in public Streamer_OnPlayerDisconnect (0, 1) from v2_VIPBackup.amx
[17:47:31] [debug] #3 native CallLocalFunction () from samp-server.exe
[17:47:31] [debug] #4 00017264 in public Itter_OnPlayerDisconnect (0, 1) from v2_VIPBackup.amx
[17:47:31] [debug] #5 000166d8 in public SSCANF_OnPlayerDisconnect (0, 1) from v2_VIPBackup.amx
[17:47:31] [debug] #6 00010270 in ?? (0, 1) from v2_VIPBackup.amx
[17:47:31] [debug] #7 000059f8 in public OnPlayerDisconnect (0, 1) from v2_VIPBackup.amx
edit for more info after use -d3
pawn Code:
[18:26:45] [connection] 127.0.0.1:4415 requests connection cookie.
[18:26:46] [connection] incoming connection: 127.0.0.1:4415 id: 0
[18:26:46] [join] Tritonal has joined the server (0:127.0.0.1)
[18:27:02] [debug] Run time error 6: "Invalid instruction"
[18:27:02] [debug]  Unknown opcode 0x202c6 at address 0x00000032
[18:27:02] [debug] AMX backtrace:
[18:27:02] [debug] #0 00000032 in public SAT_OnPlayerDisconnect () at <unknown file>:0
[18:27:02] [debug] #1 native CallLocalFunction () from samp-server.exe
[18:27:02] [debug] #2 00025fc0 in public Streamer_OnPlayerDisconnect (playerid=0, reason=1) at C:\Documents and Settings\Admin\My Documents\Tritonal Project\COD6 (Windows)\pawno\include\SmartAFKTabbing.inc:100
[18:27:02] [debug] #3 native CallLocalFunction () from samp-server.exe
[18:27:02] [debug] #4 0001b6f0 in public Itter_OnPlayerDisconnect (... <2 arguments>)  at C:\Documents and Settings\Admin\My Documents\Tritonal Project\COD6 (Windows)\pawno\include\streamer.inc:361
[18:27:02] [debug] #5 0001a93c in public SSCANF_OnPlayerDisconnect (playerid=0, reason=1) at C:\Documents and Settings\Admin\My Documents\Tritonal Project\COD6 (Windows)\pawno\include\YSI\y_iterate.inc:900
[18:27:02] [debug] #6 00013554 in ?? (... <2 arguments>) at C:\Documents and Settings\Admin\My Documents\Tritonal Project\COD6 (Windows)\pawno\include\sscanf2.inc:229
[18:27:02] [debug] #7 00006a1c in public OnPlayerDisconnect (playerid=0, reason=1) at C:\Documents and Settings\Admin\My Documents\Tritonal Project\COD6 (Windows)\pawno\include\YSI\internal\y_dohooks.inc:648
[18:27:02] [part] Tritonal has left the server (0:1)
Reply
#4

Okay, it is the run time error I mentioned but you did not answer if you are using YSI 3.1 version (which you probably are). I've seen it a couple of times and updating to YSI 4 fixed the problem.
Reply
#5

ok i'll try to update my YSI
Reply
#6

i already update my YSI but why the server cant load player stats

sry for my bad english
Reply
#7

As far as I am aware updating only (for y_ini at least) wouldn't affect the script. Can you debug it to see if the public function specified in INI_Parsefile gets called?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)