All pastes #895663 Raw Edit

TigerTails

public c v1 · immutable
·published 2008-02-07 23:51 UTC
rendered paste body
// Filterscript Information:// - Name: Airport Gate// - Date: 07 February 2008// - Author: TigerTails//// For questions join #Tiger on irc.gtanet.com// Credit goes to someone else for PointToPoint, I don't know who..#include <a_samp>// Variablesnew lsapg1, lsapg2;new sf1apg1, sf1apg2;new sf2apg1, sf2apg2;new lvapg1, lvapg2;// Forwardsforward CloseAPGate(airportid, playerid);forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);forward CheckAPGates();public OnGameModeInit(){	lsapg1 = CreateObject(988, 1964.342, -2189.776, 13.533, 0, 0, 180.0);	lsapg2 = CreateObject(988, 1958.851, -2189.777, 13.553, 0, 0, 180.0);		sf1apg1 = CreateObject(988, -1543.742, -432.703, 6.039, 0, 0, -45.0);	sf1apg2 = CreateObject(988, -1547.625, -428.82, 6.039, 0, 0, -45.0);		sf2apg1 = CreateObject(988, -1222.953, 53.826, 14.134, 0, 0, -135.0);	sf2apg2 = CreateObject(988, -1218.206, 68.883, 14.134, 0, 0, -135.0);	lvapg1 = CreateObject(988, 1704.777, 1605.165, 10.058, 0, 0, 73.0);	lvapg2 = CreateObject(988, 1706.364, 1610.422, 10.058, 0, 0, 73.0);		SetTimer("CheckAPGates", 1000, 1);	return 1;}public CheckAPGates(){	for(new i=0; i<MAX_PLAYERS; i++)	{		if (IsPlayerConnected(i)) {		    new Float:x, Float:y, Float:z;			GetPlayerPos(i, Float:x, Float:y, Float:z);	    	if (PlayerToPoint(30.0, i, 1961.634, -2189.7765, 13.553)) 	// LSA	    	{				MoveObject(lsapg1, 1968.697, -2189.776, 13.553, 3);				MoveObject(lsapg2, 1954.571, -2189.777, 13.553, 3);				SetTimerEx("CloseAPGate", 1000, 0, "ii", 1, i);			}	  	 	if (PlayerToPoint(30.0, i, -1545.6835, -430.7615, 6.039)) 	// SFA 1	 	   	{				MoveObject(sf1apg1, -1540.66, -435.786, 6.039, 3);				MoveObject(sf1apg2, -1550.709, -425.736, 6.039, 3);				SetTimerEx("CloseAPGate", 1000, 0, "ii", 21, i);			}				    	if (PlayerToPoint(30.0, i, -1220.491, 61.443, 14.134)) 		// SFA 2	    	{				MoveObject(sf2apg1, -1226.59, 50.189, 14.134, 3);				MoveObject(sf2apg2, -1214.392, 72.697, 14.134, 3);				SetTimerEx("CloseAPGate", 1000, 0, "ii", 22, i);			}				    	if (PlayerToPoint(30.0, i, 1705.5705, 1607.7935, 10.058)) 	// LVA	    	{				MoveObject(lvapg1, 1703.4, 1600.518, 10.058, 3);				MoveObject(lvapg2, 1707.722, 1614.937, 10.058, 3);				SetTimerEx("CloseAPGate", 1000, 0, "ii", 3, i);			}		}	}}public CloseAPGate(airportid, playerid){	new Float:x, Float:y, Float:z; GetPlayerPos(playerid, Float:x, Float:y, Float:z);		// LSA	if (airportid == 1 && !PlayerToPoint(30.0, playerid, 1961.634, -2189.7765, 13.553))	{		MoveObject(lsapg1, 1964.342, -2189.776, 13.533, 3);		MoveObject(lsapg2, 1958.851, -2189.777, 13.553, 3);	}		// SFA 1	if (airportid == 21 && !PlayerToPoint(30.0, playerid, -1545.6835, -430.7615, 6.039))	{		MoveObject(sf1apg1, -1543.742, -432.703, 6.039, 3);		MoveObject(sf1apg2, -1547.625, -428.82, 6.039, 3);	}		// SFA 2	if (airportid == 22 && !PlayerToPoint(30.0, playerid, -1220.491, 61.443, 14.134))	{		MoveObject(sf2apg1, -1222.953, 53.826, 14.134, 3);		MoveObject(sf2apg2, -1218.206, 68.883, 14.134, 3);	}	// LVA	if (airportid == 3 && !PlayerToPoint(30.0, playerid, 1705.5705, 1607.7935, 10.058))	{		MoveObject(lvapg1, 1704.777, 1605.165, 10.058, 3);		MoveObject(lvapg2, 1706.364, 1610.422, 10.058, 3);	}}public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z){    if(IsPlayerConnected(playerid))	{		new Float:oldposx, Float:oldposy, Float:oldposz;		new Float:tempposx, Float:tempposy, Float:tempposz;		GetPlayerPos(playerid, oldposx, oldposy, oldposz);		tempposx = (oldposx -x);		tempposy = (oldposy -y);		tempposz = (oldposz -z);		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))		{			return 1;		}	}	return 0;}