I am so stumped with this function!
#1

I am trying to make a function, which is self explanatory when viewed, it's supposed to add a house.
Код:
forward AddHouse(playerid, houseid, interiorid, cost, Float:xx, Float:yy, Float:zz);
Код:
enum hInfo
{
	hHouseId,
	hHouseInterior,
	Float:hHousex,
	Float:hHousey,
	Float:hHousez,
	hHouseCost,
	hHouseOwnerId,
	hHouseOwnerName[16],
	hHouseLocked,
};
Код:
new HouseInfo[MAX_HOUSES][hInfo];
new HousePickup[MAX_HOUSES];
new houses;
Код:
public AddHouse(playerid, houseid, interiorid, cost, Float:xx, Float:yy, Float:zz)
{

		new string[128];
		format(string, sizeof(string), "%s.cer", houses + 1);
		new File:hFile;
		hFile = fopen(string, io_append);
		HouseInfo[houseid][hHouseCost] = cost;
		HouseInfo[houseid][hHouseInterior] = interiorid;
	 	HouseInfo[houseid][hHouseId] = houseid;
		HouseInfo[houseid][hHouseLocked] = 1;
		GetPlayerPos(playerid, xx, yy, zz);
		HouseInfo[houseid][hHousex] = xx;
		HouseInfo[houseid][hHousey] = yy;
		HouseInfo[houseid][hHousez] = zz;
		new stringowner[16];
		format(stringowner, sizeof(stringowner), "None");
		HouseInfo[houseid][hHouseOwnerName] = stringowner;
		HouseInfo[houseid][hHouseOwnerId] = 255;
		HousePickup[houseid] = CreatePickup(1273,1,xx,yy,zz);
		new var[32];//
		format(var, 32, "%s\n", HouseInfo[playerid][hHouseOwnerName]);fwrite(hFile, var);
    format(var, 32, "HouseOwnerId=%d\n", HouseInfo[playerid][hHouseOwnerId]);fwrite(hFile, var);
		format(var, 32, "HouseInterior=%d\n", HouseInfo[playerid][hHouseInterior]);fwrite(hFile, var);
    format(var, 32, "HouseId=%d\n", HouseInfo[playerid][hHouseId]);fwrite(hFile, var);
    format(var, 32, "Cost=%d\n", HouseInfo[playerid][hHouseCost]);fwrite(hFile, var);
    format(var, 32, "Locked=%d\n", HouseInfo[playerid][hHouseLocked]);fwrite(hFile, var);
    format(var, 32, "HouseX=%d\n", HouseInfo[playerid][hHousex]);fwrite(hFile, var);
    format(var, 32, "HouseY=%d\n", HouseInfo[playerid][hHousey]);fwrite(hFile, var);
    format(var, 32, "HouseZ=%d\n", HouseInfo[playerid][hHousez]);fwrite(hFile, var);
    format(var, 32, "HouseX=%d\n", HouseInfo[playerid][hHousex]);fwrite(hFile, var);
		fclose(hFile);

}
It does not write the file at all, can you help me please? I must be screwing up somewhere
Reply


Messages In This Thread
I am so stumped with this function! - by Paladin - 07.08.2009, 21:47
Re: I am so stumped with this function! - by MadeMan - 07.08.2009, 21:56
Re: I am so stumped with this function! - by Paladin - 07.08.2009, 21:57
Re: I am so stumped with this function! - by MadeMan - 07.08.2009, 21:59
Re: I am so stumped with this function! - by Paladin - 07.08.2009, 22:01
Re: I am so stumped with this function! - by MadeMan - 07.08.2009, 22:04
Re: I am so stumped with this function! - by Paladin - 07.08.2009, 22:08
Re: I am so stumped with this function! - by MadeMan - 07.08.2009, 22:13
[FIXED] I am so stumped with this function! - by Paladin - 07.08.2009, 22:15

Forum Jump:


Users browsing this thread: 2 Guest(s)