OnPlayerConnect won't work when sscanf is used
#1

Some days ago, I learned a little bit about the include from ******, sscanf.

But I was getting angry with a bug on the OnPlayerConnect callback, since It doesn't get called when I use sscanf..

I was pretty sure that I read someone saying that the OnPlayerConnect was fixed, but, from the 2.8.2 downloads, nothing worked.

My OnPlayerConnect works normally if I remove the sscanf from my gamemode, and the sscanf function is working normally too.
Reply
#2

can you show us the code,please !?
Reply
#3

There's nothing wrong with my code, believe me, if I remove the sscanf include line, everythin works normally, but, If you still want to see It, there It is:

PHP код:
public OnPlayerConnect(playerid)
{
    new 
allMsg[MAX_PLAYER_NAME+180], playerAccount[MAX_PLAYER_NAME+35];
    
format(allMsg,sizeof allMsg,"{909090}[INFO]: {FF0000}%s{909090} entrou no servidor.",GetPlayerName(playerid));
    
format(playerAccount,sizeof playerAccount,"/ApocaSAMP/Contas/%s.json",GetPlayerName(playerid));
    if(
fexist(playerAccount))
        
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD"{909090}Seja bem-vindo de volta - Apoca EPOCH",
            
"{909090}Olб, seja bem-vindo de volta, por favor, digite sua senha logo abaixo.\n\n\
            {FF0000}OBS:{909090}Se esta conta nгo й sua, por favor, saia e use outro nome."
"Logar""Sair");
    else
        
ShowPlayerDialog(playeridDIALOG_REGISTRARDIALOG_STYLE_PASSWORD"{909090}Seja bem-vindo - Apoca EPOCH",
            
"{909090}Olб, seja bem-vindo ao servidor, por favor, digite uma senha abaixo para\n\
            {909090}registrar uma conta gratuitamente!\n\n\
            {FF0000}OBS:{909090}Use letras e nъmeros e deixe sua senha maior que 5 caracteres e menor que 20 caracteres."
"Registrar""Sair");
    
SendClientMessageToAll(-1allMsg);
    return 
1;

It's portuguese, and I'm using the latest version available (I think), 2.8.2.
Reply
#4

if the problem not with your code then ill give you my version of sscanf it works well for me may work for you aswel

http://www.solidfiles.com/d/94e2fdd5d5/
Код:
#include <sscanf2>
i am not sure if this work just trying to offer my help
Reply
#5

Thanks MeCom, I'll try It when I get more time.

Anyway, did everyone ever faced this problem before ?
OBS: I'm not using any filterscript.
Reply
#6

You have redefined GetPlayerName which is the probable cause of this problem. The sscanf include uses GetPlayerName to establish its internal list of connected players for use with the "u" specifier.
Reply
#7

Damn, but what if I hook GetPlayerName inside the include, It will work normally ?

Anyway, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)