[Ajuda]Login demorado
#1

Galera, estou com um grande problema, qndo eu entro no meu server, demora mto tempo para fazer login. Demora uns 20segundos (fica connecting - as vezes entra, as vezes sou kikado) Estou usando um sistema de registro SII que vi em um tutorial, serб q й esse o problema? Pois meu gm й novo ainda (n pesa qse nada). vlw
Reply
#2

Veja se tem Algo Como Sleep
Reply
#3

Posta a callback "OnPlayerConnect".
Reply
#4

pawn Код:
public OnPlayerConnect(playerid)
{
    if(GetPlayerPing(playerid) >= 65535) return Kick(playerid);
   
    new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "%s entrou no servidor.", name);
    SendClientMessageToAll(-1, string);
   
    SendClientMessage(playerid,0xFFA500FF,"Seja bem vindo ao servidor.");
    //////////////////////////////////////////////////////////////
    GetPlayerName(playerid, gPlayerName[playerid], MAX_PLAYER_NAME);
    if (fexist(ObterINI(playerid)))
    {
        ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_INPUT,BRANCO "Meu server - Login",BRANCO "{F8F8FF}Digite sua {FF0000}senha {F8F8FF}para entrar.","Entrar","Sair");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_INPUT,BRANCO "Meu server - Registro",BRANCO "{F8F8FF}Digite sua {FF0000}senha {F8F8FF} para\nregistrar sua conta.","Registrar","Sair");
    }
    return 1;
}
Reply
#5

Posta tudo po --'
Reply
#6

isso й tudo.
Reply
#7

Quote:
Originally Posted by Felipe_Wesker
Посмотреть сообщение
isso й tudo.
WTF? Pra que 2 PlayerName e da onde vem ObterINI?
Reply
#8

if (fexist(%/Contas.ini(playerid)))
Reply
#9

pawn Код:
#include <a_samp>
#include <SII>
#include <streamer>

new Text:ScoreTextDraw[MAX_PLAYERS];

main()
{
}

//REGISTRO
#define DIALOG_REGISTRO 1
#define DIALOG_LOGAR 2

#define BRANCO "{FFFFFF}"
#define VERMELHO "{F81414}"
#define VERDE "{00FF22}"
#define AZUL CLARO "{00CED1}"

new gPlayerName[MAX_PLAYERS][MAX_PLAYER_NAME];

enum pInfo
{
    pSenha,
    pScore,
    pDinheiro,
    pAdmin
}
new PlayerInfo[MAX_PLAYERS][pInfo];

stock ObterINI(playerid)
{
  new conta[64];
  format(conta,30,"Contas/%s.ini",gPlayerName[playerid]);
  return conta;
}

AntiDeAMX()
{
    new a[][] = { "Unarmed (Fist)", "Brass K" };
    #pragma unused a
}
#define MES_LIMITE 5

//Cores
#define Amarelo                                                                 0xFFFF00AA
#define Vermelho                                                                0xFF0000AA
#define Verde                                                                   0x80FF80AA
#define Azul                                                                    0x1E90FFAA
#define Cinza                                                                   0xC0C0C0AA
#define Branco                                                                  0xFFFFFFAA

//Times
#define Policial 1
#define Civil 2

new Team[MAX_PLAYERS];

/////////////////////////////////////////////////////////////////////////////////////////////////////////

public OnGameModeInit()
{
    EnableStuntBonusForAll(0);
    SetTimer("AtualizarScore", 1000, true);
    for(new x = 0; x < MAX_PLAYERS; x++)
    {
        ScoreTextDraw[x] = TextDrawCreate(88.000000, 428.000000, "Score: 1000000");
        TextDrawBackgroundColor(ScoreTextDraw[x], 255);
        TextDrawFont(ScoreTextDraw[x], 1);
        TextDrawLetterSize(ScoreTextDraw[x], 0.440000, 1.500000);
        TextDrawColor(ScoreTextDraw[x], -1);
        TextDrawSetOutline(ScoreTextDraw[x], 0);
        TextDrawSetProportional(ScoreTextDraw[x], 1);
        TextDrawSetShadow(ScoreTextDraw[x], 1);
    }
    SetGameModeText("Meu Server");
    //Cops
    AddPlayerClass(280, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(281, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(282, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(283, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(284, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(288, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    //Civis
    AddPlayerClass(2, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(4, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(5, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(6, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(7, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(15, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(18, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(20, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(23, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(29, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(35, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(55, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(56, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(98, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
   
    AntiDeAMX();
    new Data[3];
    getdate(Data[0], Data[1], Data[2]); // Ano, mes, dia
    if(Data[1] > MES_LIMITE) // Se o mкs atual й maior que o permitido, o servidor fecharб.
    {
        printf("Proteзгo ativada.");
        printf("Vocк nгo tem permissгo para usar este GameMode.");
        SendRconCommand("exit");
    }

    new t[3];
    gettime(t[0], t[1], t[2]);
    SetWorldTime(t[0]);
    SetTimer("Real", 60000, true);
   
    return true;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    switch(classid)
    {
        case 0,1,2,3,4,5:
        {
            GameTextForPlayer(playerid, "~g~LSPD", 1000, 3);
            SetPlayerInterior(playerid,14);
            SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
            SetPlayerFacingAngle(playerid, 270.0);
            SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
            SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
            return true;
        }
        case 6,7,8,9,10,11,12,13,14,15,16,17,18,19:
        {
            GameTextForPlayer(playerid, "~w~Civil", 1000, 3);
            SetPlayerInterior(playerid,14);
            SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
            SetPlayerFacingAngle(playerid, 270.0);
            SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
            SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
            return true;
        }
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    if(GetPlayerPing(playerid) >= 65535) return Kick(playerid);
   
    new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "%s entrou no servidor.", name);
    SendClientMessageToAll(-1, string);
   
    SendClientMessage(playerid,0xFFA500FF,"Seja bem vindo ao servidor.");
    //////////////////////////////////////////////////////////////
    GetPlayerName(playerid, gPlayerName[playerid], MAX_PLAYER_NAME);
    if (fexist(ObterINI(playerid)))
    {
        ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_INPUT,BRANCO "Meu server - Login",BRANCO "{F8F8FF}Digite sua {FF0000}senha {F8F8FF}para entrar.","Entrar","Sair");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_INPUT,BRANCO "Meu server - Registro",BRANCO "{F8F8FF}Digite sua {FF0000}senha {F8F8FF} para\nregistrar sua conta.","Registrar","Sair");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(INI_Open(ObterINI(playerid))) {

    INI_WriteInt("Score",PlayerInfo[playerid][pScore]);
    INI_WriteInt("Dinheiro",GetPlayerMoney(playerid));
    INI_WriteInt("Admin",PlayerInfo[playerid][pAdmin]);

    INI_Save();
    INI_Close();
    }
    return 1;
}

public OnPlayerSpawn(playerid)
{
        switch(GetPlayerSkin(playerid))
        {
                case 280,281,282,283,284,288:                               Team[playerid] = 1 ,SetPlayerColor(playerid, 0x1E90FFAA);
                case 2,4,5,6,7,15,18,20,23,29,35,55,56,98:                  Team[playerid] = 2 ,SetPlayerColor(playerid, 0xF8F8FFAA);
        }
        SetPlayerInterior(playerid, 0);
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/Shop", true) == 0)
    {
        SetPlayerPos(playerid,1155.40, -1434.89, 16.49);
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    SetPlayerInterior(playerid,0);
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(Team[playerid] == Policial)
    {
        //funзгo
    }
    if(Team[playerid] == Civil)
    {
        //funзгo
    }
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    new Text3D:procurado[MAX_PLAYERS];
    new procuradolevel = GetPlayerWantedLevel(playerid);
    new Text3d[MAX_PLAYERS];
    if(procuradolevel > 0)
    {
        if(Text3d[playerid] == 0)
        {
            Text3d[playerid] = 1;
            procurado[playerid] = Create3DTextLabel("~x PROCURADO x~", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0, 0);
            Attach3DTextLabelToPlayer(procurado[playerid], playerid, 0.0, 0.0, 0.7);
        }
        Update3DTextLabelText(procurado[playerid], 0x008080FF, "~x PROCURADO x~");
    }
    if(Text3d[playerid] == 1)
    {
        if(procuradolevel == 0)
        {
            Delete3DTextLabel(procurado[playerid]);
        }
    }
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTRO:
        {
            if (!response) return Kick(playerid);
            if (response)
            {
                if(!strlen(inputtext)) {
                ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_INPUT, BRANCO "Registrando...",VERMELHO"Vocк digitou uma senha invбlida.\n"BRANCO"Digite sua senha abaixo para registrar uma nova conta.","Registro","Quit");
                }

                if(INI_Open(ObterINI(playerid))) {
                INI_WriteString("Senha",inputtext);
                INI_WriteInt("Score",1);
                INI_WriteInt("Dinheiro",5000);
                INI_WriteInt("Admin",0);

                INI_Save();
                INI_Close();

                ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_INPUT,BRANCO"Logar",BRANCO "Digite sua senha abaixo para efetuar login.","Logar","Quit");
            }
        }
    }
        case DIALOG_LOGAR:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(!strlen(inputtext)) {
                ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_INPUT, BRANCO"Logar",VERMELHO"Vocк digitou uma senha invбlida.\n"BRANCO"Digite sua senha abaixo para efetuar login.","Logar","Quit");
                }

                if(INI_Open(ObterINI(playerid))) {
                INI_ReadString(PlayerInfo[playerid][pSenha],"Senha",20);

                if(strcmp(inputtext,PlayerInfo[playerid][pSenha],false)) {
                ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_INPUT, BRANCO"Logar",VERMELHO"Vocк digitou uma senha incorreta.\n"BRANCO"Digite sua senha abaixo para acessar.","Logar","Quit");
                }

                SetPlayerScore( playerid, INI_ReadInt("Score" ) );
                ResetPlayerMoney( playerid );
                GivePlayerMoney( playerid, INI_ReadInt( "Dinheiro" ) );
                PlayerInfo[playerid][pAdmin] = INI_ReadInt("Admin");
                INI_Close();
                }
            }
        }
    }
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}

/*stock ProcessColorName(playerid)
{
        static COLOR[20];
        switch(GetPlayerSkin(playerid))
        {
                case 280,281,282,283,284,288:             COLOR = "{33CCFFAA}";
                case 1,2,4,6,7,15,23:                     COLOR = "{FFFFFFF}";
        }
        return COLOR;
}*/


forward Real();
public Real() {
    new t[3];
    gettime(t[0], t[1], t[2]);
    SetWorldTime(t[0]);
    return true;
}

forward AtualizarScore();
public AtualizarScore()
{
    for(new x = 0, y = GetMaxPlayers(); x != y; x++)
    {
        if(!IsPlayerConnected(x)) continue;
        new STR[26];
        format(STR, 26, "~r~Score: ~w~%d", GetPlayerScore(x));
        TextDrawShowForPlayer(x, ScoreTextDraw[x]);
        TextDrawSetString(ScoreTextDraw[x], STR);
    }
    return true;
}
Reply
#10

pawn Код:
public OnPlayerConnect(playerid)
{
    if(GetPlayerPing(playerid) >= 65535) return Kick(playerid);

    new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "%s entrou no servidor.", name);
    SendClientMessageToAll(-1, string);

    SendClientMessage(playerid,0xFFA500FF,"Seja bem vindo ao servidor.");

    format(string, sizeof(string), "Contas/%s.ini", name);
   
    if (fexist(string))
    {
        ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_INPUT,BRANCO "Meu server - Login",BRANCO "{F8F8FF}Digite sua {FF0000}senha {F8F8FF}para entrar.","Entrar","Sair");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_INPUT,BRANCO "Meu server - Registro",BRANCO "{F8F8FF}Digite sua {FF0000}senha {F8F8FF} para\nregistrar sua conta.","Registrar","Sair");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)