[FilterScript] Sistema de registro ( DOF2 - bIni - SII)
#1

Sistema de REGISTRO


Descriзгo: :
Nгo й um sistema complexo, ele apenas salva sua senha level e dinheiro.
enjoy

bIni

pawn Код:
#include a_samp
#include bIni

#if defined MAX_PLAYERS
        #undef MAX_PLAYERS
#endif

#define MAX_PLAYERS 45

#define contas "%s.ini"

#define login "Bem vindo ao servidor %s digite sua senha para logar-se."
#define registro "Bem vindo ao servidor %s registre-se."


enum pInfo
{
    pGrana,
    pLevel,
};

new playerinfo[MAX_PLAYERS][pInfo];

new
    file[50],
    nome[24],
    paramount[90]
;

   
public OnPlayerConnect(playerid)
{
    GetPlayerName(playerid,nome,24);
    format(file,50,contas,nome);
    if(fexist(file))
    {
        GetPlayerName(playerid,nome,24);
        format(paramount,90,login,nome);
        ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor",paramount,"entrar","Sair");
    }
    else
    {
        GetPlayerName(playerid,nome,24);
        format(paramount,90,registro,nome);
        ShowPlayerDialog(playerid,9999,DIALOG_STYLE_INPUT,"Servidor",paramount,"registrar","Sair");
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 9999)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            GetPlayerName(playerid,nome,24);
            format(file,50,contas,nome);
            INI_Open(file);
            INI_WriteString("senha",inputtext);
            playerinfo[playerid][pLevel] = INI_WriteInt("level",5);
            playerinfo[playerid][pGrana] = INI_WriteInt("dinheiro",5000);
            INI_Save();
            INI_Close();
            format(paramount,90,login,nome);
            new len = strlen(inputtext);
            if(len < 5 || len > 20) return ShowPlayerDialog(playerid,9999,DIALOG_STYLE_INPUT,"Servidor","Senha deve conter no minimo 5 caracteres.","Ok","kick");
            return ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor",login,"Ok","fechar");
        }
    }
    if(dialogid == 9998)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new senha[20];
            GetPlayerName(playerid,nome,24);
            format(senha,20,"%s",strval(inputtext));
            format(file,50,contas,nome);
            INI_Open(file);
            INI_ReadString("senha");
            INI_Close();
            if(strcmp(senha,inputtext,true) == 0)
            {
                if(!strlen(inputtext))
                {
                    ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor","senha errada, digite a senha correta para logar-se.","Ok","Sair");
                    return SendClientMessage(playerid,-1,"senha errada.");
                }
                GetPlayerName(playerid,nome,24);
                format(file,28,contas,nome);
                INI_Open(file);
                SetPlayerScore(playerid,INI_ReadInt("level"));
                GivePlayerMoney(playerid,INI_ReadInt("dinheiro"));
                INI_Close();
            }
            else
            {
                ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor","senha errada, insira a senha correta.","Ok","Sair");
                SendClientMessage(playerid,-1,"senha errada.");
            }
        }
    }
    return 1;
}
DOF2

pawn Код:
#include a_samp
#include DOF2


#if defined MAX_PLAYERS
        #undef MAX_PLAYERS
#endif

#define MAX_PLAYERS 45

#define contas "%s.ini"

#define login "Bem vindo ao servidor %s digite sua senha para logar-se."
#define registro "Bem vindo ao servidor %s registre-se."


enum pInfo
{
    pGrana,
    pLevel,
};

new playerinfo[MAX_PLAYERS][pInfo];

new
    arquivo[50],
    nome[24],
    paramount[90]
;

public OnFilterScriptExit()
{
    DOF2_Exit();
    return 1;
}
   
public OnPlayerConnect(playerid)
{
    GetPlayerName(playerid,nome,24);
    format(arquivo,50,contas,nome);
    if(fexist(arquivo))
    {
        GetPlayerName(playerid,nome,24);
        format(paramount,90,login,nome);
        ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor",paramount,"entrar","sair");
    }
    else
    {
        GetPlayerName(playerid,nome,24);
        format(paramount,90,registro,nome);
        ShowPlayerDialog(playerid,9999,DIALOG_STYLE_INPUT,"Servidor",paramount,"registrar","sair");
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 9999)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            GetPlayerName(playerid,nome,24);
            format(arquivo,50,contas,nome);
            DOF2_CreateFile(arquivo);
            DOF2_SetString(arquivo,"senha",inputtext);
            playerinfo[playerid][pLevel] = DOF2_SetInt(arquivo,"level",5);
            playerinfo[playerid][pGrana] = DOF2_SetInt(arquivo,"dinheiro",5000);
            format(paramount,90,login,nome);
            new len = strlen(inputtext);
            if(len < 5 || len > 20) return ShowPlayerDialog(playerid,9999,DIALOG_STYLE_INPUT,"Servidor","Senha deve conter no minimo 5 caracteres.","Ok","kick");
            return ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor",login,"ok","fechar");
        }
    }
    if(dialogid == 9998)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new senha[20];
            GetPlayerName(playerid,nome,24);
            format(arquivo,50,contas,nome);
            format(senha,20,"%s",strval(inputtext));
            if(strcmp(inputtext,DOF2_GetString(arquivo,"senha"),true) == 0)
            {
                if(!strlen(inputtext))
                {
                    ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor","senha errada, digite a senha correta para logar-se.","ok","sair");
                    return SendClientMessage(playerid,-1,"senha errada.");
                }
                GetPlayerName(playerid,nome,24);
                format(arquivo,28,contas,nome);
                SetPlayerScore(playerid,DOF2_GetInt(arquivo,"level"));
                GivePlayerMoney(playerid,DOF2_GetInt(arquivo,"dinheiro"));
            }
            else
            {
                ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor","senha errada, insira a senha correta.","ok","sair");
                SendClientMessage(playerid,-1,"senha errada.");
            }
        }
    }
    return 1;
}
SII

pawn Код:
#include a_samp
#include SII

#if defined MAX_PLAYERS
        #undef MAX_PLAYERS
#endif

#define MAX_PLAYERS 45

#define contas "%s.ini"

#define login "Bem vindo ao servidor %s digite sua senha para logar-se."
#define registro "Bem vindo ao servidor %s registre-se."

enum pInfo
{
    pGrana,
    pLevel,
};

new playerinfo[MAX_PLAYERS][pInfo];

new
    file[50],
    nome[24],
    paramount[90]
;

   
public OnPlayerConnect(playerid)
{
    GetPlayerName(playerid,nome,24);
    format(file,50,contas,nome);
    if(fexist(file))
    {
        GetPlayerName(playerid,nome,24);
        format(paramount,90,login,nome);
        ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor",paramount,"entrar","sair");
    }
    else
    {
        GetPlayerName(playerid,nome,24);
        format(paramount,90,registro,nome);
        ShowPlayerDialog(playerid,9999,DIALOG_STYLE_INPUT,"Servidor",paramount,"registrar","sair");
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 9999)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            GetPlayerName(playerid,nome,24);
            format(file,50,contas,nome);
            INI_Open(file);
            INI_WriteString("senha",inputtext);
            playerinfo[playerid][pLevel] = INI_WriteInt("level",5);
            playerinfo[playerid][pGrana] = INI_WriteInt("dinheiro",5000);
            INI_Save();
            INI_Close();
            format(paramount,90,login,nome);
            new len = strlen(inputtext);
            if(len < 5 || len > 20) return ShowPlayerDialog(playerid,9999,DIALOG_STYLE_INPUT,"Servidor","Senha deve conter no minimo 5 caracteres.","Ok","kick");
            return ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor",login,"ok","fechar");
        }
    }
    if(dialogid == 9998)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new senha[20];
            GetPlayerName(playerid,nome,24);
            format(senha,20,"%s",strval(inputtext));
            format(file,50,contas,nome);
            INI_Open(file);
            INI_ReadString(senha,"senha");
            INI_Close();
            if(strcmp(senha,inputtext,true) == 0)
            {
                if(!strlen(inputtext))
                {
                    ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor","senha errada, digite a senha correta para logar-se.","ok","sair");
                    return SendClientMessage(playerid,-1,"senha errada.");
                }
                GetPlayerName(playerid,nome,24);
                format(file,28,contas,nome);
                INI_Open(file);
                SetPlayerScore(playerid,INI_ReadInt("level"));
                GivePlayerMoney(playerid,INI_ReadInt("dinheiro"));
                INI_Close();
            }
            else
            {
                ShowPlayerDialog(playerid,9998,DIALOG_STYLE_INPUT,"Servidor","senha errada, insira a senha correta.","ok","sair");
                SendClientMessage(playerid,-1,"senha errada.");
            }
        }
    }
    return 1;
}

CRЙDITOS

Bruno Silva - bIni
Double-O-Seven - DOF2
Slick - SII


gostou? da rep (:
Reply
#2

parece bom, parabйns!
Reply
#3

Legal cara, bom trabalho...
Reply
#4

Belo FS Parabens.
DOF2 ? Que Include й Essa й Rapida?
Reply
#5

bom trabalho.
Reply
#6

Quote:
Originally Posted by [O.z]Caroline
Посмотреть сообщение
parece bom, parabйns!
Obrigado carol.

Quote:
Originally Posted by [BR]Michael
Посмотреть сообщение
Legal cara, bom trabalho...
valeu michael

Quote:
Originally Posted by ReDKiiL
Посмотреть сообщение
Belo FS Parabens.
DOF2 ? Que Include й Essa й Rapida?
dof2 й do double-o-seven.. ela й rapida e facil de usar...

Quote:
Originally Posted by [S]trong
Посмотреть сообщение
bom trabalho.
Obrigado Strong.
Reply
#7

Parece ser bom cara
Reply
#8

voce devia de por as includes ente < > e nao ha solta,mas mesmo assim,esta bom.

PHP код:
This forum requires that you wait 120 seconds between postsPlease try again in 32 seconds
PHP код:
This forum requires that you wait 120 seconds between postsPlease try again in 22 seconds
PHP код:
This forum requires that you wait 120 seconds between postsPlease try again in 3 seconds
OMG
Reply
#9

Quote:
Originally Posted by kikito
Посмотреть сообщение
voce devia de por as includes ente < > e nao ha solta,mas mesmo assim,esta bom.

PHP код:
This forum requires that you wait 120 seconds between postsPlease try again in 32 seconds
PHP код:
This forum requires that you wait 120 seconds between postsPlease try again in 22 seconds
PHP код:
This forum requires that you wait 120 seconds between postsPlease try again in 3 seconds
OMG
Nгo mesmo, й possнvel deixar sem " " ou <>, o compilador reconhece.

Antes de corrigir procura pesquisar para saber se estб correcto.
Reply
#10

Quote:
Originally Posted by kikito
Посмотреть сообщение
voce devia de por as includes ente < > e nao ha solta,mas mesmo assim,esta bom.

PHP код:
This forum requires that you wait 120 seconds between postsPlease try again in 32 seconds
PHP код:
This forum requires that you wait 120 seconds between postsPlease try again in 22 seconds
PHP код:
This forum requires that you wait 120 seconds between postsPlease try again in 3 seconds
OMG
cara o compilador reconhece de qualquer jeito.. o mais importante й colocar o nome da include correta.

Quote:
Originally Posted by BrunoBSF
Посмотреть сообщение
Parece ser bom cara
Obrigado, Bruno.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)