06.04.2019, 05:11
(
Last edited by Markski; 07/04/2019 at 12:15 AM.
)
You need to break the loop with "break;" in order to stop looking for houses once you find it. Try this code.
PHP Code:
for(new i = 1; i <= 105; i++) {
if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez])) {
HouseInfo[i][hType] = type;
mysql_format(SQL,str,sizeof(str), "UPDATE houses SET `Type`='%d' WHERE `ID`='%d'",type,HouseInfo[i][hID]);
mysql_tquery(SQL,str,"","");
break;
} else {
SendClientMessage(playerid, COLOR_LIGHTRED, "You aren't in range of any house");
return 1;
}
}