02.04.2017, 02:57
I made a function to get the house id which player is near with the range is 2.0.
the problem is it never returns -1, it just returns the house id when the player is near any houses, but if the player is not near any houses, it doesn't return anything.
and it also doesn't print "Exterior ID : -1" on the console.
the problem is it never returns -1, it just returns the house id when the player is near any houses, but if the player is not near any houses, it doesn't return anything.
and it also doesn't print "Exterior ID : -1" on the console.
PHP код:
GetHouseExteriorNear(playerid){
for(new i = 1; i <= MAX_HOUSES; i++){
if(IsPlayerInRangeOfPoint(playerid, 2.0, CharacterHouse[i][chExteriorX], CharacterHouse[i][chExteriorY], CharacterHouse[i][chExteriorZ])){
if(GetPlayerVirtualWorld(playerid) == CharacterHouse[i][chExteriorVW]){
return i;
}
}
}
print("Exterior ID : -1");
return -1;
}