Loading a file from GameModeInit - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Loading a file from GameModeInit (
/showthread.php?tid=166781)
Loading a file from GameModeInit -
(.Aztec); - 09.08.2010
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?
Re: Loading a file from GameModeInit - [L3th4l] - 10.08.2010
string[1], [2], [3] must be Float
Re: Loading a file from GameModeInit -
(.Aztec); - 10.08.2010
Quote:
Originally Posted by [L3th4l]
string[1], [2], [3] must be Float
|
I'll try that.
Re: Loading a file from GameModeInit -
(.Aztec); - 10.08.2010
I still need help, this didn't seem to work.