OnPlayerDisconnect
#1

Hi SA-MP.com, I have small problem in my GM:
pawn Код:
[02:36:36] [debug] Run time error 4: "Array index out of bounds"
[02:36:36] [debug]  Accessing element at negative index -1
[02:36:36] [debug] AMX backtrace:
[02:36:36] [debug] #0 00016c00 in INI_Close (INI:file=-1) at C:\Users\Administrator\Desktop\Stunt Field League - Build 1\pawno\include\YSI\y_ini.inc:746
[02:36:36] [debug] #1 0001b4c4 in public S@@_OnPlayerDisconnect (playerid=0, reason=1) at C:\Users\Administrator\Desktop\Stunt Field League - Build 1\gamemodes\SFL.pwn:140
[02:36:36] [debug] #2 0000dbf4 in public Streamer_OnPlayerDisconnect (playerid=0, reason=1) at C:\Users\Administrator\Desktop\Stunt Field League - Build 1\pawno\include\YSI\y_hooks/impl.inc:661
[02:36:36] [debug] #3 native CallLocalFunction () [00471e90] from samp-server.exe
[02:36:36] [debug] #4 00007a98 in Debug_Print0 (... <2 variable arguments>) at C:\Users\Administrator\Desktop\Stunt Field League - Build 1\pawno\include\streamer.inc:361
[02:36:36] [debug] #5 00000354 in Debug_Print0 (... <2 variable arguments>) at C:\Users\Administrator\Desktop\Stunt Field League - Build 1\pawno\include\sscanf2.inc:229
Linie 140;
pawn Код:
INI_Close(File);
This is all my CALLBACK
pawn Код:
OnPlayerDisconnect ( playerid , reason )
{

                                                                                                                    new string [ 128 ] ;
                                                                                                                    switch ( reason )
                                                                                                                    {
                                                                                                                        case 0: format(string, 128, "{FFFF00}%s {008000}a iesit de pe server {FFFFFF}(Timeout)", P_NAME( playerid )) ;
                                                                                                                        case 1: format(string, 128, "{FFFF00}%s {008000}a iesit de pe server {FFFFFF}(Leaving)", P_NAME( playerid ));
                                                                                                                        case 2: format(string, 128, "{FFFF00}%s {008000}a iesit de pe server {FFFFFF}(Kicked/Banned)", P_NAME( playerid ));
                                                                                                                    }
                                                                                                                    SCMTA ( COLOR_WHITE , string );

                                                                                                                    if(playerid != INVALID_PLAYER_ID)
                                                                                                                    {
                                                                                                                    new INI:File = INI_Open(UserPath(playerid));
                                                                                                                    INI_SetTag(File,"data");
                                                                                                                    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
                                                                                                                    INI_WriteInt(File,"Admin",P_INFO[playerid][Level]);
                                                                                                                    INI_WriteInt(File,"V.I.P",P_INFO[playerid][Vip]);
                                                                                                                    INI_WriteInt(File,"Kills",P_INFO[playerid][Kills]);
                                                                                                                    INI_WriteInt(File,"Deaths",P_INFO[playerid][Deaths]);
                                                                                                                    INI_Close(File);                                                            //here
                                                                                                                    }
                                                                                                                    return ( 1 );
}
What is the problem??
What i missed, i have all in myscriptfiles.. No ERRORS, NO WARNS
Reply
#2

sounds like INI_Open failed to open because file doesn't exist.

can you show me the stock of UserPath() ?
Reply
#3

Quote:
Originally Posted by kirollos
Посмотреть сообщение
sounds like INI_Open failed to open because file doesn't exist.

can you show me the stock of UserPath() ?
Sure :
pawn Код:
stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
Reply
#4

Quote:
Originally Posted by DAVIDXP
Посмотреть сообщение
Sure :
pawn Код:
stock UserPath(playerid)
{
    new string[128],playername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,playername,sizeof(playername));
    format(string,sizeof(string),PATH,playername);
    return string;
}
show me the #define of PATH & are you sure that the file exists?
Reply
#5

Quote:
Originally Posted by kirollos
Посмотреть сообщение
show me the #define of PATH & are you sure that the file exists?
Exists:
pawn Код:
#define PATH "/SFL/users/%s.ini"
Reply
#6

try debugging it @ OnPlayerDisconnect by doing
pawn Код:
printf("UserPath: %s", UserPath(playerid));
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)