Posts: 75
Threads: 11
Joined: Feb 2015
Quote:
Originally Posted by Misiur
pawn Код:
//Put that somerwhere high #define INVALID_HOUSE_ID (1000)
//And this where it was stock GetPlayerInOwnedHouse(playerid) //Get's the ID Of the closest house to the player if they are withing a range of 3.0 { for(new h = 0; h < MAX_OWNABLE_HOUSES+1;h++) { new string1[24], key ;
format(string1, sizeof(string1), "HouseKey_%d", h+1); key = GetPVarInt(playerid, string1); if (key == INVALID_HOUSE_ID) { continue; }
if(IsPlayerInRangeOfPoint(playerid, 50.0,HouseInfo[key][HouseIntPos][0],HouseInfo[key][HouseIntPos][1],HouseInfo[key][HouseIntPos][2]) && GetPlayerVirtualWorld(playerid) == HouseInfo[key][Vw]) { return h+1; } } //We need to return invalid ID if house is not near someone return INVALID_HOUSE_ID; }
I have one recommendation though, use -1 as invalid house id, because if you want in future more than 1000 houses, you'll have to edit all invalid house ids. Also don't use "magic numbers", as you've used 1000, but define it in one place, then use it everywhere.
|
still says unknown command