Saving error
#1

pawn Код:
stock LoadContacts(playerid)
{
    new str[MAX_PLAYER_NAME+20];
    format(str, MAX_PLAYER_NAME+4, "contacts/%s.cfg",GetPlayerNameEx(playerid));
    if(!fexist(str)) fcreate(str);
    new binfo[2][MAX_PLAYER_NAME];
    new string[256];
    new File:file = fopen(str, io_read);
    if(file)
    {
        new idx = 1;
        while(idx < 20)
        {
            fread(file, string);
            split(string, binfo, '|');
            format(Contacts[playerid][idx], MAX_PLAYER_NAME, "%s", binfo[0]);
            format(ContactsNum[playerid][idx], 6, "%s", binfo[1]);
            idx++;
        }
    }
    print("Contacts loaded successfully.");
    return 1;
}
There is an error resulting from this code.
The file does not load properly.
Reply
#2

pawn Код:
format(str, MAX_PLAYER_NAME+4, "contacts/%s.cfg",GetPlayerNameEx(playerid));
Should be:

pawn Код:
format(str, MAX_PLAYER_NAME+4, "/contacts/%s.cfg",GetPlayerNameEx(playerid));
"format(str, MAX_PLAYER_NAME+4, "/contacts/%s.cfg",GetPlayerNameEx(playerid));"

Try it.
Reply
#3

No difference.
Reply
#4

Erm, can't anyone actually help?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)