26.06.2014, 12:20
pawn Код:
#include <a_samp>
#define MAX_GATES 2
new Gate[MAX_GATES][3];
public OnFilterScriptInit()
{
Gate[0][0] = CreateObject(971, 1588.5000000, -1638.3000000, 14.1000000, 0.0000000, 0.0000000, 0.0000000);
Gate[1][0] = CreateObject(968, 1544.7000000, -1630.8000000, 13.1000000, 0.0000000, 90, 89.4800415);
Gate[0][1] = Gate[1][1] = 1;
return 1;
}
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
if(newkeys & KEY_SUBMISSION)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(IsPlayerInRangeOfPoint(playerid, 10.0, 1588.5000000, -1638.3000000, 14.1000000))
{
if(Gate[0][1]) KillTimer(Gate[0][2]);
MoveObject(Gate[0][0], (Gate[0][0]) ? (1598.5000000) : (1588.5000000), -1638.3000000, 14.1000000, 5, 0.0000000, 0.0000000, 0.0000000);
Gate[0][1] = (Gate[0][1]) ? (0) : (1);
Gate[0][2] = SetTimer("ResetGate1", 10000, false);
}
else if(IsPlayerInRangeOfPoint(playerid, 10.0, 1544.7000000, -1630.8000000, 13.1000000))
{
if(Gate[1][1]) KillTimer(Gate[1][2]);
MoveObject(Gate[1][0], 1544.7000000, -1630.8000000, 13.1000001, 1, 0.0000000, (Gate[1][1]) ? (90.0000000) : (0.0000000), 89.4800415);
Gate[1][1] = (Gate[1][1]) ? (0) : (1);
Gate[1][2] = SetTimer("ResetGate2", 10000, false);
}
}
}
return 1;
}
forward ResetGate1();
forward ResetGate2();
public ResetGate1()
{
MoveObject(Gate[0][0], 1588.5000000, -1638.3000000, 14.1000000, 5, 0.0000000, 0.0000000, 0.0000000);
Gate[0][1] = 0;
return 1;
}
public ResetGate2()
{
MoveObject(Gate[1][0], 1544.7000000, -1630.8000000, 13.1000000, 1, 0.0000000, 90, 89.4800415);
Gate[1][1] = 0;
return 1;
}