13.10.2016, 17:50
Hi, the function below is supposed to get player's owned houses, but it returns 249 (the size of MAX_HOUSES). Here's the function:
What's up here?
EDIT: All I had to do was check if the house existed before checking if the player owns it...
Код:
GetHouseCount(playerid) { new count; for (new i; i < MAX_HOUSES; i++) if (IsHouseOwner(playerid, i)) count++; return count; } IsHouseOwner(playerid, houseid) { if (!strcmp(HouseInfo[houseid][HouseOwner], GetName(playerid))) return 1; return 0; }
EDIT: All I had to do was check if the house existed before checking if the player owns it...