1 random nearly house(problem with code)
#1

Hello, i want to get 1 random nearly houses, but it doesnt work.

The code is:
Код:
	new rand = random(MAX_HOUSES - 1);
	while(!(HouseInfo[rand][hExteriorZ] <= 100 && HouseInfo[rand][hExteriorX] > 2402.6104 && HouseInfo[rand][hExteriorX] < 2498.5225 && HouseInfo[rand][hExteriorY] < 1334.343750 && HouseInfo[rand][hExteriorY] > -1644.7028))
	{
	    rand++;
	    if(rand == 1400) {
	    	rand = 1;
		}
	}
I'm begginner of scripting. Sorry for my english
Reply
#2

Well, I'm sorry if I understood you wrong but if you have tried to do what I think, which is getting all the nearly houses around the player so this is the code for you and if you meant something else, please let me know and I'll sort it out already:

PHP код:
for(new 0r  MAXA_HOUSESr++)
    {
        if(!
IsPlayerInRangeOfPoint(playerid30HouseInfo[rand][hExteriorX], HouseInfo[rand][hExterioY], HouseInfo[rand][hExteriorZ)) continue;
        {
            
// what happens
        
}
    } 
Reply
#3

no, I edin my post. I want just 1 random house nearly the player.
Reply
#4

PHP код:
new rand;
while(!
IsPlayerInRangeOfPoint(playerid30HouseInfo[rand][hExteriorX], HouseInfo[rand][hExterioY], HouseInfo[rand][hExteriorZ))
{
    
rand random(MAX_HOUSES-1);
}
// What happens. 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)