15.10.2011, 13:48
Hi Guys,
I have this code right here:
It half works. This bit however:
Is meant to increase RentIncome EACH TIME it finds a match. How ever, it just increases it by one the first time it finds a match. If rentingid == houseid it should increase and then keep checking until it reaches the end of "MAX_PLAYERS". But it stops at the first match and doesn't continue to raise RentIncome.
I have this code right here:
pawn Код:
if(PlayerInfo[i][HouseID] != 0)
{ //owns house or business
GiveMoney(i,-250);
format(string, sizeof(string), " Electricity Bill: -$250");
SendClientMessage(i, COLOR_GRAD1, string);
if(HouseInfo[PlayerInfo[i][HouseID]][hRentable] == 1)
{
for(new z = 0; z <= MAX_PLAYERS; z++)
{
if(PlayerInfo[z][RentingID] == PlayerInfo[i][HouseID])
{
RentIncome[i] += HouseInfo[PlayerInfo[i][HouseID]][hRentPrice];
break;
}
}
GiveMoney(i, RentIncome[i]);
format(string, sizeof(string)," Rent Income: $%d", RentIncome[i]);
SendClientMessage(i, COLOR_GRAD1, string);
RentIncome[i] = 0;
}
}
It half works. This bit however:
pawn Код:
for(new z = 0; z <= MAX_PLAYERS; z++)
{
if(PlayerInfo[z][RentingID] == PlayerInfo[i][HouseID])
{
RentIncome[i] += HouseInfo[PlayerInfo[i][HouseID]][hRentPrice];
break;
}
}


