[AJUDA] Na hora do registro... +rep
#1

Tentei mais nгo consegui

Й o seguinte, estou tentando adicionar na hora que a pessoa vai se registrar, a opзгo de escolher sua cidade para nascer, mais ta dificil de fazer isso.

pawn Код:
#define LINGUA   3
new City[MAX_PLAYERS];

#define VEGASES 0
#define SANTOES 1
Queria colocar isso aqui na hora que a pessoa for se registrar

[pawn]
pawn Код:
ShowPlayerDialog(playerid,LINGUA, DIALOG_STYLE_MSGBOX, "Atencгo", "Qual й sua cidade", "Los Santos", "Las Vegas");

Esse aqui й o meu sistema de registro PS: Esse ai й o arquivo que eu baixei que fica mais fбcil do que copiar que ta no meu.

pawn Код:
// Criado Por Thiago_PS
// Editado Por JFS.
// Motivo do Post : Muitos Pedidos.
// >> Sem BUG << || Assesem : homehots.net || MSN : john_feat@hotmail.com
// Й Nois ! */
#include <a_samp>
#include <Dini>

#define FILTERSCRIPT

#define REGISTRO 1
#define LOGIN    2

#define CONTAS "Players/%s.ini"

new Matou[MAX_PLAYERS];
new Morreu[MAX_PLAYERS];
new Logou[MAX_PLAYERS];

public OnFilterScriptInit()
{
    return 1;
}

public OnFilterScriptExit()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    SalvarPlayer(i);
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    return 1;
}
public OnPlayerConnect(playerid)
{
    new Nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Nome, sizeof(Nome));
    new String[100];
    format(String, sizeof(String), CONTAS, Nome);
    if(!dini_Exists(String))
    {
        format(String, sizeof(String), "{7FFFD4}Nick: {1E90FF}%s  {1E90FF}Nгo Registrado\n\n{FFFFFF} Digite Uma Senha Para Continuar", Nome);
        ShowPlayerDialog(playerid, REGISTRO, DIALOG_STYLE_INPUT, "Registro", String, "Registrar", "Cancelar");
    }
    else
    {
        format(String, sizeof(String), "{7FFFD4}Nick: {1E90FF}%s  {1E90FF}Registrado\n\n{FFFFFF} Digite Sua Senha Para Logar", Nome);
        ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Registro", String, "Logar", "Cancelar");
    }
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    SalvarPlayer(playerid);
    return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerConnected(killerid))
    {
        Matou[killerid]++;
    }
    Morreu[playerid]++;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/status", cmdtext, true, 8) == 0)
    {
        Status(playerid);
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == REGISTRO)
    {
        if(response)
        {
            if(!strlen(inputtext))
            {
                new Nome[MAX_PLAYER_NAME];
                GetPlayerName(playerid, Nome, sizeof(Nome));
                new String[100];
                format(String, sizeof(String), "{7FFFD4}Nick: {1E90FF}%s  {1E90FF}Nгo Registrado\n\n{FFFFFF} Digite Uma Senha Para Continuar", Nome);
                ShowPlayerDialog(playerid, REGISTRO, DIALOG_STYLE_INPUT, "Registro", String, "Registrar", "Cancelar");
                SendClientMessage(playerid,0x1E90FFAA,"Senha invalida, digite uma senha vбlida");
                return 1;
            }
            new Nome[MAX_PLAYER_NAME];
            GetPlayerName(playerid, Nome, sizeof(Nome));
            new String[100];
            format(String, sizeof(String), CONTAS, Nome);
            dini_Create(String);
            dini_Set(String,"Senha",inputtext);
            dini_IntSet(String,"Dinheiro",0);
            dini_IntSet(String,"Vida", 100);
            dini_IntSet(String,"Colete", 100);
            dini_IntSet(String,"Matou",0);
            dini_IntSet(String,"Morreu",0);
            dini_IntSet(String,"Logou",0);
            ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Login", "{1E90FF}Pronto vocк se registrou agora digite Sua Senha Para Logar-Se", "Logar", "Cancelar");
            return 1;
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Vocк Foi Kickado Porque Nгo Quis Se Registrar!!");
            Kick(playerid);
            return 1;
        }
    }
    if(dialogid == LOGIN)
    {
        if(response)
        {
            if(!strlen(inputtext))
            {
                new Nome[MAX_PLAYER_NAME];
                GetPlayerName(playerid, Nome, sizeof(Nome));
                new String[100];
                format(String, sizeof(String), "{7FFFD4}Nick: {1E90FF}%s  {1E90FF}Registrado\n\n{FFFFFF} Digite Sua Senha Para Logar", Nome);
                ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Registro", String, "Logar", "Cancelar");
                SendClientMessage(playerid,0x1E90FFAA,"Senha Incorreta !");
                return 1;
            }
            new Nome[MAX_PLAYER_NAME];
            GetPlayerName(playerid, Nome, sizeof(Nome));
            new String[100];
            format(String, sizeof(String), CONTAS, Nome);
            if(!strcmp(inputtext,dini_Get(String,"Senha"),false))
            {
                SetarPlayer(playerid);
                Logou[playerid]++;
                SendClientMessage(playerid,0x00FF00AA,"Vocк Foi Logado Com Sucesso > Escolha Sua Skin!");
                return 1;
            }
            else
            {
                SendClientMessage(playerid,0x00FF00AA,"Senha incorreta digite-a novamente");
                format(String, sizeof(String), "{7FFFD4}Nick: {1E90FF}%s  {1E90FF}Registrado\n\n{FFFFFF} Digite Sua Senha Para Logar", Nome);
                ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Registro", String, "Logar", "Cancelar");
            }
            return 1;
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Vocк nгo quis se logar, por este motivo serб Kickado");
            Kick(playerid);
            return 1;
        }
    }
    return 1;
}

SalvarPlayer(playerid)
{
    new Float:Vida;
    new Float:Colete;
    GetPlayerHealth(playerid, Vida);
    GetPlayerArmour(playerid, Colete);
    new Nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Nome, sizeof(Nome));
    new String[50];
    format(String, sizeof(String), CONTAS, Nome);
    dini_IntSet(String,"Dinheiro", GetPlayerMoney(playerid));
    dini_FloatSet(String,"Vida", Vida);
    dini_FloatSet(String,"Colete", Colete);
    dini_IntSet(String,"Matou", Matou[playerid]);
    dini_IntSet(String,"Morreu", Morreu[playerid]);
    dini_IntSet(String,"Logou", Logou[playerid]);
    return 1;
}

SetarPlayer(playerid)
{
    new Nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Nome, sizeof(Nome));
    new String[50];
    format(String, sizeof(String), CONTAS, Nome);
    GivePlayerMoney(playerid, dini_Int(String,"Dinheiro"));
    SetPlayerHealth(playerid, dini_Int(String,"Vida"));
    SetPlayerArmour(playerid, dini_Int(String,"Colete"));
    Matou[playerid] = dini_Int(String, "Matou");
    Morreu[playerid] = dini_Int(String, "Morreu");
    Logou[playerid] = dini_Int(String, "Logou");
    return 1;
}

Status(playerid)
{
    new Nome[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Nome, sizeof(Nome));
    new String[128];
    SendClientMessage(playerid, 0xFF0000AA, "================================================");
    format(String, sizeof(String),"Status De %s",Nome);
    SendClientMessage(playerid, 0xFFFF00AA,String);
    format(String, sizeof(String),"Dinheiro: %d", GetPlayerMoney(playerid));
    SendClientMessage(playerid, 0x1E90FFAA,String);
    format(String, sizeof(String),"Matou: %d",Matou[playerid]);
    SendClientMessage(playerid, 0x1E90FFAA,String);
    format(String, sizeof(String),"Morreu: %d",Morreu[playerid]);
    SendClientMessage(playerid, 0x1E90FFAA,String);
    format(String, sizeof(String),"Vocк Jб Logou %d Vezes Neste Servidor",Logou[playerid]);
    SendClientMessage(playerid, 0x1E90FFAA,String);
    SendClientMessage(playerid, 0xFF0000AA, "================================================");
    return 1;
}
Reply
#2

ajuda
Reply
#3

Facil

comesso gm

pawn Код:
enum pInfo
{
    pCity,
};
new PlayerInfo[MAX_PLAYERS][pInfo];
dialog
pawn Код:
if(dialogid == 9)
    {
        if(response == 0)
        {
            PlayerInfo[playerid][pSex] = 2;
            SetPlayerSkin(playerid, 12);
            PlayerInfo[playerid][pSkin] = 12;
            PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
            RegistrationStep[playerid] = 0;
            ShowPlayerDialog(playerid,1232,0,"Escolha sua Cidade","-Vocк Escolheu seu Sexo\n-Agora escolha sua Cidade\n\n-Clique em Los Santos ou San Fierro","Los Santos","San Fierro");
            return 1;
        }
        if(response == 1)
        {
            PlayerInfo[playerid][pSex] = 1;
            SetPlayerSkin(playerid, 23);
            PlayerInfo[playerid][pSkin] = 23;
            SendClientMessage(playerid, TEAM_VAGOS_COLOR, "Certo, Vocк й um Homem!.");
            PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
            RegistrationStep[playerid] = 0;
            ShowPlayerDialog(playerid,1232,0,"Escolha sua Cidade","-Vocк Escolheu seu Sexo\n-Agora escolha sua Cidade\n\n-Clique em Los Santos ou San Fierro","Los Santos","San Fierro");
            return 1;
        }
        return 1;
    }
ainda em dialog
pawn Код:
if(dialogid == 1232)
    {
        if(response == 0)
        {
            PlayerInfo[playerid][pCity] = 2;
            return 1;
        }
        if(response == 1)
        {
            PlayerInfo[playerid][pCity] = 1;
            return 1;
        }
        return 1;
    }
agora pra terminar
pawn Код:
public OnPlayerRegister(playerid, password[])
{
    if(IsPlayerConnected(playerid))
    {
            new string3[64];
            new playername3[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playername3, sizeof(playername3));
            format(string3, sizeof(string3), "Players/%s.ini", playername3);
            new File: hFile = fopen(string3, io_write);
            if (hFile)
            {
                format(var, 32, "minhacity=%d\n",PlayerInfo[playerid][pCity]);fwrite(hFile, var);
                fclose(hFile);
            }
    }
    return 1;
}
no login
pawn Код:
public OnPlayerLogin(playerid,password[])
{
    new tmp2[256];
    new string2[64];
    format(string2, sizeof(string2), "Players/%s.ini", PlayerName(playerid));
    strmid(PlayerInfo[playerid][pKey], dini_Get(string2, "Key"), 0, strlen(dini_Get(string2, "Key")), 255);
    new File: UserFile = fopen(string2, io_read);
    if (UserFile)
    {
        if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0)
        {
                new key[ 256 ] , val[ 256 ];
                new Data[ 256 ];
                while (fread(UserFile, Data, sizeof(Data)))
                {
                      if( strcmp( key , "minhacity" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCity] = strval( val ); }
                }//end while
                fclose(UserFile);//close the file after everything has been read in the while
        }
     }
     return 1;
}
no set player spawn
pawn Код:
public SetPlayerSpawn(playerid)
{
    if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
    {
                if(PlayerInfo[playerid][pCity] == 1)
        {
            SetPlayerPos(playerid,1243.2660,-1693.4352,16.1977);
            SetPlayerFacingAngle(playerid, 186.2567);
            SetPlayerInterior(playerid,0);
            SetPlayerVirtualWorld(playerid,0);
            PlayerInfo[playerid][pInt] = 0;
            return 1;
        }
        if(PlayerInfo[playerid][pCity] == 2)
        {
            SetPlayerPos(playerid,-2228.0908,251.9710,35.3203);
            SetPlayerFacingAngle(playerid, 47.1624);
            SetPlayerInterior(playerid,0);
            SetPlayerVirtualWorld(playerid,0);
            PlayerInfo[playerid][pInt] = 0;
            return 1;
        }
        }
        return 1;
}
e so, ajudei da um + na reputaзгo ae
Reply
#4

(350) : warning 235: public function lacks forward declaration (symbol "OnPlayerRegister")
(361) : error 017: undefined symbol "var"
(361) : error 017: undefined symbol "var"
(36 : warning 235: public function lacks forward declaration (symbol "OnPlayerLogin")
(372) : error 017: undefined symbol "PlayerName"
(373) : error 017: undefined symbol "pKey"
(377) : error 017: undefined symbol "pKey"
(383) : error 017: undefined symbol "ini_GetValue"
(383) : error 033: array must be indexed (variable "val")
(370) : warning 204: symbol is assigned a value that is never used: "tmp2"
(45 : error 017: undefined symbol "pSex"
(460) : error 017: undefined symbol "pSkin"
(462) : error 017: undefined symbol "RegistrationStep"
(462) : warning 215: expression has no effect
(462) : error 001: expected token: ";", but found "]"
(462) : error 029: invalid expression, assumed zero
(462) : fatal error 107: too many error messages on one line
Reply
#5

kra, pega o meu e adapta pro seu gm, pois o gm e diferente ¬¬
Reply
#6

que? Peguei tudo isso que tu mando
Reply
#7

oq eu fiz foi conforme meu gm, agr adpa pro seu, pois naums ei os bang do teu gm
Reply
#8

Entгo ISOLA ISSO AI

Vocк saberia me dizer onde eu poderia colocar isso aqui no cуdigo acima (sistema deregistro)? e como colocar

pawn Код:
ShowPlayerDialog(playerid, LINGUA, DIALOG_STYLE_LIST, "Cidade:", "Las Vegas\nLos Santos", "Selecionar", "");
Obs: Jб tem tudo sу falta por isso ai /\ nгo sei onde
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)