Unknown command?
#5

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
Reply


Messages In This Thread
Unknown command? - by LegendOfScripts - 12.03.2015, 12:06
Re: Unknown command? - by Misiur - 12.03.2015, 12:28
Re: Unknown command? - by LegendOfScripts - 12.03.2015, 12:47
Re: Unknown command? - by Misiur - 12.03.2015, 13:15
Re: Unknown command? - by LegendOfScripts - 12.03.2015, 14:34
Re: Unknown command? - by Misiur - 12.03.2015, 14:43
Re: Unknown command? - by LegendOfScripts - 12.03.2015, 15:05
Re: Unknown command? - by Misiur - 12.03.2015, 15:11
Re: Unknown command? - by LegendOfScripts - 12.03.2015, 18:46
Re: Unknown command? - by oliverrud - 12.03.2015, 18:52

Forum Jump:


Users browsing this thread: 1 Guest(s)