#include <a_samp>
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define COLOR_GREEN 0x33AA33AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_ORANGE 0xFF9900AA
new gateArea51a;
new gateArea51b;
new gateArea51Info = 0; // 0 = auto, 1 = close, 2 = open
new gateAirportLSa;
new gateAirportLSb;
new gateAirportLSInfo = 0; // 0 = auto, 1 = close, 2 = open
new gateAirportSFa;
new gateAirportSFb;
new gateAirportSFInfo = 0; // 0 = auto, 1 = close, 2 = open
new gateAirportSF2a;
new gateAirportSF2b;
new gateAirportSF2Info = 0; // 0 = auto, 1 = close, 2 = open
new gateAirportLVa;
new gateAirportLVb;
new gateAirportLVInfo = 0; // 0 = auto, 1 = close, 2 = open
new gate600a;
new gate600b;
new gate600Info = 0; // 0 = auto, 1 = close, 2 = open
public OnFilterScriptInit()
{
print("\n+------------------+");
print("| Gates Script |");
print("| by Diego_PL |");
print("| & KILLER |");
print("| Loaded |");
print("+------------------+\n");
if(gateArea51Info == 0 || gateArea51Info == 1){
gateArea51a = CreateObject(2929, 215.887985, 1875.3355, 13.8640, 0, 0, 0);
gateArea51b = CreateObject(2929, 211.918137, 1875.3355, 13.8640, 0, 0, 0);
}
else{
gateArea51a = CreateObject(2929, 219.936996, 1875.3355, 13.8640, 0, 0, 0);
gateArea51b = CreateObject(2929, 207.844131, 1875.3355, 13.8640, 0, 0, 0);
}
if(gateAirportLSInfo == 0 || gateAirportLSInfo == 1){
gateAirportLSa = CreateObject(989, 1964.316772, -2189.7500, 14.3677, 0, 0, 106.4066);
gateAirportLSb = CreateObject(989, 1958.807861, -2189.7500, 14.3677, 0, 0, 107.266);
}
else{
gateAirportLSa = CreateObject(989, 1968.871216, -2189.7500, 14.3677, 0, 0, 106.4066);
gateAirportLSb = CreateObject(989, 1954.278442, -2189.7500, 14.3677, 0, 0, 107.266);
}
if(gateAirportSFInfo == 0 || gateAirportSFInfo == 1){
gateAirportSFa = CreateObject(989, -1547.637939, -428.740448, 6.8042, 0, 0, 241.484);
gateAirportSFb = CreateObject(989, -1543.747925, -432.621674, 6.8042, 0, 0, 241.484);
}
else{
gateAirportSFa = CreateObject(989, -1550.765991, -425.666199, 6.8042, 0, 0, 241.484);
gateAirportSFb = CreateObject(989, -1540.594849, -435.720917, 6.8042, 0, 0, 241.484);
}
if(gateAirportSF2Info == 0 || gateAirportSF2Info == 1){
gateAirportSF2a = CreateObject(988, -1218.1127, 68.8498, 14.17, 0, 0, 225);
gateAirportSF2b = CreateObject(988, -1222.8113, 53.771, 14.17, 0, 0, 225);
}
else{
gateAirportSF2a = CreateObject(988, -1214.334, 72.675, 14.17, 0, 0, 225);
gateAirportSF2b = CreateObject(988, -1226.5649, 50.0958, 14.17, 0, 0, 225);
}
if(gateAirportLVInfo == 0 || gateAirportLVInfo == 1){
gateAirportLVa = CreateObject(988, 1704.848877, 1605.037842, 10.0630, 0, 0, 72.6566);
gateAirportLVb = CreateObject(988, 1706.433838, 1610.362061, 10.0630, 0, 0, 73.516);
}
else{
gateAirportLVa = CreateObject(988, 1703.622681, 1600.933838, 10.0630, 0, 0, 72.6566);
gateAirportLVb = CreateObject(988, 1707.760132, 1614.666260, 10.0630, 0, 0, 73.516);
}
if(gate600Info == 0 || gate600Info == 1){
gate600a = CreateObject(9241, -2276.5, 2640.34, 54.0188, 0, 90, 180);
gate600b = CreateObject(9241, -2275.81, 2677.23, 54.8188, 0, 90, 180);
}
else{
gate600a = CreateObject(9241, -2276.5, 2640.34, 37.0188, 0, 90, 180);
gate600b = CreateObject(9241, -2275.81, 2677.23, 37.1188, 0, 90, 180);
}
SetTimer("GatesUpdate", 1009, 1);
return 1;
}
public OnFilterScriptExit()
{
print("\n+------------------+");
print("| Gates Script |");
print("| by Diego_PL |");
print("| Unloaded |");
print("+------------------+\n");
return 1;
}
dcmd_gate(playerid, params[]){
new tmp[256];
new idx;
new gateError[256] = "WPISZ: /gate [dom/600/area51/ls/sf/sf2/lv] [open/close/auto]";
tmp = strtok(params, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_GREEN, "Gates Script By KILLER");
SendClientMessage(playerid, COLOR_WHITE, gateError);
SendClientMessage(playerid, COLOR_YELLOW, "/gate area51 - управление воротами в бункере в Area 51");
SendClientMessage(playerid, COLOR_YELLOW, "/gate 600 - управление воротами в тунеле на 600");
SendClientMessage(playerid, COLOR_YELLOW, "/gate ls - управление воротами в аэропорту Лос Сантоса");
SendClientMessage(playerid, COLOR_YELLOW, "/gate sf - управление воротами в аэропорту Сан Фиерро на въезде");
SendClientMessage(playerid, COLOR_YELLOW, "/gate sf2 - управление воротами в аэропорту Сан Фиерро на выезди из стоянки");
SendClientMessage(playerid, COLOR_YELLOW, "/gate lv - управление воротами в аэропорту Лас Вентураса");
SendClientMessage(playerid, COLOR_ORANGE, "open - открыть");
SendClientMessage(playerid, COLOR_ORANGE, "close - закрыть");
SendClientMessage(playerid, COLOR_ORANGE, "auto - открывание при приближении игрока");
return 1;
}
// Area 51
if(strcmp(tmp, "area51", true) == 0){
tmp = strtok(params, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, gateError);
return 1;
}
if(strcmp(tmp, "open", true) == 0){
if(gateArea51Info != 2){
MoveObject(gateArea51a, 219.936996, 1875.3355, 13.8640, 0.5);
MoveObject(gateArea51b, 207.844131, 1875.3355, 13.8640, 0.5);
gateArea51Info = 2;
SendClientMessage(playerid, COLOR_GREEN, "..::Ворота в зоне Area 51 открыты::..");
}
else SendClientMessage(playerid, COLOR_YELLOW, "..::Вы уже открыли там ворота::..");
}
else if(strcmp(tmp, "close", true) == 0){
if(gateArea51Info != 1){
MoveObject(gateArea51a, 215.887985, 1875.3355, 13.8640, 0.5);
MoveObject(gateArea51b, 211.918137, 1875.3355, 13.8640, 0.5);
gateArea51Info = 1;
SendClientMessage(playerid, COLOR_GREEN, "..::Ворота в зоне Area 51 закрыты::..");
}
else SendClientMessage(playerid, COLOR_YELLOW, "..::Вы уже закрыли там ворота::..");
}
else if(strcmp(tmp, "auto", true) == 0){
gateArea51Info = 0;
SendClientMessage(playerid, COLOR_GREEN, "..::В зоне Area 51 ворота стоят на автоматическом режиме::..");
}
else SendClientMessage(playerid, COLOR_WHITE, gateError);
}
// Loa Santos Airport
else if(strcmp(tmp, "ls", true) == 0){
tmp = strtok(params, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, gateError);
return 1;
}
if(strcmp(tmp, "open", true) == 0){
if(gateAirportLSInfo != 2){
MoveObject(gateAirportLSa, 1968.871216, -2189.7500, 14.3677, 2.5);
MoveObject(gateAirportLSb, 1954.278442, -2189.7500, 14.3677, 2.5);
gateAirportLSInfo = 2;
SendClientMessage(playerid, COLOR_GREEN, "..::Ворота в аэропорту Лос Сантоса открыты::..");
}
else SendClientMessage(playerid, COLOR_YELLOW, "..::Ворота в аэропорту Лос Сантоса уже открыты::..");
}
else if(strcmp(tmp, "close", true) == 0){
if(gateAirportLSInfo != 1){
MoveObject(gateAirportLSa, 1964.316772, -2189.7500, 14.3677, 2.5);
MoveObject(gateAirportLSb, 1958.807861, -2189.7500, 14.3677, 2.5);
gateAirportLSInfo = 1;
SendClientMessage(playerid, COLOR_GREEN, "..::Ворота в аэропорту Лос Сантоса закрыты::..");
}
else SendClientMessage(playerid, COLOR_YELLOW, "..::Ворота в аэропорту Лос Сантоса уже закрыты::..");
}
else if(strcmp(tmp, "auto", true) == 0){
gateAirportLSInfo = 0;
SendClientMessage(playerid, COLOR_GREEN, "..::Ворота в аэропорту Лос Сантоса стоят в автоматическом режиме::..");
}
else SendClientMessage(playerid, COLOR_WHITE, gateError);
}
// San Fierro Airport
else if(strcmp(tmp, "sf", true) == 0){
tmp = strtok(params, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, gateError);
return 1;
}
if(strcmp(tmp, "open", true) == 0){
if(gateAirportSFInfo != 2){
MoveObject(gateAirportSFa, -1550.765991, -425.666199, 6.8042, 2.5);
MoveObject(gateAirportSFb, -1540.594849, -435.720917, 6.8042, 2.5);
gateAirportSFInfo = 2;
SendClientMessage(playerid, COLOR_GREEN, "..::Ворота в аэропорту Сан Фиерро на въезде открыты::..");
}
else SendClientMessage(playerid, COLOR_YELLOW, "..::Ворота в аэропорту Сан Фиерро на въезде уже открыты::..");
}
else if(strcmp(tmp, "close", true) == 0){
if(gateAirportSFInfo != 1){
MoveObject(gateAirportSFa, -1547.637939, -428.740448, 6.8042, 2.5);
MoveObject(gateAirportSFb, -1543.747925, -432.621674, 6.8042, 2.5);
gateAirportSFInfo = 1;
SendClientMessage(playerid, COLOR_GREEN, "..::Ворота в аэропорту Сан Фиерро на въезде закрыты::..");
}
else SendClientMessage(playerid, COLOR_YELLOW, "..::Ворота в аэропорту Сан Фиерро на въезде уже закрыты::..");
}
else if(strcmp(tmp, "auto", true) == 0){
gateAirportSFInfo = 0;
SendClientMessage(playerid, COLOR_GREEN, "..::Ворота на въезде в аэропорт Сан Фиерро стоят в автоматическом режиме::..");
}
else SendClientMessage(playerid, COLOR_WHITE, gateError);
}
// San Fierro Airport Parking
else if(strcmp(tmp, "sf2", true) == 0){
tmp = strtok(params, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, gateError);
return 1;
}
if(strcmp(tmp, "open", true) == 0){
if(gateAirportSF2Info != 2){
MoveObject(gateAirportSF2a, -1214.334, 72.675, 14.17, 2.5);
MoveObject(gateAirportSF2b, -1226.5649, 50.0958, 14.17, 2.5);
gateAirportSF2Info = 2;
SendClientMessage(playerid, COLOR_GREEN, "..::Ворота в аэропорту Сан Фиерро на выезде из стоянки открыты::..");
}
else SendClientMessage(playerid, COLOR_YELLOW, "..::Ворота в аэропорту Сан Фиерро на выезде из стоянки уже открыты::..");
}
else if(strcmp(tmp, "close", true) == 0){
if(gateAirportSF2Info != 1){
MoveObject(gateAirportSF2a, -1218.1127, 68.8498, 14.17, 2.5);
MoveObject(gateAirportSF2b, -1222.8113, 53.771, 14.17, 2.5);
gateAirportSF2Info = 1;
SendClientMessage(playerid, COLOR_GREEN, "..::Ворота в аэропорту Сан Фиерро на выезде из стоянки закрыты::..");
}
else SendClientMessage(playerid, COLOR_YELLOW, "..::Ворота в аэропорту Сан Фиерро на выезде из стоянки уже закрыты::..");
}
else if(strcmp(tmp, "auto", true) == 0){
gateAirportSF2Info = 0;
SendClientMessage(playerid, COLOR_GREEN, "..::Ворота в аэропорту Сан Фиерро на выезде из стоянки стоят в автоматическом режиме::..");
}
else SendClientMessage(playerid, COLOR_WHITE, gateError);
}
// Las Venturas Airport
else if(strcmp(tmp, "lv", true) == 0){
tmp = strtok(params, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, gateError);
return 1;
}
if(strcmp(tmp, "open", true) == 0){
if(gateAirportLVInfo != 2){
MoveObject(gateAirportLVa, 1703.622681, 1600.933838, 10.0630, 2.5);
MoveObject(gateAirportLVb, 1707.760132, 1614.666260, 10.0630, 2.5);
gateAirportLVInfo = 2;
SendClientMessage(playerid, COLOR_GREEN, "..::Ворота в аэропорту Лас Вентураса открыты::..");
}
else SendClientMessage(playerid, COLOR_YELLOW, "..::Ворота в аэропорту Лас Вентураса уже открыты::..");
}
else if(strcmp(tmp, "close", true) == 0){
if(gateAirportLVInfo != 1){
MoveObject(gateAirportLVa, 1704.848877, 1605.037842, 10.0630, 2.5);
MoveObject(gateAirportLVb, 1706.433838, 1610.362061, 10.0630, 2.5);
gateAirportLVInfo = 1;
SendClientMessage(playerid, COLOR_GREEN, "..::Ворота в аэропорту Лас Вентураса закрыты::..");
}
else SendClientMessage(playerid, COLOR_YELLOW, "..::Ворота в аэропорту Лас Вентураса уже закрыты::..");
}
else if(strcmp(tmp, "auto", true) == 0){
gateAirportLVInfo = 0;
SendClientMessage(playerid, COLOR_GREEN, "..::Ворота в аэропорту Лас Венураса стоят в автоматическом режиме::..");
}
else SendClientMessage(playerid, COLOR_WHITE, gateError);
}
// 600
if(strcmp(tmp, "600", true) == 0){
tmp = strtok(params, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_WHITE, gateError);
return 1;
}
if(strcmp(tmp, "open", true) == 0){
if(gate600Info != 2){
MoveObject(gate600a, -2276.5, 2640.34, 37.0188, 3.5);
MoveObject(gate600b, -2275.81, 2677.23, 37.1188, 3.5);
gate600Info = 2;
SendClientMessage(playerid, COLOR_GREEN, "..::Ворота в зоне 600 открыты::..");
}
else SendClientMessage(playerid, COLOR_YELLOW, "..::Вы уже открыли там ворота::..");
}
else if(strcmp(tmp, "close", true) == 0){
if(gate600Info != 1){
MoveObject(gate600a, -2276.5, 2640.34, 54.0188, 3.5);
MoveObject(gate600b, -2275.81, 2677.23, 54.8188, 3.5);
gate600Info = 1;
SendClientMessage(playerid, COLOR_GREEN, "..::Ворота в зоне 600 закрыты::..");
}
else SendClientMessage(playerid, COLOR_YELLOW, "..::Вы уже закрыли там ворота::..");
}
else if(strcmp(tmp, "auto", true) == 0){
gate600Info = 0;
SendClientMessage(playerid, COLOR_GREEN, "..::В зоне 600 ворота стоят на автоматическом режиме::..");
}
else SendClientMessage(playerid, COLOR_WHITE, gateError);
}
else SendClientMessage(playerid, COLOR_WHITE, gateError);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(IsPlayerAdmin(playerid)){
dcmd(gate, 4, cmdtext);
}
return 0;
}
forward GatesUpdate();
public GatesUpdate(){
if(gateArea51Info == 0){
if(IsAnyPlayerInArea(208.0, 1870.3, 218.0, 1880.3)){
MoveObject(gateArea51a, 219.936996, 1875.3355, 13.8640, 0.5);
MoveObject(gateArea51b, 207.844131, 1875.3355, 13.8640, 0.5);
}
else{
MoveObject(gateArea51a, 215.887985, 1875.3355, 13.8640, 0.5);
MoveObject(gateArea51b, 211.918137, 1875.3355, 13.8640, 0.5);
}
}
if(gateAirportLSInfo == 0){
if(IsAnyPlayerInArea(1951.0, -2199.0, 1971.0, -2179.0)){
MoveObject(gateAirportLSa, 1968.871216, -2189.7500, 14.3677, 2.5);
MoveObject(gateAirportLSb, 1954.278442, -2189.7500, 14.3677, 2.5);
}
else{
MoveObject(gateAirportLSa, 1964.316772, -2189.7500, 14.3677, 2.5);
MoveObject(gateAirportLSb, 1958.807861, -2189.7500, 14.3677, 2.5);
}
}
if(gateAirportSFInfo == 0){
if(IsAnyPlayerInArea(-1555.0, -440.0, -1535.0, -420.0)){
MoveObject(gateAirportSFa, -1550.765991, -425.666199, 6.8042, 2.5);
MoveObject(gateAirportSFb, -1540.594849, -435.720917, 6.8042, 2.5);
}
else{
MoveObject(gateAirportSFa, -1547.637939, -428.740448, 6.8042, 2.5);
MoveObject(gateAirportSFb, -1543.747925, -432.621674, 6.8042, 2.5);
}
}
if(gateAirportSF2Info == 0){
if(IsAnyPlayerInArea(-1229.8405, 58.3024, -1206.7382, 80.9332)){
MoveObject(gateAirportSF2a, -1214.334, 72.675, 14.17, 2.5);
}
else{
MoveObject(gateAirportSF2a, -1218.1127, 68.8498, 14.17, 2.5);
}
if(IsAnyPlayerInArea(-1232.8929, 43.4901, -1209.8215, 65.2642)){
MoveObject(gateAirportSF2b, -1226.5649, 50.0958, 14.17, 2.5);
}
else{
MoveObject(gateAirportSF2b, -1222.8113, 53.771, 14.17, 2.5);
}
}
if(gateAirportLVInfo == 0){
if(IsAnyPlayerInArea(1695.0, 1597.0, 1715.0, 1617.0)){
MoveObject(gateAirportLVa, 1703.622681, 1600.933838, 10.0630, 2.5);
MoveObject(gateAirportLVb, 1707.760132, 1614.666260, 10.0630, 2.5);
}
else{
MoveObject(gateAirportLVa, 1704.848877, 1605.037842, 10.0630, 2.5);
MoveObject(gateAirportLVb, 1706.433838, 1610.362061, 10.0630, 2.5);
}
}
if(gate600Info == 0){
if(IsAnyPlayerInArea(-2426.63, 2567.91, -1961.67, 2845.43)){
MoveObject(gate600a, -2276.5, 2640.34, 37.0188, 3.5);
MoveObject(gate600b, -2275.81, 2677.23, 37.1188, 3.5);
}
else{
MoveObject(gate600a, -2276.5, 2640.34, 54.0188, 3.5);
MoveObject(gate600b, -2275.81, 2677.23, 54.8188, 3.5);
}
}
}
IsAnyPlayerInArea(Float:x1, Float:y1, Float:x2, Float:y2){
for(new i=0; i<MAX_PLAYERS; i++){
if(IsPlayerConnected(i)){
new Float:X, Float:Y, Float:Z;
GetPlayerPos(i, X, Y, Z);
if(X >= x1 && X <= x2 && Y >= y1 && Y <= y2) return 1;
}
}
return 0;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}