02.10.2015, 10:24
Im optimizing my script, and i have 1 question.
What is better of these 3 ways?
1. way
2. way
3. way
What is better of these 3 ways?
1. way
Код:
IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)
Код:
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:temp1posx, Float:temp1posy, Float:temp1posz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
temp1posx = (oldposx -x);
temp1posy = (oldposy -y);
temp1posz = (oldposz -z);
if (((temp1posx < radi) && (temp1posx > -radi)) && ((temp1posy < radi) && (temp1posy > -radi)) && ((temp1posz < radi) && (temp1posz > -radi)))
{
return 1;
}
}
return 0;
}
Код:
public PlayerToPointStripped(Float:radi, playerid, Float:x, Float:y, Float:z, Float:curx, Float:cury, Float:curz)
{
if(IsPlayerConnected(playerid))
{
new Float:temp1posx, Float:temp1posy, Float:temp1posz;
temp1posx = (curx -x);
temp1posy = (cury -y);
temp1posz = (curz -z);
if (((temp1posx < radi) && (temp1posx > -radi)) && ((temp1posy < radi) && (temp1posy > -radi)) && ((temp1posz < radi) && (temp1posz > -radi))) return 1;
}
return 0;
}


