[Ajuda] OnPlayerConnect
#1

Olб.
Bom depois de uns tempos pra cб fui notando umas coisas, e notei uma coisa muito estranha. Que a callback OnPlayerConnect nгo й executada em scripts externos (FS), apenas no Gamemode. O que pode ocasionar isso? Algum plugin ou include com um hook mal feito?

Fiz atй um FS pra detectar se estб realmente dando debug mas nгo mostra.

pawn Код:
#include <a_samp>

public OnFilterScriptInit()
{
    print("DEBUG OnFilterScriptInit");
    return 1;
}

public OnFilterScriptExit()
{
    print("DEBUG OnFilterScriptInit");
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    printf("DEBUG OnPlayerRequestClass(%i,%i)", playerid, classid);
    return 1;
}

public OnPlayerConnect(playerid)
{
    printf("DEBUG OnPlayerConnect(%i)", playerid);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    printf("DEBUG OnPlayerDisconnect(%i, %i)", playerid, reason);
    return 1;
}
E no LOG:
Код:
[00:54:48] Incoming connection: *.*.*.*:53559
[00:54:49] [join] NicK has joined the server (0:*.*.*.*)
[00:55:03] DEBUG OnPlayerRequestClass(0,0)
[00:55:08] DEBUG OnPlayerRequestClass(0,1)
[00:55:09] DEBUG OnPlayerRequestClass(0,2)
[00:55:10] DEBUG OnPlayerRequestClass(0,3)
[00:55:10] DEBUG OnPlayerRequestClass(0,4)
[00:55:11] DEBUG OnPlayerRequestClass(0,5)
[00:55:11] DEBUG OnPlayerRequestClass(0,6)
[00:55:11] DEBUG OnPlayerRequestClass(0,7)
[00:55:11] DEBUG OnPlayerRequestClass(0,8)
[00:55:12] DEBUG OnPlayerRequestClass(0,9)
[00:55:12] DEBUG OnPlayerRequestClass(0,10)
[00:55:12] DEBUG OnPlayerRequestClass(0,11)
[00:55:12] DEBUG OnPlayerRequestClass(0,12)
[00:55:12] DEBUG OnPlayerRequestClass(0,13)
[00:55:13] DEBUG OnPlayerRequestClass(0,14)
[00:55:13] DEBUG OnPlayerRequestClass(0,16)
[00:55:13] DEBUG OnPlayerRequestClass(0,17)
[00:55:13] DEBUG OnPlayerRequestClass(0,18)
[00:55:13] DEBUG OnPlayerRequestClass(0,15)
[00:55:14] DEBUG OnPlayerRequestClass(0,19)
[00:55:14] DEBUG OnPlayerRequestClass(0,20)
[00:55:14] DEBUG OnPlayerRequestClass(0,21)
[00:55:14] DEBUG OnPlayerRequestClass(0,22)
[00:55:14] DEBUG OnPlayerRequestClass(0,23)
[00:55:15] DEBUG OnPlayerRequestClass(0,24)
[00:55:15] DEBUG OnPlayerRequestClass(0,25)
[00:55:17] DEBUG OnPlayerRequestClass(0,26)
[00:55:19] DEBUG OnPlayerRequestClass(0,25)
[00:55:19] DEBUG OnPlayerRequestClass(0,24)
[00:55:19] DEBUG OnPlayerRequestClass(0,23)
[00:55:19] DEBUG OnPlayerRequestClass(0,22)
[00:55:19] DEBUG OnPlayerRequestClass(0,21)
[00:55:20] DEBUG OnPlayerRequestClass(0,20)
[00:55:20] DEBUG OnPlayerRequestClass(0,19)
[00:55:20] DEBUG OnPlayerRequestClass(0,18)
[00:55:20] DEBUG OnPlayerRequestClass(0,17)
[00:59:11] [part] NicK has left the server (0:2)
Nem o OnPlayerConnect nem o OnPlayerDisconnect foram chamados...
Plugins que utilizo: sscanf (2.8.1) ,streamer (2.7.4) e mysql (R39-2) & crashdetect
Includes: (referentes aos plugins..), zcmd, dutils, mSelection, mailer, crashdetect

Tambйm usando o plugin crashdetect, nada foi detectado. Alguma dica do que pode ser ai galera?
Reply
#2

Acredito que tem algum hook mal feito fiz o mesmo teste aqui em um script limpo somente usando a include a_samp, carregando somente um fs para fazer o desbug e nenhum plugin, e a callback OnPlayerConnect e OnPlayerDisconnect foram chamadas.
Reply
#3

Realmente me parece que й algum hook mal feito, o maior problema й para identifica-lo. Estou quase tendo certeza que seja o sscanf, mas vou continuar procurando.

#Edit
Usando uma nativa do crashdetect, consegui obter informaзхes, fiz algumas alteraзхes mas ainda nгo surtem efeito.
Assim voltei tudo como antes, usando AmxBacktrace e NativeBacktrace

Код:
[02:04:22] Incoming connection: 0.0.0.0:61641
[02:04:23] [join] NicK has joined the server (0:0.0.0.0)
[02:04:23] [debug] AMX backtrace:
[02:04:23] [debug] #0 native PrintAmxBacktrace () [f66aaa40] from crashdetect.so
[02:04:23] [debug] #1 0000de6c in public MP_OPC (0x00000000) from BMT.amx
[02:04:23] [debug] #2 native CallLocalFunction () [080dce40] from bmtsvr
[02:04:23] [debug] #3 00008f9c in public SSCANF_OnPlayerConnect (0x00000000) from BMT.amx
[02:04:23] [debug] #4 native CallLocalFunction () [080dce40] from bmtsvr
[02:04:23] [debug] #5 00000688 in public OnPlayerConnect (0x00000000) from BMT.amx
[02:04:23] [debug] Native backtrace:
[02:04:23] [debug] #0 f66ad09b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[02:04:23] [debug] #1 f66a82d2 in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[02:04:23] [debug] #2 f66a8ebc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[02:04:23] [debug] #3 f66aaa2e in ?? () from plugins/crashdetect.so
[02:04:23] [debug] #4 08094054 in ?? () from ./bmtsvr
[02:04:23] [debug] #5 f62716e4 in ?? () from plugins/streamer.so
[02:04:23] [debug] #6 f66a5b9c in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[02:04:23] [debug] #7 f66abd38 in ?? () from plugins/crashdetect.so
[02:04:23] [debug] #8 f66b21f8 in amx_Exec () from plugins/crashdetect.so
[02:04:23] [debug] #9 f66a8218 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[02:04:23] [debug] #10 f66abaa9 in ?? () from plugins/crashdetect.so
[02:04:23] [debug] #11 f6272370 in ?? () from plugins/streamer.so
[02:04:23] [debug] #12 080dd0e2 in ?? () from ./bmtsvr
[02:04:23] [debug] #13 08094054 in ?? () from ./bmtsvr
[02:04:23] [debug] #14 f62716e4 in ?? () from plugins/streamer.so
[02:04:23] [debug] #15 f66a5b9c in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[02:04:23] [debug] #16 f66abd38 in ?? () from plugins/crashdetect.so
[02:04:23] [debug] #17 f66b21f8 in amx_Exec () from plugins/crashdetect.so
[02:04:23] [debug] #18 f66a8218 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[02:04:23] [debug] #19 f66abaa9 in ?? () from plugins/crashdetect.so
[02:04:23] [debug] #20 f6272370 in ?? () from plugins/streamer.so
[02:04:23] [debug] #21 080dd0e2 in ?? () from ./bmtsvr
[02:04:23] [debug] #22 08094054 in ?? () from ./bmtsvr
[02:04:23] [debug] #23 f62716e4 in ?? () from plugins/streamer.so
[02:04:23] [debug] #24 f66a5b9c in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[02:04:23] [debug] #25 f66abd38 in ?? () from plugins/crashdetect.so
[02:04:23] [debug] #26 f66b21f8 in amx_Exec () from plugins/crashdetect.so
[02:04:23] [debug] #27 f66a8218 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[02:04:23] [debug] #28 f66abaa9 in ?? () from plugins/crashdetect.so
[02:04:23] [debug] #29 f6272370 in ?? () from plugins/streamer.so
[02:04:23] [debug] #30 080a3ce9 in ?? () from ./bmtsvr
[02:04:23] [debug] #31 080ce7df in ?? () from ./bmtsvr
[02:04:23] [debug] #32 080b35e1 in ?? () from ./bmtsvr
[02:04:23] [debug] #33 08071b38 in ?? () from ./bmtsvr
[02:04:23] [debug] #34 08071c32 in ?? () from ./bmtsvr
[02:04:23] [debug] #35 0807bb80 in ?? () from ./bmtsvr
[02:04:23] [debug] #36 080ad3bd in ?? () from ./bmtsvr
[02:04:23] [debug] #37 080ad562 in ?? () from ./bmtsvr
[02:04:23] [debug] #38 080a88ce in ?? () from ./bmtsvr
[02:04:23] [debug] #39 f7493933 in __libc_start_main () from /lib/libc.so.6
[02:04:43] DEBUG OnPlayerRequestClass(0,0)
[02:04:43] [debug] AMX backtrace:
[02:04:43] [debug] #0 native PrintAmxBacktrace () [f66aaa40] from crashdetect.so
[02:04:43] [debug] #1 0000f280 in public SSCANF_OnPlayerDisconnect (0x00000000, 0x00000002) from BMT.amx
[02:04:43] [debug] #2 native CallLocalFunction () [080dce40] from bmtsvr
[02:04:43] [debug] #3 000006e0 in public OnPlayerDisconnect (0x00000000, 0x00000002) from BMT.amx
[02:04:43] [debug] #4 native Kick () [080d4f20] from bmtsvr
[02:04:43] [debug] #5 0000ba40 in public Kickar (0x00000000) from BMT.amx
[02:04:43] [debug] Native backtrace:
[02:04:43] [debug] #0 f66ad09b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[02:04:43] [debug] #1 f66a82d2 in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[02:04:43] [debug] #2 f66a8ebc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[02:04:43] [debug] #3 f66aaa2e in ?? () from plugins/crashdetect.so
[02:04:43] [debug] #4 08094054 in ?? () from ./bmtsvr
[02:04:43] [debug] #5 f62716e4 in ?? () from plugins/streamer.so
[02:04:43] [debug] #6 f66a5b9c in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[02:04:43] [debug] #7 f66abd38 in ?? () from plugins/crashdetect.so
[02:04:43] [debug] #8 f66b21f8 in amx_Exec () from plugins/crashdetect.so
[02:04:43] [debug] #9 f66a8218 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[02:04:43] [debug] #10 f66abaa9 in ?? () from plugins/crashdetect.so
[02:04:43] [debug] #11 f6272370 in ?? () from plugins/streamer.so
[02:04:43] [debug] #12 080dd0e2 in ?? () from ./bmtsvr
[02:04:43] [debug] #13 08094054 in ?? () from ./bmtsvr
[02:04:43] [debug] #14 f62716e4 in ?? () from plugins/streamer.so
[02:04:43] [debug] #15 f66a5b9c in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[02:04:43] [debug] #16 f66abd38 in ?? () from plugins/crashdetect.so
[02:04:43] [debug] #17 f66b21f8 in amx_Exec () from plugins/crashdetect.so
[02:04:43] [debug] #18 f66a8218 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[02:04:43] [debug] #19 f66abaa9 in ?? () from plugins/crashdetect.so
[02:04:43] [debug] #20 f6272370 in ?? () from plugins/streamer.so
[02:04:43] [debug] #21 080a3d5a in ?? () from ./bmtsvr
[02:04:43] [debug] #22 080ce911 in ?? () from ./bmtsvr
[02:04:43] [debug] #23 080acf1b in ?? () from ./bmtsvr
[02:04:43] [debug] #24 080d4f3e in ?? () from ./bmtsvr
[02:04:43] [debug] #25 08094054 in ?? () from ./bmtsvr
[02:04:43] [debug] #26 f62716e4 in ?? () from plugins/streamer.so
[02:04:43] [debug] #27 f66a5b9c in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[02:04:43] [debug] #28 f66abd38 in ?? () from plugins/crashdetect.so
[02:04:43] [debug] #29 f66b21f8 in amx_Exec () from plugins/crashdetect.so
[02:04:43] [debug] #30 f66a8218 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[02:04:43] [debug] #31 f66abaa9 in ?? () from plugins/crashdetect.so
[02:04:43] [debug] #32 f6272370 in ?? () from plugins/streamer.so
[02:04:43] [debug] #33 080e6995 in ?? () from ./bmtsvr
[02:04:43] [debug] #34 080ad69b in ?? () from ./bmtsvr
[02:04:43] [debug] #35 080a88ce in ?? () from ./bmtsvr
[02:04:43] [debug] #36 f7493933 in __libc_start_main () from /lib/libc.so.6
[02:04:43] [part] NicK has left the server (0:2)
Reply
#4

Tente parar de usar alguma include ou plugin e faзa o teste vai fazendo isto que talvez vocк encontre qual o plugin ou include que й o problema.

Veja tambйm se da o problema criando um novo script um FS e Gm e carregando as mesmas includes e plugins se der o mesmo problema й mais fбcil de achar qual include ou plugin que й o problema.

Outra alternativa й a seguinte:

GM:
pawn Код:
public OnPlayerConnect(playerid)
{
    CallRemoteFunction("Gambiarra_OnPlayerConnect", "d", playerid);
    // outra maneira
    CallRemoteFunction("OnPlayerConnect", "d", playerid);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    CallRemoteFunction("Gambiarra_OnPlayerDisconnect", "dd", playerid, reason);
    // outra maneira
    CallRemoteFunction("OnPlayerDisconnect", "dd", playerid, reason);
    return 1;
}
FS:
pawn Код:
forward Gambiarra_OnPlayerConnect(id);

forward Gambiarra_OnPlayerDisconnect(id, r);

public Gambiarra_OnPlayerConnect(id) return OnPlayerConnect(id);

public Gambiarra_OnPlayerDisconnect(id, r) return OnPlayerDisconnect(id, r);

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}
Nгo sei se vai funcionar.
Reply
#5

Quote:
Originally Posted by MultiKill
Посмотреть сообщение
Tente parar de usar alguma include ou plugin e faзa o teste vai fazendo isto que talvez vocк encontre qual o plugin ou include que й o problema.

Veja tambйm se da o problema criando um novo script um FS e Gm e carregando as mesmas includes e plugins se der o mesmo problema й mais fбcil de achar qual include ou plugin que й o problema.

Outra alternativa й a seguinte:

GM:
pawn Код:
public OnPlayerConnect(playerid)
{
    CallRemoteFunction("Gambiarra_OnPlayerConnect", "d", playerid);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    CallRemoteFunction("Gambiarra_OnPlayerDisconnect", "dd", playerid, reason);
    return 1;
}
FS:
pawn Код:
forward Gambiarra_OnPlayerConnect(id);

forward Gambiarra_OnPlayerDisconnect(id, r);

public Gambiarra_OnPlayerConnect(id) return OnPlayerConnect(id);

public Gambiarra_OnPlayerDisconnect(id, r) return OnPlayerDisconnect(id, r);

public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}
Nгo sei se vai funcionar.
De compilar com as mesmas includes, tambйm jб fiz.
Acho que vou ter que optar pelo mйtodo das gambiarras '-'

Vou fazer alguns testes aqui com as gambiarras. O mais engraзado que nгo era pra isso acontecer.

#Edit
Com as gambiarras atй funcionam.
pawn Код:
forward BMT_OnPlayerConnect(playerid);
public BMT_OnPlayerConnect(playerid) return CallLocalFunction("OnPlayerConnect", "i", playerid);
forward BMT_OnPlayerDisconnect(playerid, reason);
public BMT_OnPlayerDisconnect(playerid, reason) return CallLocalFunction("OnPlayerDisconnect", "ii", playerid, reason);
public OnPlayerConnect(playerid)
{
    printf("DEBUG OnPlayerConnect(%i)", playerid);
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    printf("DEBUG OnPlayerDisconnect(%i, %i)", playerid, reason);
    return 1;
}
LOG
Код:
[02:18:17] Incoming connection: 177.87.242.106:52721
[02:18:17] [join] NicK has joined the server (0:177.87.242.106)
[02:18:17] DEBUG OnPlayerConnect(0) --------
[02:18:17] [debug] AMX backtrace:
[02:18:17] [debug] #0 native PrintAmxBacktrace () [f62f0a40] from crashdetect.so
[02:18:17] [debug] #1 0000dea0 in public MP_OPC (0x00000000) from BMT.amx
[02:18:17] [debug] #2 native CallLocalFunction () [080dce40] from bmtsvr
[02:18:17] [debug] #3 00008f9c in public SSCANF_OnPlayerConnect (0x00000000) from BMT.amx
[02:18:17] [debug] #4 native CallLocalFunction () [080dce40] from bmtsvr
[02:18:17] [debug] #5 00000688 in public OnPlayerConnect (0x00000000) from BMT.amx
[02:18:29] DEBUG OnPlayerRequestClass(0,0)
[02:19:40] DEBUG OnPlayerDisconnect(0, 2) ------
[02:19:40] [debug] AMX backtrace:
[02:19:40] [debug] #0 native PrintAmxBacktrace () [f62f0a40] from crashdetect.so
[02:19:40] [debug] #1 0000f2d4 in public SSCANF_OnPlayerDisconnect (0x00000000, 0x00000002) from BMT.amx
[02:19:40] [debug] #2 native CallLocalFunction () [080dce40] from bmtsvr
[02:19:40] [debug] #3 000006e0 in public OnPlayerDisconnect (0x00000000, 0x00000002) from BMT.amx
[02:19:40] [debug] #4 native Kick () [080d4f20] from bmtsvr
[02:19:40] [debug] #5 0000ba40 in public Kickar (0x00000000) from BMT.amx
[02:19:40] [part] NicK has left the server (0:2)
Infelizmente vai ter que ser o mйtodo que vou ter que utilizar... Obrigado pela dica.


#Edit
Ah, se usar RemoteFunction em uma funзгo jб definida no gamemode (OnPlayerConnect) dб loop infinito.. Assim tem que usar em outra, no caso uma definida diferente...
Reply
#6

Public MP_OPC parece ser aн o problema posta aн o core dela. E o hoje relativo a mesma
Reply
#7

Код:
[02:18:17]
[debug] #0 native PrintAmxBacktrace () [f62f0a40] from crashdetect.so
[02:18:17] [debug] #1 0000dea0 in public MP_OPC (0x00000000) from BMT.amx
[02:18:17] [debug] #2 native CallLocalFunction () [080dce40] from bmtsvr
[02:18:17] [debug] #3 00008f9c in public SSCANF_OnPlayerConnect (0x00000000) from BMT.amx
[02:18:17] [debug] #4 native CallLocalFunction () [080dce40] from bmtsvr
[02:18:17] [debug] #5 00000688 in public OnPlayerConnect (0x00000000) from BMT.amx
Reply
#8

Quote:
Originally Posted by PT
Посмотреть сообщение
Public MP_OPC parece ser aн o problema posta aн o core dela. E o hoje relativo a mesma
Ela й do mSelection..
pawn Код:
public OnPlayerConnect(playerid)
{
    // Init all of the textdraw related globals
    gHeaderTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gBackgroundTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gCurrentPageTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gNextButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gPrevButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gCancelButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
   
    for(new x=0; x < mS_SELECTION_ITEMS; x++) {
        gSelectionItems[playerid][x] = PlayerText:INVALID_TEXT_DRAW;
    }
   
    gItemAt[playerid] = 0;
   
    return CallLocalFunction("MP_OPC", "i", playerid);
}

#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect MP_OPC

forward MP_OPC(playerid);
Reply
#9

Tente com o ALS 7 Hook:

pawn Код:
public OnPlayerConnect(playerid)
{
    // Init all of the textdraw related globals
    gHeaderTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gBackgroundTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gCurrentPageTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gNextButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gPrevButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
    gCancelButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
   
    for(new x=0; x < mS_SELECTION_ITEMS; x++) {
        gSelectionItems[playerid][x] = PlayerText:INVALID_TEXT_DRAW;
    }
   
    gItemAt[playerid] = 0;

    #if defined MP_OPC
        MP_OPC(playerid);
    #endif
    return 1;
}
#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect MP_OPC
#if defined MP_OPC
    forward MP_OPC(playerid);
#endif
Reply
#10

Interessante, a callback OnPlayerConnect de FilterScripts nгo й chamada ? Nunca tinha parado pra analisar isso, ou talvez esse problema (se for mesmo), tenha vindo a ocorrer agora nas ultimas versхes...

Vou fazer uns testes com isso tambйm, quando chegar em casa...

Continue compartilhando os resultados que vocкs estгo obtendo ai, a respeito desse problema...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)