[Ajuda] Dini
#1

Tipo pessoal, vou ser bastante detalhado para vcs entenderem e eu nгo digitar isso em vгo, й o seguinte, tenho aqui um sistema e queria saber como posso sentar o nome do arquivo cfg pra outro nome usando Dini, tipo, vou mostrar uma parte do comando..

* quero sу mudar o nome do arquivo cfg atual para o nome do comprador..

pawn Код:
else if (strcmp(x_Emprego, "veiculo", true) == 0) // comando (( /aceitar veiculo ))
            {
                new Vendedor = TransferenciaVeh2[playerid];
                if (TransferenciaVeh[playerid] == 1)
                {
                    if (IsPlayerConnected(TransferenciaVeh2[playerid]))
                    {
                        new str[256];
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        GetPlayerName(Vendedor, giveplayer, sizeof(giveplayer));
                        format(str, 256, "* %s aceitou sua proposta de consulta.", GetPlayerNameRP(playerid));
                        SendClientMessage(Vendedor, COLOR_LIGHTBLUE, str);
                        format(str, 256, "O dinheiro serб adicionado ao seu salбrio.");
                        SendClientMessage(Vendedor, COLOR_LIGHTBLUE, str);
                        format(str, 256, "* Vocк aceitou o atendimento do mйdico %s.", giveplayer);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
                        format(string, sizeof(string), "* Mйdico(a) %s estб atendendo paciente %s.", giveplayer, sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                        TransferenciaVeh[playerid] = 0;
                        GivePlayerMoneyEx(Vendedor, PrecoVeiculo[playerid]);
                       
                        new Placa = PlayerInfo[Vendedor][pCarro];
                        PlayerInfo[playerid][pCarro] = Placa;
                        PlayerInfo[Vendedor][pCarro] = 255;
                       
                                   // Nгo sei oque eu faзo daqui para baixo, pois ali em cima senta tudo certim, mais aqui em baixo que era para mudar o nome arquivo cfg para o que comprou.
                       /* new PlayerNick[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, PlayerNick, sizeof(PlayerNick));
                        new arquivo[256];
                        format(arquivo, sizeof(arquivo), "/Concessionaria/Proprietarios/%s.ini", PlayerNick);// aqui fica localizado o dono do carro que e agente precisa mudar.
                        if (!dini_Exists(arquivo)) // isso aqui pra baixo й algo que copiei nem sei oque fazer com isso '.'
                        {
                            new idx = 1;
                            while (idx < sizeof(Carro))
                            {
                                if (strcmp(Carro[idx][cDono], "Ninguem", true) == 0)
                                {
                                    strmid(Carro[idx][cDono], PlayerNick, 0, strlen(PlayerNick), MAX_PLAYER_NAME);
                                    TaNoCarro[playerid] = idx;
                                   
                                    return 1;
                                }
                                else
                                {
                                    idx++;
                                }
                            }
                        }*/

                       
                       
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, "ERRO: Mйdico que tentou lhe atendeu nгo estб no momento.");
                        return 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "ERRO: Ninguйm lhe ofereceu uma consulta.");
                    return 1;
                }
            }
Obs: esse cуdigo ae eu fiz rбpido e peguei a base de um sistema de HP, rsrsrs
Caso deseja mais algo do sistema sу falar;
Quem ajudar garanto +reputaзгo
Aparecem profissionais do fуrum samp!
Reply
#2

Salva tudo que esta no arquivo em variбveis, deleta o arquivo, cria o novo, salva os valores das variбveis no novo arquivo no caso do dini.

se usasses DOF2 ( o que nгo й nada difнcil a conversгo de dini para DOF2 ) jб terias esta funзгo:

native DOF2_RenameFile(oldfile[],newfile[]);
Reply
#3

Pode me informar como posso fazer entгo? como posso usar DOF2_RenameFile..
Reply
#4

Olha:

Quote:
Originally Posted by PT
Посмотреть сообщение
se vires no fim da include dof2 tens isto

pawn Код:
#define dini_Exists             DOF2_FileExists
    #define dini_Remove             DOF2_RemoveFile
    #define dini_Create             DOF2_CreateFile
    #define dini_Set                DOF2_SetString
    #define dini_Get                DOF2_GetString
    #define dini_IntSet             DOF2_SetInt
    #define dini_Int                DOF2_GetInt
    #define dini_BoolSet            DOF2_SetBool
    #define dini_Bool               DOF2_GetBool
    #define dini_FloatSet           DOF2_SetFloat
    #define dini_Float              DOF2_GetFloat
    #define dini_Unset              DOF2_Unset
    #define dini_Isset              DOF2_IsSet
Reply
#5

Entгo, como posso fazer a conversгo DOF2?

ou como posso alterar este cуdigo com DINI? pode me mostrar um tutorial com base no meu cуdigo ali, para mim aprender como alterar e criar o arquivo e tudo?..
Reply
#6

Pra "converter " pra dof2, й so substituir os codigos dini por dof2 como o amigo ali em cima postou.
pawn Код:
if (!dini_Exists(arquivo))
isso й uma verificaзгo se o arquivo nгo (!) existe
Sу nгo esqueзa de por dof2 exit em ongamemodeexit
Reply
#7

Eu sei, jб mudei tudo para DOF, mais tipo, eu sу queria saber como posso editar aquele cуdigo meu ali em cima, pois nгo tenho ideia de como fazer com o dof, queria que alguйm em ajudasse nessa parte, tipo um tutorial usando DOF2 com base no meu cуdigo ali em cima.. criando salvando tudo e assim eu apre dendo e me ajudando..


Base neste cуdigo :

pawn Код:
else if (strcmp(x_Emprego, "veiculo", true) == 0)
            {
                new Vendedor = TransferenciaVeh2[playerid];
                if (TransferenciaVeh[playerid] == 1)
                {
                    if (IsPlayerConnected(TransferenciaVeh2[playerid]))
                    {
                        new str[256];
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        GetPlayerName(Vendedor, giveplayer, sizeof(giveplayer));
                        format(str, 256, "* %s aceitou sua proposta de consulta.", GetPlayerNameRP(playerid));
                        SendClientMessage(Vendedor, COLOR_LIGHTBLUE, str);
                        format(str, 256, "O dinheiro serб adicionado ao seu salбrio.");
                        SendClientMessage(Vendedor, COLOR_LIGHTBLUE, str);
                        format(str, 256, "* Vocк aceitou o atendimento do mйdico %s.", giveplayer);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
                        format(string, sizeof(string), "* Mйdico(a) %s estб atendendo paciente %s.", giveplayer, sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                        TransferenciaVeh[playerid] = 0;
                        GivePlayerMoneyEx(Vendedor, PrecoVeiculo[playerid]);
                       
                        new Placa = PlayerInfo[Vendedor][pCarro];
                        PlayerInfo[playerid][pCarro] = Placa;
                        PlayerInfo[Vendedor][pCarro] = 255; // daqui pra cima jб esta tudo fufando sу falta parte de sentar dof2
                       
                        /*new PlayerNick[MAX_PLAYER_NAME]; // daqui pra baixo nгo sei oque faзo '.'
                        GetPlayerName(playerid, PlayerNick, sizeof(PlayerNick));
                        new arquivo[256];
                        format(arquivo, sizeof(arquivo), "/Concessionaria/Proprietarios/%s.ini", PlayerNick);
                        if (!DOF2_FileExists(arquivo))
                        {
                            new idx = 1;
                            while (idx < sizeof(Carro))
                            {
                                if (strcmp(Carro[idx][cDono], "Ninguem", true) == 0)
                                {
                                    strmid(Carro[idx][cDono], PlayerNick, 0, strlen(PlayerNick), MAX_PLAYER_NAME);
                                    TaNoCarro[playerid] = idx;
                                   
                                    return 1;
                                }
                                else
                                {
                                    idx++;
                                }
                            }
                        }*/

                       
                       
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, "ERRO: Mйdico que tentou lhe atendeu nгo estб no momento.");
                        return 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GRAD1, "ERRO: Ninguйm lhe ofereceu uma consulta.");
                    return 1;
                }
            }
Sу isso..
Reply
#8

UP!!!!!!!!
Reply
#9

pawn Код:
dini_Exists             DOF2_FileExists
dini_Remove             DOF2_RemoveFile
dini_Create             DOF2_CreateFile
dini_Set                DOF2_SetString
dini_Get                DOF2_GetString
dini_IntSet             DOF2_SetInt
dini_Int                DOF2_GetInt
dini_BoolSet            DOF2_SetBool
dini_Bool               DOF2_GetBool
dini_FloatSet           DOF2_SetFloat
dini_Float              DOF2_GetFloat
dini_Unset              DOF2_Unset
dini_Isset              DOF2_IsSet
Se vocк quer converter dini para dof2 faзa o seguite. vai no pawno abra o gm depois aperte CRTL+H.
pawn Код:
Seach for:dini_Exists    
Replace with:DOF2_FileExists
depois clica em ok e depois yes to all. so fazer assim com todos usando a tabela ali em cime
Reply
#10

pawn Код:
DOF2_RenameFile("Atum.ini", "Sardinha.ini");
isso vai mudar o nome do ficheiro Atum.ini para Sardinha.ini ai tem a base.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)