27.02.2014, 19:41
Maybe this help you out....
new LSAPGateA, LSAPGateB, bool:AirportGateStatus;
public OnFilterScriptInit()
{
LSAPGateA = CreateObject(988, 1964.342, -2189.776, 13.533, 0.0, 0.0, 180.0);
LSAPGateB = CreateObject(988, 1958.851, -2189.777, 13.553, 0.0, 0.0, 180.0);
return 1;
}
public OnFilterScriptExit()
{
DestroyObject(LSPGateA);
DestroyObject(LSAPGateB);
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if (IsPlayerInRangeOfPoint(playerid, 10.0, 1961.389, -2189.856, 13.553))
{
if (AirportGateStatus == false)
{
AirportGateStatus = true;
MoveObject(LSAPGateA, 1968.697, -2189.776, 13.553, 5.0);
MoveObject(LSAPGateB, 1954.571, -2189.777, 13.553, 5.0);
}
}
}
return 1;
}
public OnObjectMoved(objectid)
{
if (objectid == LSAirportGateA)
{
if (AirportGateStatus)
SetTimer("CloseAirportGate", 1000, false);
}
return true;
}
public CloseAirportGate()
{
MoveObject(LSAPGateA, 1964.342, -2189.776, 13.533, 5.0);
MoveObject(LSAPGateB, 1958.851, -2189.777, 13.553, 5.0);
AirportGateStatus = false;
}
new LSAPGateA, LSAPGateB, bool:AirportGateStatus;
public OnFilterScriptInit()
{
LSAPGateA = CreateObject(988, 1964.342, -2189.776, 13.533, 0.0, 0.0, 180.0);
LSAPGateB = CreateObject(988, 1958.851, -2189.777, 13.553, 0.0, 0.0, 180.0);
return 1;
}
public OnFilterScriptExit()
{
DestroyObject(LSPGateA);
DestroyObject(LSAPGateB);
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if (IsPlayerInRangeOfPoint(playerid, 10.0, 1961.389, -2189.856, 13.553))
{
if (AirportGateStatus == false)
{
AirportGateStatus = true;
MoveObject(LSAPGateA, 1968.697, -2189.776, 13.553, 5.0);
MoveObject(LSAPGateB, 1954.571, -2189.777, 13.553, 5.0);
}
}
}
return 1;
}
public OnObjectMoved(objectid)
{
if (objectid == LSAirportGateA)
{
if (AirportGateStatus)
SetTimer("CloseAirportGate", 1000, false);
}
return true;
}
public CloseAirportGate()
{
MoveObject(LSAPGateA, 1964.342, -2189.776, 13.533, 5.0);
MoveObject(LSAPGateB, 1958.851, -2189.777, 13.553, 5.0);
AirportGateStatus = false;
}