06.11.2010, 11:11
pawn Код:
stock IsPlayerInRangeOfPoint(playerid, Float:radius, Float:X, Float:Y, Float:Z)
{
new Float:px, Float:py, Float:pz;
GetPlayerPos(playerid, px, py, pz);
return((((px-X)*(px-X))+((py-Y)*(py-Y))+((pz-Z)*(pz-Z))) >= radius*radius);
}
pawn Код:
public CheckEnteranceGateToMove(playerid)
{
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,10.0, -2896.298096, 1235.049805, 8.874954)) mygate_status = 1;
}
if(mygate_status)MoveObject(enterance, -2896.298096, 1235.049805, 2.874954, 2.0);
else if(mygate_status)MoveObject(enterance, -2896.298096, 1235.049805, 8.874954, 2.0);
}