Quote:
Originally Posted by iLearner
PHP код:
print("search again.");
return FindBusiness(playerid);
This code will always be executed. to avoid it try it like this:
PHP код:
FindBusiness(playerid)
{
new i = random(ValidBusiness); // Total business
if(BusinessData[i][bizExists] && BusinessData[i][bizType] >= 1 && BusinessData[i][bizType] <= 4 && GetPlayerVirtualWorld(playerid) == BusinessData[i][bizExteriorVW] && GetPlayerInterior(playerid) == BusinessData[i][bizExterior])
{
if (BusinessData[i][bizDeliver][0] != 0.0 && BusinessData[i][bizDeliver][1] != 0.0 && BusinessData[i][bizDeliver][2] != 0.0)
{
print("found!");
return i;
}
}
else
{
print("search again.");
return FindBusiness(playerid);
}
}
But... if you're going through valid bussiness only then it should always find it.
|
But the function must end with a return.