You're nowhere close to any house.
#7

Quote:
Originally Posted by Tayab
Посмотреть сообщение
Any suggestion how to check if money is greater than the house price without loop? Or I create another loop above this one?
Ah sorry, I overlooked. That can be in the loop. However, it's probably a better practice to first establish that they are, in fact, in range. You can break the loop at that point and access the array directly.

pawn Код:
new houseid = -1;
for(new i = 0; i < MAX_HOUSES; i++)
{
    if(IsPlayerInRangeOfPoint(playerid,2,HouseInfo[i][hX],HouseInfo[i][hY],HouseInfo[i][hZ]))
    {
        houseid = i;
        break;
    }
}

if(houseid == -1)
{
    // Not in range
    return 1;
}

if(GetPlayerMoney(playerid) >= HouseInfo[houseid][hPrice])
{
    // etc, etc
}
Reply


Messages In This Thread
You're nowhere close to any house. - by Tayab - 23.01.2014, 20:56
Re: You're nowhere close to any house. - by Scottas - 23.01.2014, 21:06
Re: You're nowhere close to any house. - by Vince - 23.01.2014, 21:39
Re: You're nowhere close to any house. - by Tayab - 23.01.2014, 23:20
Re: You're nowhere close to any house. - by Tayab - 24.01.2014, 01:22
Re: You're nowhere close to any house. - by Scottas - 24.01.2014, 07:16
Re: You're nowhere close to any house. - by Vince - 24.01.2014, 08:14

Forum Jump:


Users browsing this thread: 1 Guest(s)