Try this but change the end cords!! And post any errors warnings! Its not tested!
forward GateCheck(); // add this at rhe top of the script...
new gate; // add this at rhe top of the script...
SetTimer("GateCheck", 1000, 1 ); // add this in public OnGameModeInit()
gate = CreateObject( 985 , 2494.270751 , 2350.783447 , 10.867918 , 0.000000 , 0.000000 , 0.000000 ); // add this in public OnGameModeInit()
Код:
public GateCheck()
{
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerToPoint(25.0, i,1708.531250, 1616.638062, 10.721598))
{
MoveObject(gate,1708.531250, 1616.638062, 10.721598, 4.0); // Chnge the cords to the end position here...
}
else
{
MoveObject(gate, 2494.270751 , 2350.783447 , 10.867918, 4.0);
}
}
}
return 1;
}
PlayerToPoint(Float:radius, playerid, Float:X, Float:Y, Float:Z)
{
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
#pragma unused playerid
new Float:oldpos[3], Float:temppos[3];
GetPlayerPos(i, oldpos[0], oldpos[1], oldpos[2]);
temppos[0] = (oldpos[0] -X);
temppos[1] = (oldpos[1] -Y);
temppos[2] = (oldpos[2] -Z);
if(((temppos[0] < radius) && (temppos[0] > -radius)) && ((temppos[1] < radius) && (temppos[1] > -radius)) && ((temppos[2] < radius) && (temppos[2] > -radius)))
{
return true;
}
}
}
return false;
}