[Ajuda] Ao ler arquivo .ini
#1

alguem pode me ensinar como eu leio e armazeno o valor de uma variбvel, usando Y_Ini?

exemplo:

arquivo.ini > new dinheiro = get(arquivo,"Dinheiro")
Reply
#2

olhem oque eu fiz:

Код:
new teste
public CarregarGang( playerid, name[ ], value[ ] )
{
    if(!strcmp(name,"Dinheiro")) teste = strval(value);
}

format(pArquivo, sizeof(pArquivo), "Gangs/%d.ini", pGang);
INI_ParseFile( pArquivo, "CarregarGang", false, true, pGang, true, false);
Reply
#3

sу pra completar, a variбvel teste fica com o valor 0
Reply
#4

Entrada:
pawn Код:
#include <YSI\y_ini>

new teste;

forward CarregarGang( playerid, name[ ], value[ ] );
public CarregarGang( playerid, name[ ], value[ ] )
{
    if(!strcmp(name,"Dinheiro")) teste = strval(value);
}

public OnGameModeInit()
{
    new pArquivo[24];
    new pGang = 1; // Para o teste
    format(pArquivo, sizeof(pArquivo), "Gangs/%d.ini", pGang);
    INI_ParseFile( pArquivo, "CarregarGang", false, true, pGang, true, false);
    printf("teste %i", teste);
    return 1;
}
Saнda:


Tem certeza que o arquivo existe e que o valor estб escrito nele?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)