24.09.2016, 09:20
Read more about why you can't use Iter_Remove inside a foreach of same iterator loop
if you are gonna keep looping you need to use Iter_SafeRemove (not the case here by the looks of it tho)
Edit: gurmani11's solution is wrong, simply because you shouldn't return the not inrange error while in loop, you should do that after looping has finished and no house were found, and return 1 to exit the function when you have deleted the house.
In his way if you are not in range of first home it'll stop looping and show you the error.
if you are gonna keep looping you need to use Iter_SafeRemove (not the case here by the looks of it tho)
Edit: gurmani11's solution is wrong, simply because you shouldn't return the not inrange error while in loop, you should do that after looping has finished and no house were found, and return 1 to exit the function when you have deleted the house.
In his way if you are not in range of first home it'll stop looping and show you the error.
PHP код:
for()
{
...
if(IsPlayerInRange...)
{
...
return 1;
}
}
SendClientMessage(playerid, COLOR_RED, "ERROR: No house in range to delete.");
return 1;