SA-MP Forums Archive
House System read plz - 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: House System read plz (/showthread.php?tid=121329)



House System read plz - Naruto4 - 16.01.2010

i made this but it doesnt print well information in the console.(too much lines,not reading words)
i have a folder houses and in it 5 files. (0.ini,1.ini,2.ini,3.ini,4.ini)
size of houses is 5.
Код:
public LoadHouse(houseid)
{
	new file[24];
	format(file,24,"\\Houses\\%d.ini",houseid);
	while (houseid < sizeof(HouseInfo))
	{
		HouseInfo[houseid][hHouse] = dini_Int(file,"Owner");
		HouseInfo[houseid][hOwned] = dini_Int(file,"Owned");
		HouseInfo[houseid][hOwner] = dini_Int(file,"Owner");
		HouseInfo[houseid][hPickupX] = dini_Int(file,"PickupX");
		HouseInfo[houseid][hPickupY] = dini_Int(file,"PickupY");
		HouseInfo[houseid][hPickupZ] = dini_Int(file,"PickupZ");
		HouseInfo[houseid][hHouseX] = dini_Int(file,"HouseX");
    HouseInfo[houseid][hHouseY] = dini_Int(file,"HouseY");
    HouseInfo[houseid][hHouseZ] = dini_Int(file,"HouseZ");
    HouseInfo[houseid][hInterior] = dini_Int(file,"Interior");
    HouseInfo[houseid][hVW] = dini_Int(file,"VW");
    HouseInfo[houseid][hLvL] = dini_Int(file,"LvL");
    HouseInfo[houseid][hStage] = dini_Int(file,"Stage");
    HouseInfo[houseid][hSell] = dini_Int(file,"Sell");
    HouseInfo[houseid][hSellable] = dini_Int(file,"Sellable");
    HouseInfo[houseid][hRentFee] = dini_Int(file,"RentFee");
    HouseInfo[houseid][hOpen] = dini_Int(file,"Open");
		printf("%s: Owner:%s Price:%d RentFee:%d",HouseInfo[houseid][hHouse],HouseInfo[houseid][hOwned],HouseInfo[houseid][hSell],HouseInfo[houseid][hRentFee]);
		houseid++;
	}
	houseid=0;
	return 1;
}



Re: House System read plz - MadeMan - 16.01.2010

What is the problem?


Re: House System read plz - Naruto4 - 16.01.2010

It spams same line few times.
this format:

one line
one line
one line
one line
second line
second line
second line
third line
third line
four line ( all values are 0 here,above normal)


Re: House System read plz - MadeMan - 16.01.2010

Show how you use the LoadHouse function.


Re: House System read plz - Naruto4 - 17.01.2010

lol it is in my first post:
Код:
public LoadHouse(houseid)
{
	new file[24];
	format(file,24,"\\Houses\\%d.ini",houseid);
	while (houseid < sizeof(HouseInfo))
	{
		HouseInfo[houseid][hHouse] = dini_Int(file,"Owner");
		HouseInfo[houseid][hOwned] = dini_Int(file,"Owned");
		HouseInfo[houseid][hOwner] = dini_Int(file,"Owner");
		HouseInfo[houseid][hPickupX] = dini_Int(file,"PickupX");
		HouseInfo[houseid][hPickupY] = dini_Int(file,"PickupY");
		HouseInfo[houseid][hPickupZ] = dini_Int(file,"PickupZ");
		HouseInfo[houseid][hHouseX] = dini_Int(file,"HouseX");
    HouseInfo[houseid][hHouseY] = dini_Int(file,"HouseY");
    HouseInfo[houseid][hHouseZ] = dini_Int(file,"HouseZ");
    HouseInfo[houseid][hInterior] = dini_Int(file,"Interior");
    HouseInfo[houseid][hVW] = dini_Int(file,"VW");
    HouseInfo[houseid][hLvL] = dini_Int(file,"LvL");
    HouseInfo[houseid][hStage] = dini_Int(file,"Stage");
    HouseInfo[houseid][hSell] = dini_Int(file,"Sell");
    HouseInfo[houseid][hSellable] = dini_Int(file,"Sellable");
    HouseInfo[houseid][hRentFee] = dini_Int(file,"RentFee");
    HouseInfo[houseid][hOpen] = dini_Int(file,"Open");
		printf("%s: Owner:%s Price:%d RentFee:%d",HouseInfo[houseid][hHouse],HouseInfo[houseid][hOwned],HouseInfo[houseid][hSell],HouseInfo[houseid][hRentFee]);
		houseid++;
	}
	houseid=0;
	return 1;
}



Re: House System read plz - MadeMan - 17.01.2010

This is the function itself, but where and how do you use it?


Re: House System read plz - Naruto4 - 17.01.2010

oh i forward it and put it under gamemodeinit


Re: House System read plz - MadeMan - 17.01.2010

Quote:
Originally Posted by Naruto4
oh i forward it and put it under gamemodeinit
Can you show it in your script?


Re: House System read plz - Naruto4 - 17.01.2010

Код:
forward LoadHouse(houseid);
under gamemodeinit
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
	LoadHouse(i);
}



Re: House System read plz - MadeMan - 17.01.2010

Try these:

pawn Код:
public LoadHouse(houseid)
{
    new file[24];
    format(file,24,"\\Houses\\%d.ini",houseid);

    HouseInfo[houseid][hHouse] = dini_Int(file,"Owner");
    HouseInfo[houseid][hOwned] = dini_Int(file,"Owned");
    HouseInfo[houseid][hOwner] = dini_Int(file,"Owner");
    HouseInfo[houseid][hPickupX] = dini_Int(file,"PickupX");
    HouseInfo[houseid][hPickupY] = dini_Int(file,"PickupY");
    HouseInfo[houseid][hPickupZ] = dini_Int(file,"PickupZ");
    HouseInfo[houseid][hHouseX] = dini_Int(file,"HouseX");
    HouseInfo[houseid][hHouseY] = dini_Int(file,"HouseY");
    HouseInfo[houseid][hHouseZ] = dini_Int(file,"HouseZ");
    HouseInfo[houseid][hInterior] = dini_Int(file,"Interior");
    HouseInfo[houseid][hVW] = dini_Int(file,"VW");
    HouseInfo[houseid][hLvL] = dini_Int(file,"LvL");
    HouseInfo[houseid][hStage] = dini_Int(file,"Stage");
    HouseInfo[houseid][hSell] = dini_Int(file,"Sell");
    HouseInfo[houseid][hSellable] = dini_Int(file,"Sellable");
    HouseInfo[houseid][hRentFee] = dini_Int(file,"RentFee");
    HouseInfo[houseid][hOpen] = dini_Int(file,"Open");
    printf("%s: Owner:%s Price:%d RentFee:%d",HouseInfo[houseid][hHouse],HouseInfo[houseid][hOwned],HouseInfo[houseid][hSell],HouseInfo[houseid][hRentFee]);
    return 1;
}
under OnGameModeInit

pawn Код:
for(new i = 0; i < sizeof(HouseInfo); i++)
{
    LoadHouse(i);
}