which one?
#1

Which one is better at performance? (Sorry for bad indentation, I wrote these codes in this box )

pawn Код:
new Float:Array[][] =
{
    {X, Y, Z},
    {X, Y, Z},
    {X, Y, Z}
};

stock IsPlayerNearSomething(playerid)
{
    for(new i; i != sizeof(Array); ++i)
    {
        return IsPlayerInRangeOfPoint(playerid, radius, Array[i][0], Array[i][1], Array[i][2]);
    }
}
OR just

pawn Код:
stock IsPlayerNearSomething(playerid)
{
    if(IsPlayerInRangeOfPoint(playerid, radius, X, Y, Z) || IsPlayerInRangeOfPoint(playerid, radius, X, Y, Z) || IsPlayerInRangeOfPoint(playerid, radius, X, Y, Z)) return true;
    return false;
}
And, one question: Can I create stocks like this?

stock IsPlayerNearSomething(playerid)
{
return IsPlayerInRangeOfPoint(playerid, radius, X, Y, Z) || IsPlayerInRangeOfPoint(playerid, radius, X, Y, Z) || IsPlayerInRangeOfPoint(playerid, radius, X, Y, Z);
}
Reply


Messages In This Thread
which one? - by Gh0sT_ - 02.09.2011, 12:15
Re: which one? - by FireCat - 02.09.2011, 12:24
Re: which one? - by Gh0sT_ - 02.09.2011, 13:57
Re: which one? - by [MWR]Blood - 02.09.2011, 14:04
Re: which one? - by Pinguinn - 02.09.2011, 14:05
Re: which one? - by Gh0sT_ - 02.09.2011, 18:17
Re: which one? - by Zonoya - 02.09.2011, 18:18

Forum Jump:


Users browsing this thread: 1 Guest(s)