SA-MP Forums Archive
[AJUDA]Sistema de Login com um probleminha... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [AJUDA]Sistema de Login com um probleminha... (/showthread.php?tid=331514)



[AJUDA]Sistema de Login com um probleminha... - fojo_ - 05.04.2012

pawn Код:
#include <DOF2>

#define DIALOG_REGISTER 2011
#define DIALOG_LOGIN 2012

enum pInfo
{
    pKills,
    pDeaths,
    pAdmin
}
new PlayerInfo[MAX_PLAYERS][pInfo];



public OnFilterScriptExit()
{
    DOF2_Exit();
    return 1;
}

public OnPlayerConnect(playerid)
{
    new file[64];
    GetPlayerName(playerid,file,sizeof(file));
    format(file,sizeof(file),DOF2_File(file));
    if(DOF2_FileExists(file))
    {
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Bem Vindo!","{FFFFFF}Digite sua senha {FFFFFF}abaixo para logar.","Logar","Sair");
       
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Bem Vindo pela primeira vez","{FFFFFF}Digite sua senha {FFFFFF}abaixo para se Registrar.","Registrar","Sair");


    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_REGISTER:
        {
            if(!response) Kick(playerid);
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Bem Vindo pela primeira vez..","{FFFFFF}Digite sua senha {FFFFFF}abaixo para se Registrar","Registrar","Sair");
            if(response)
            {
                new file[64];
                GetPlayerName(playerid,file,sizeof(file));
                format(file,sizeof(file),DOF2_File(file));
                DOF2_CreateFile(file, inputtext);
                DOF2_SetInt(file, "Kills", 0);
                DOF2_SetInt(file, "Deaths", 0);
                DOF2_SetInt(file, "AdminLevel", 0);
                DOF2_SaveFile();
                SendClientMessage(playerid, 0x33FF00FF, "Registrado com sucesso!");
                PlayerPlaySound(playerid, 1057, 0.0, 0.0, 10.0);
                SpawnPlayer(playerid);
            }
        }
        case DIALOG_LOGIN:
        {
            if(!response) Kick(playerid);
            if(response)
            {
                new file[64];
                GetPlayerName(playerid,file,sizeof(file));
                format(file,sizeof(file),DOF2_File(file));
                if(DOF2_FileExists(file))
                {
                    if(DOF2_CheckLogin(file,inputtext))
                    {
                        PlayerInfo[playerid][pKills] = DOF2_GetInt(file,"Kills");
                        PlayerInfo[playerid][pDeaths] = DOF2_GetInt(file,"Deaths");
                        PlayerInfo[playerid][pAdmin] = DOF2_GetInt(file,"AdminLevel");
                        SpawnPlayer(playerid);
                        SendClientMessage(playerid, 0x33FF00FF, "Logado com sucesso!");
                        PlayerPlaySound(playerid, 1057, 0.0, 0.0, 10.0);
                        return 1;
                    }
                    else
                    {

                        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"{F81414}Senha invбlida!","{FFFFFF}Digite sua {F81414}senha corretamente{FFFFFF} abaixo.","Logar","Sair");
                        return 1;
                    }
                }
            }
        }
    }
    return 1;
}



public OnPlayerDisconnect(playerid, reason)
{
    new file[64];
    GetPlayerName(playerid,file,sizeof(file));
    format(file,sizeof(file),DOF2_File(file));
    DOF2_SetInt(file, "Kills",PlayerInfo[playerid][pKills]);
    DOF2_SetInt(file, "Deaths",PlayerInfo[playerid][pDeaths]);
    DOF2_SetInt(file, "AdminLevel",PlayerInfo[playerid][pAdmin]);
    return 1;
}


public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerInfo[killerid][pKills]++;
    PlayerInfo[playerid][pDeaths]++;
    return 1;
}
Alguйm sabe me dizer porque quando eu erro a senha e vou corrigila,quando acerto,o player da spawn e o server da closed connection?
Esse sistema nгo foi criado por mim peguei de um tutorial e editei



Re: [AJUDA]Sistema de Login com um probleminha... - Lуs - 05.04.2012

Todo errado esse seu sistema, faзa um novo e ganharб mais.


Re: [AJUDA]Sistema de Login com um probleminha... - fojo_ - 05.04.2012

Foi de um tutorial daqui do SAMP em DOF2


Re: [AJUDA]Sistema de Login com um probleminha... - Falcon. - 05.04.2012

Olб fojo_,

isso pode estar ocorrendo devido ao bug da versгo 0.3d, utilize SetSpawnInfo antes do player spawnar que o mesmo se corrigi.

Caso queira outro exemplos de login, dк uma conferida aqui: http://pastebin.com/u/falcon


Atenciosamente,
Falcon.


Re: [AJUDA]Sistema de Login com um probleminha... - fojo_ - 05.04.2012

Quote:

Olб fojo_,

isso pode estar ocorrendo devido ao bug da versгo 0.3d, utilize SetSpawnInfo antes do player spawnar que o mesmo se corrigi.

Caso queira outro exemplos de login, dк uma conferida aqui: http://pastebin.com/u/falcon


Atenciosamente,
Falcon.
____________

Opa,Falcon,obrigado pela ajuda cara,mas nгo deu muito certo ' Acho que a soluзгo й partir pra outra mesmo...jб que nгo sei criar um sistema de Login sozinho,rsrs


Re: [AJUDA]Sistema de Login com um probleminha... - RedBulL_x - 05.04.2012

Mano aperta ctrl + f e procure por "Kick(playerid);" Sу apagar e pronto.


Re: [AJUDA]Sistema de Login com um probleminha... - Lуs - 05.04.2012

Creio que DOF2 tem alguns bugs em questгo de criar arquivos com senha e checar a senha depois.


Re: [AJUDA]Sistema de Login com um probleminha... - tonisantolia - 05.04.2012

Mano o problema e so voce adcionar o SetSpawnInfo:
Isso:
PHP код:
SpawnPlayer(playerid); 
Por:
PHP код:
SetSpawnInfo(playeridTIME SKIN POSIЗВOXPOSIЗВOYPOSIЗВOZ,ANGLO00,0,00,0);
SpawnPlayer(playerid); 
Para mais informaзхes : https://sampwiki.blast.hk/wiki/SetSpawnInfo

PS: Da um "+" rep


Re: [AJUDA]Sistema de Login com um probleminha... - humildadeforever - 05.04.2012

Usa esse: https://sampforum.blast.hk/showthread.php?tid=328397
Ou esse:https://sampforum.blast.hk/showthread.php?tid=309257
Ou esse tambйm: https://sampforum.blast.hk/showthread.php?tid=317628


Re: [AJUDA]Sistema de Login com um probleminha... - kikito - 05.04.2012

faзa o sistema de login/registro em mysql, menos trabalho, e й mais rбpido (: