Press horn and the barrier/gate is opening
#1

I have this script, is functional, but I wanted to do was just write the order, but simply press the "h" or "Capslock" => chimney and it was open, I looked but nowhere did I find anything to help me and I asked several people and did not want to help me, please if anyone can lose some time with me.

Код:
#include <a_samp>
#include <core>
#include <float>
#include <k_functions>

#define FILTERSCRIPT
#pragma tabsize 0

#if defined FILTERSCRIPT

#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GREEN 0x33FF00AA
#define COLOR_CYAN 0x33FFFFAA
#define COLOR_ORANGE 0xFFCC00AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_BLACK 0x000000AA
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_BRIGHTRED 0xFF0000AA

forward CloseAPGate(airportid, playerid);
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
forward CheckAPGates();
forward logoanim();
forward logoanim2();
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
forward lspdbarrierclose();
forward sfpdbarrierclose();
forward sfpd2barrierclose();
forward ngbarrierclose();
forward lspdgateclose();
forward sfpdgateclose();

new LSPDGate;
new SFPDGatea;
new SFPDGateb;
new NGBarrier;
new SFPD2Barrier;
new SFPDBarrier;
new LSPDBarrier;
new Text:logo;
new lsapg1, lsapg2;
new sf1apg1, sf1apg2;
new sf2apg1, sf2apg2;
new lvapg1, lvapg2;
new vehName[][] = { "Landstalker", "Bravura", "Buffalo", "Linerunner", "Perrenial", "Sentinel", "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus", "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam", "Esperanto", "Taxi", "Washington", "Bobcat", "Whoopee", "BF Injection", "Hunter", "Premier",
"Enforcer", "Securicar", "Banshee", "Predator", "Bus", "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie", "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral", "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder", "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy",
"Solair", "Berkley's RC Van", "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider", "Glendale", "Oceanic", "Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy", "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina", "Comet", "BMX", "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick",
"News Chopper", "Rancher", "FBI Rancher", "Virgo", "Greenwood", "Jetmax", "Hotring", "Sandking", "Blista Compact", "Police Maverick", "Boxvillde", "Benson", "Mesa", "RC Goblin", "Hotring Racer A", "Hotring Racer B", "Bloodring Banger", "Rancher", "Super GT", "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropduster",
"Stunt", "Tanker", "Roadtrain", "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra", "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune", "Cadrona", "FBI Truck", "Willard", "Forklift", "Tractor", "Combine", "Feltzer", "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent", "Bullet", "Clover",
"Sadler", "Firetruck", "Hustler", "Intruder", "Primo", "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite", "Windsor", "Monster", "Monster", "Uranus", "Jester", "Sultan", "Stratum", "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito", "Freight Flat", "Streak Carriage", "Kart", "Mower", "Dune",
"Sweeper", "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400", "News Van", "Tug", "Trailer", "Emperor", "Wayfarer", "Euros", "Hotdog", "Club", "Freight Box", "Trailer", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car", "Police Car", "Police Car", "Police Ranger", "Picador", "S.W.A.T", "Alpha", "Phoenix",
"Glendale", "Sadler", "Luggage", "Luggage", "Stairs", "Boxville", "Tiller", "Utility Trailer" };

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" The Script");
	print("--------------------------------------\n");
	//----------------------------------------------------------------------------------------------
	lsapg1 = CreateObject(988, 19644.342, -21849.776, 13.533, 0, 0, 180.0);
	lsapg2 = CreateObject(988, 19548.851, -21849.777, 13.553, 0, 0, 180.0);
	//----------------------------------------------------------------------------------------------
	sf1apg1 = CreateObject(988, -15443.742, -4342.703, 6.039, 0, 0, -45.0);
	sf1apg2 = CreateObject(988, -15447.625, -4248.82, 6.039, 0, 0, -45.0);
	//----------------------------------------------------------------------------------------------
	sf2apg1 = CreateObject(988, -12242.953, 534.826, 14.134, 0, 0, -135.0);
	sf2apg2 = CreateObject(988, -12148.206, 684.883, 14.134, 0, 0, -135.0);
	//----------------------------------------------------------------------------------------------
	lvapg1 = CreateObject(988, 17044.777, 160445.165, 10.058, 0, 0, 73.0);
	lvapg2 = CreateObject(988, 17046.364, 161440.422, 10.058, 0, 0, 73.0);
	//----------------------------------------------------------------------------------------------
	NGBarrier = CreateObject(968, -15426.3753662109, 4841.39730834961, 6.968273639679, 0, 90, 180);
	SFPD2Barrier = CreateObject(968, -15472.205078125, 6548.79943847656, 6.8781251907349, 0, 90, 90);
	LSPDBarrier = CreateObject(968,15444.755004,-16243.929199,13.352820,0.000000,89.000000,269.818847);
	LSPDGate = CreateObject(980,15848.265991,-16348.143554,15.014236,0.000000,0.000000,0.675605);
	//----------------------------------------------------------------------------------------------
    SFPDBarrier = CreateObject(968, -17041.4342041016, 6847.60089111328, 24.653261184692, 0, 270, 90);
	SFPDGatea = CreateObject(969,-16341.741455,6848.129028,6.303413,0.000000,0.000000,0.000000);
	SFPDGateb = CreateObject(969,-16349.915405,6848.129028,6.303413,0.000000,0.000000,0.000000);
	//----------------------------------------------------------------------------------------------
	SetTimer("CheckAPGates", 1000, 1);
	SetTimer("logoanim",5000,false);
	return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp("/openlsbarrier", cmdtext, true) == 0)
	{
  		GetPlayerSkin(playerid);
		if(IsPlayerSkin(playerid, 280) || IsPlayerSkin(playerid, 281) || IsPlayerSkin(playerid, 282) || IsPlayerSkin(playerid, 283) || IsPlayerSkin(playerid, 288) || IsPlayerSkin(playerid, 284) || IsPlayerSkin(playerid, 285) || IsPlayerSkin(playerid, 286) || IsPlayerSkin(playerid, 287) || IsPlayerSkin(playerid, 163) || IsPlayerSkin(playerid, 164))
		{
  			SetObjectRot(LSPDBarrier,0.000000,0.000000,269.818847);
  			SendClientMessage(playerid, 0xAAAAAAAA, "  LSPD barrier opened !");
 	 		SetTimer("lspdbarrierclose",3000, false);
 		}
		else
		{
			SendClientMessage(playerid, 0xAAAAAAAA,"  You have to be a Cop/FBI/NG to open this barrier !");
		}
	}
	
	if(strcmp("/opensf2barrier", cmdtext, true) == 0)
	{
  		GetPlayerSkin(playerid);
		if(IsPlayerSkin(playerid, 280) || IsPlayerSkin(playerid, 281) || IsPlayerSkin(playerid, 282) || IsPlayerSkin(playerid, 283) || IsPlayerSkin(playerid, 288) || IsPlayerSkin(playerid, 284) || IsPlayerSkin(playerid, 285) || IsPlayerSkin(playerid, 286) || IsPlayerSkin(playerid, 287) || IsPlayerSkin(playerid, 163) || IsPlayerSkin(playerid, 164))
		{
  			SetObjectRot(SFPD2Barrier,0.000000,0,90);
  			SendClientMessage(playerid, 0xAAAAAAAA, "  SFPD barrier opened !");
 	 		SetTimer("sfpd2barrierclose",3000, false);
 		}
		else
		{
			SendClientMessage(playerid, 0xAAAAAAAA,"  You have to be a Cop/FBI/NG to open this barrier !");
		}
	}
	
	if(strcmp("/openngbarrier", cmdtext, true) == 0)
	{
  		GetPlayerSkin(playerid);
		if(IsPlayerSkin(playerid, 280) || IsPlayerSkin(playerid, 281) || IsPlayerSkin(playerid, 282) || IsPlayerSkin(playerid, 283) || IsPlayerSkin(playerid, 288) || IsPlayerSkin(playerid, 284) || IsPlayerSkin(playerid, 285) || IsPlayerSkin(playerid, 286) || IsPlayerSkin(playerid, 287) || IsPlayerSkin(playerid, 163) || IsPlayerSkin(playerid, 164))
		{
  			SetObjectRot(NGBarrier,0.000000,0,90);
  			SendClientMessage(playerid, 0xAAAAAAAA, "  NG barrier opened !");
 	 		SetTimer("ngbarrierclose",3000, false);
 		}
		else
		{
			SendClientMessage(playerid, 0xAAAAAAAA,"  You have to be a Cop/FBI/NG to open this barrier !");
		}
	}

  if(strcmp("/opensfbarrier", cmdtext, true) == 0)
	{
  		GetPlayerSkin(playerid);
		if(IsPlayerSkin(playerid, 280) || IsPlayerSkin(playerid, 281) || IsPlayerSkin(playerid, 282) || IsPlayerSkin(playerid, 283) || IsPlayerSkin(playerid, 288) || IsPlayerSkin(playerid, 284) || IsPlayerSkin(playerid, 285) || IsPlayerSkin(playerid, 286) || IsPlayerSkin(playerid, 287) || IsPlayerSkin(playerid, 163) || IsPlayerSkin(playerid, 164))
		{
  			SetObjectRot(SFPDBarrier,0.000000,0.000000,90);
  			SendClientMessage(playerid, 0xAAAAAAAA, "  SFPD barrier opened !");
 	 		SetTimer("sfpdbarrierclose",3000, false);
 		}
		else
		{
			SendClientMessage(playerid, 0xAAAAAAAA,"  You have to be a Cop/FBI/NG to open this barrier !");
		}
	}
	if(strcmp("/openlsgate", cmdtext, true) == 0)
  	{
  		GetPlayerSkin(playerid);
		if(IsPlayerSkin(playerid, 280) || IsPlayerSkin(playerid, 281) || IsPlayerSkin(playerid, 282) || IsPlayerSkin(playerid, 283) || IsPlayerSkin(playerid, 288) || IsPlayerSkin(playerid, 284) || IsPlayerSkin(playerid, 285) || IsPlayerSkin(playerid, 286) || IsPlayerSkin(playerid, 287) || IsPlayerSkin(playerid, 163) || IsPlayerSkin(playerid, 164))
  		{
  			MoveObject(LSPDGate, 1597.288696, -1637.887085, 14.706839, 4.0);
  			SendClientMessage(playerid, 0xAAAAAAAA, "  LSPD gate opened !");
  			SetTimer("lspdgateclose",3000, false);
		}
		else
		{
			SendClientMessage(playerid, 0xAAAAAAAA,"  You have to be a Cop/FBI/NG to open this gate !");
		}
	}
	if(strcmp("/opensfgate", cmdtext, true) == 0)
  	{
  		GetPlayerSkin(playerid);
		if(IsPlayerSkin(playerid, 280) || IsPlayerSkin(playerid, 281) || IsPlayerSkin(playerid, 282) || IsPlayerSkin(playerid, 283) || IsPlayerSkin(playerid, 288) || IsPlayerSkin(playerid, 284) || IsPlayerSkin(playerid, 285) || IsPlayerSkin(playerid, 286) || IsPlayerSkin(playerid, 287) || IsPlayerSkin(playerid, 163) || IsPlayerSkin(playerid, 164))
		{
  			MoveObject(SFPDGatea, -1624.119384, 688.126037, 6.303413, 4.0);
  			MoveObject(SFPDGateb, -1648.143554, 688.126037, 6.303413, 4.0);
  			SendClientMessage(playerid, 0xAAAAAAAA, "  SFPD gate opened !");
  			SetTimer("sfpdgateclose",3000, false);
		}
		else
		{
		SendClientMessage(playerid, 0xAAAAAAAA,"  You have to be a Cop/FBI/NG to open this gate !");
		}
	}
}


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 logoanim()
{
  TextDrawDestroy(logo);
  SetTimer("logoanim2",5000,false);
}

public logoanim2()
{
	logo = TextDrawCreate(500.0, 5.0,Text_Logo);
	TextDrawFont(logo, 0);
	TextDrawColor(logo,0xD2B586FF);
	TextDrawLetterSize(logo, 0.7, 1);
	TextDrawShowForAll(logo);
  SetTimer("logoanim",5000,false);
}

public ngbarrierclose()
{
	SetObjectRot(NGBarrier,0.000000,180,90);
}

public sfpd2barrierclose()
{
	SetObjectRot(SFPD2Barrier,0.000000,90,90);
}

public lspdbarrierclose()
{
	SetObjectRot(LSPDBarrier,0.000000,89.000000,269.818847);
}

public sfpdbarrierclose()
{
	SetObjectRot(SFPDBarrier,0.000000,270,90);
}

public lspdgateclose()
{
	MoveObject(LSPDGate, 1588.265991,-1638.143554,15.014236, 3.0);
}

public sfpdgateclose()
{
	MoveObject(SFPDGatea, -1631.741455,688.129028,6.303413, 3.0);
	MoveObject(SFPDGateb, -1639.915405,688.129028,6.303413, 3.0);
}
Reply
#2

Very good that you posted your ENTIRE script along with a request.

Now to get on the serious part: Download one that has it with the submission key and change the key to KEY_HORN..
Reply
#3

thats is the problem , I do not really know how to change the script please help me, make an example for one , please
Reply
#4

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
https://sampwiki.blast.hk/wiki/GetPlayerKeys#Key_List
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys & KEY_SUBMISSION)
    {
        if (PlayerToPoint(30.0, playerid, x, y, z of gate))
        {
             MoveObject(gate1, x, y, z of the opened gate);
             SetTimer("CloseGate", 10000, false);
        }  
    }
    return 1;
}

forward CloseGate();
public CloseGate()
{
  MoveObject(gate1, x, y, z of the closed gate);
}
Reply
#5

line number 4 error report (4) : fatal error 100: cannot read from file: "k_functions" messge for log1tek
Reply
#6

That right there is blatant script stealing. He put it up for people to have a look at, not to steal it.
Log1, try searching SA-MP's wiki.
Reply
#7

Quote:
Originally Posted by bobbydintzy
line number 4 error report (4) : fatal error 100: cannot read from file: "k_functions" messge for log1tek
Thats because your trying to compile it and you dont have k_functions
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)