House System read plz
#1

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;
}
Reply
#2

What is the problem?
Reply
#3

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)
Reply
#4

Show how you use the LoadHouse function.
Reply
#5

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;
}
Reply
#6

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

oh i forward it and put it under gamemodeinit
Reply
#8

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

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

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);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)