[FIXXED] -
Paladin - 08.08.2009
I don't know how long i've been trying this, my final way to do this is to look at another scripts and attempt to make my own in a similar way.
Bascially, It reads from a file: scriptfiles/houses/house.cfg and creates pickups there:
The way I've created it to being in the house.cfg file is:
OwnerName, HouseCost, HouseId, HouseInterior, HouseXPos, HouseYPos, HouseZPos
Here is what I have in it:
Код:
None, 1000, 1, 4, -987908085, -1004970794, 1124372480
Here is the code I am trying to get to load that:
Код:
forward LoadHouse();
Код:
public LoadHouses()
{
new arrCoords[29][64];
new strFromFile2[256];
new File: file = fopen("houses/house.cfg", io_read);
if (file)
{
new idx;
while (idx < sizeof(HouseInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
strmid(HouseInfo[idx][hHouseOwnerName], arrCoords[13], 0, strlen(arrCoords[13]), 255);
HouseInfo[idx][hHouseCost] = strval(arrCoords[14]);
HouseInfo[idx][hHouseId] = strval(arrCoords[14]);
HouseInfo[idx][hHouseInterior] = strval(arrCoords[14]);
HouseInfo[idx][hHousex] = floatstr(arrCoords[0]);
HouseInfo[idx][hHousey] = floatstr(arrCoords[1]);
HouseInfo[idx][hHousez] = floatstr(arrCoords[2]);
CreatePickup(1273, 1, HouseInfo[idx][hHousex], HouseInfo[idx][hHousey], HouseInfo[idx][hHousez]);
idx++;
}
fclose(file);
}
return 1;
}
Yes, if you are wondering I got the idea of the layout from The GodFather Script, It was a last resort as is asking you this! why is it not loading?
Re: I am tired of this -
Paladin - 08.08.2009
Yes, I am bumping it because it went to the other page and no help was received.
Please assist
Thank you.
Re: I am tired of this -
Backwardsman97 - 08.08.2009
I wanna help you with this. I will try and fix it and edit it in when I'm done.
Re: I am tired of this -
Paladin - 09.08.2009
Another bump, since it is on the third page, any assistance please, I seriously need to solve this problem.
Re: I am tired of this -
Jonny_Bravo - 09.08.2009
Hmm.... Wow, I have tried to work out why it's not loading but sorry I couldn't find out why. Sorry.
Re: I am tired of this -
MadeMan - 09.08.2009
pawn Код:
public LoadHouses()
{
new arrCoords[7][64];
new strFromFile2[256];
new File: file = fopen("houses/house.cfg", io_read);
if (file)
{
new idx;
while (idx < sizeof(HouseInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
strmid(HouseInfo[idx][hHouseOwnerName], arrCoords[0], 0, strlen(arrCoords[0]), 255);
HouseInfo[idx][hHouseCost] = strval(arrCoords[1]);
HouseInfo[idx][hHouseId] = strval(arrCoords[2]);
HouseInfo[idx][hHouseInterior] = strval(arrCoords[3]);
HouseInfo[idx][hHousex] = floatstr(arrCoords[4]);
HouseInfo[idx][hHousey] = floatstr(arrCoords[5]);
HouseInfo[idx][hHousez] = floatstr(arrCoords[6]);
CreatePickup(1273, 1, HouseInfo[idx][hHousex], HouseInfo[idx][hHousey], HouseInfo[idx][hHousez]);
idx++;
}
fclose(file);
}
return 1;
}
Re: I am tired of this -
Paladin - 10.08.2009
Quote:
Originally Posted by MadeMan
pawn Код:
public LoadHouses() { new arrCoords[7][64]; new strFromFile2[256]; new File: file = fopen("houses/house.cfg", io_read); if (file) { new idx; while (idx < sizeof(HouseInfo)) { fread(file, strFromFile2); split(strFromFile2, arrCoords, ','); strmid(HouseInfo[idx][hHouseOwnerName], arrCoords[0], 0, strlen(arrCoords[0]), 255); HouseInfo[idx][hHouseCost] = strval(arrCoords[1]); HouseInfo[idx][hHouseId] = strval(arrCoords[2]); HouseInfo[idx][hHouseInterior] = strval(arrCoords[3]); HouseInfo[idx][hHousex] = floatstr(arrCoords[4]); HouseInfo[idx][hHousey] = floatstr(arrCoords[5]); HouseInfo[idx][hHousez] = floatstr(arrCoords[6]); CreatePickup(1273, 1, HouseInfo[idx][hHousex], HouseInfo[idx][hHousey], HouseInfo[idx][hHousez]); idx++; } fclose(file); } return 1; }
|
That didn't work.
Re: I am tired of this -
MadeMan - 10.08.2009
Where do you use the function LoadHouses() ?
Re: I am tired of this -
Paladin - 10.08.2009
OnGameModeInit
Re: I am tired of this -
MadeMan - 10.08.2009
Maybe try adding "/" to the file source.
pawn Код:
new File: file = fopen("/houses/house.cfg", io_read);
EDIT: I tested it and it works for me even if I don't add that extra "/".