Loading a file from GameModeInit
#1

I'm trying to load the businesses from this file, and it's not working properly.. Any ideas?

GameModeInit():

pawn Код:
if(fexist("SFRP/Systems/Business/Businesses.cfg"))
    {
        new i;
        new File:bFile = fopen("SFRP/Systems/Business/Businesses.cfg", io_read);
        while(fread(bFile, string))
        {
            i++;
            biz = i;
            format(string, sizeof(string), "[INFO] Number of Businesses: %d", biz);
            printf(string);
        }
        bFile = fopen("SFRP/Systems/Business/Businesses.cfg", io_append);
        print("[INFO: Businesses.CFG] File opened");
        AddStaticPickup(1272, 23, string[2], string[3], string[4]);
        print("[INFO: Businesses.CFG] Pickup created");
        format(string, sizeof(string), "[%s]\n[Type: %d]\nPress Enter of F to enter.", string[5], string[6]);
        Create3DTextLabel(string,orange,string[1], string[2], string[3],40.0,0);
        print("[INFO: Businesses.CFG] 3DTextLabel created");
        fclose(bFile);
    }
It sends all three prints, it's just not reading the "string[1], string[2], ect.." part. I don't know how I would go about reading the file for just those lines.

Contents of a line:

pawn Код:
6, -1794.395629, 915.014709, 25.539310, Testing, 1
6: I was describing this as string[0], which seems to be working.
-1794.395629: I was describing this as string[1], but it doesn't seem to be working..
915.014709: I was describing this as string[2], but it doesn't seem to be working..
25.539310: I was describing this as string[3], but it doesn't seem to be working..
Testing: I was describing this as string[4], but it doesn't seem to be working..
1: I was describing this as string[5], but it doesn't seem to be working..

Any ideas?
Reply
#2

string[1], [2], [3] must be Float
Reply
#3

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
string[1], [2], [3] must be Float
I'll try that.
Reply
#4

I still need help, this didn't seem to work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)