08.06.2013, 08:29
pawn Код:
#include <a_samp>
new Gate;
new GateOpen =0;
forward GatesOpen();
forward GatesClose();
main( ){ }
public OnGameModeInit()
{
SetTimer("GatesOpen",1000,1);
Gate = CreateObject(3578, 1810.63013, 813.19897, 10.39397, 0.00000, 0.00000, 359.99155);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public GatesOpen()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(PlayerToPoint(10.0, i, 1810.8959,806.5244,10.9965) && GateOpen == 0)
{
{
MoveObject(Gate, 3578, 1810.63013, 813.19897, 9.07167, 5);
GateOpen =1;
SetTimer("GatesClose",7000,0);
}
}
}
}
public GatesClose()
{
MoveObject(Gate,3578, 1810.63013, 813.19897, 10.39397, 5);
GateOpen =0;
}
PlayerToPoint(Float:radius, playerid, Float:X, Float:Y, Float:Z)
{
new Float:oldpos[3], Float:temppos[3];
GetPlayerPos(playerid, 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;
}