28.07.2012, 13:05
how can I add airport gate that will open when you horn? i think that there should be one by default but there's nothing :X
#define FILTERSCRIPT
#include <a_samp>
forward CloseAirportGate();
new LSAirportGateA, LSAirportGateB, bool:AirportGateStatus;
public OnFilterScriptInit()
{
LSAirportGateA = CreateObject(988, 1964.342, -2189.776, 13.533, 0.0, 0.0, 180.0);
LSAirportGateB = CreateObject(988, 1958.851, -2189.777, 13.553, 0.0, 0.0, 180.0);
return true;
}
public OnFilterScriptExit()
{
DestroyObject(LSAirportGateA);
DestroyObject(LSAirportGateB);
return true;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if (IsPlayerInRangeOfPoint(playerid, 10.0, 1961.389, -2189.856, 13.553))
{
if (newkeys & KEY_CROUCH)
{
if (AirportGateStatus == false)
{
AirportGateStatus = true;
MoveObject(LSAirportGateA, 1968.697, -2189.776, 13.553, 5.0);
MoveObject(LSAirportGateB, 1954.571, -2189.777, 13.553, 5.0);
}
}
}
}
return true;
}
public OnObjectMoved(objectid)
{
if (objectid == LSAirportGateA)
{
if (AirportGateStatus)
SetTimer("CloseAirportGate", 1000, false);
}
return true;
}
public CloseAirportGate()
{
MoveObject(LSAirportGateA, 1964.342, -2189.776, 13.533, 5.0);
MoveObject(LSAirportGateB, 1958.851, -2189.777, 13.553, 5.0);
AirportGateStatus = false;
}