Gate Help
#1

Okay i have the code i am trying to make two gates move by modifying this fs cause the gates are only supposed to be moved bye the army skin and these are my two starting pos. And i need the gates to move down 7 units Y i have tried but i am getting this error which i do not understand
Код:
CreateObject(971, 344.155762, 1797.302002, 18.885450, 0.0000, 0.0000, 33.5180);
CreateObject(7657, 135.377380, 1997.332397, 20.203087, 0.0000, 0.0000, 180.4818);
Код:
#include <a_samp>

#pragma dynamic 8192
#pragma tabsize 0

#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_LIGHTGREEN 0x9ACD32AA

forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);

new a51gs_status = 1;
new a51gs;
new a51_liftstatus = 1;
new a51_lift1;
new a51_lift2;
new a51_lift3;
new a51_lift4;
new a51gstatus = 1;
new a51g;
new obj1;
new obj2;

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;
}

public OnFilterScriptInit()
{
	print("/****************************************/");
	print("/ [FS] Area 51 Gates - By Jack Sparrow /");
	print("/****************************************/");
	a51gs = CreateObject(10184, 214.337631, 1875.739136, 13.162411, 0.0000, 0.0000, 270.0000);//Area 51 Garage Shutter
	a51_lift1 = CreateObject(985, 281.667694, 1821.519043, 16.701317, 270.6186, 0.0000, 270.0000);//Area 51 Lift1
	a51_lift2 = CreateObject(986, 290.248383, 1821.519043, 16.651318, 270.6186, 0.0000, 90.0000);//Area 51 Lift2
	a51_lift3 = CreateObject(985, 275.712830, 1821.519043, 16.701317, 270.6186, 0.0000, 270.0000);//Area 51 Lift3
	a51_lift4 = CreateObject(986, 296.168213, 1821.519043, 16.701317, 270.6186, 0.0000, 90.0000);//Area 51 Lift4
	a51g = CreateObject(7657, 135.377380, 1997.332397, 20.203087, 0.0000, 0.0000, 180.4818);// Main Entrance
	obj1 = CreateObject(3279, 103.999695, 1932.790771, 16.758234, 0.0000, 0.0000, 0.0000);//Area 51 Loookout Post
	obj2 = CreateObject(987, 340.080139, 1794.643188, 15.133865, 0.0000, 0.0000, 33.7500);//Area 51 East Blockade
	return 1;
}

public OnFilterScriptExit()
{
	DestroyObject(a51gs);
	DestroyObject(a51_lift1);
	DestroyObject(a51_lift2);
	DestroyObject(a51_lift3);
	DestroyObject(a51_lift4);
	DestroyObject(a51g);
	DestroyObject(obj1);
	DestroyObject(obj2);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp("/gate", cmdtext, true) == 0)
	{
		if(PlayerToPoint(15, playerid, 142.377380, 1998.332397, 20.203087))
		{
			if(GetPlayerSkin(playerid) == 287)
			{
				if(a51gstatus == 1)
				{
					MoveObject(a51g, 135.377380, 1997.332397, 16, 4);
					SendClientMessage(playerid, COLOR_LIGHTGREEN, "*	Area51 Gate Open");
					a51gstatus = 0;
				}
				else if(a51gstatus == 0)
				{
					MoveObject(a51g, 135.377380, 1997.332397, 20.203087 , 4);
					SendClientMessage(playerid, COLOR_LIGHTRED, "*	Area51 Gate Closed");
					a51gstatus = 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_LIGHTRED, "	You are not a Soldier");
			}
		}
	return 1;
	}
	if(strcmp("/gate1", cmdtext, true) == 0)
	{
		if(PlayerToPoint(10, playerid, 214.337631, 1875.739136, 13.162411))
		{
		  if(GetPlayerSkin(playerid) == 287)
		  {
		    if(a51gs_status == 1)
		    {
		      MoveObject(a51gs, 214.337631, 1875.739136, 9.000, 4);
		      SendClientMessage(playerid, COLOR_LIGHTGREEN, "*  Area51 Garage Open");
		      a51gs_status = 0;
				}
				else if(a51gs_status == 0)
				{
				  MoveObject(a51gs, 214.337631, 1875.739136, 13.162411, 4);
				  SendClientMessage(playerid, COLOR_LIGHTRED, "* Area51 Garage Closed");
				  a51gs_status = 1;
				}
			}
			else
			{
			  SendClientMessage(playerid, COLOR_LIGHTRED, "  You are not a Soldier");
			}
		}
		return 1;
	}
	if(strcmp("/gate2", cmdtext, true, 8) == 0)
	{
	  if(PlayerToPoint(25, playerid, 281.667694, 1821.519043, 16.701317))
	  {
	    if(GetPlayerSkin(playerid) == 287)
	    {
	      if(a51_liftstatus == 1)
	      {
	        MoveObject(a51_lift1, 281.667694, 1821.519043, 23.451214, 4);
	        MoveObject(a51_lift2, 290.248383, 1821.519043, 23.451214, 4);
	        MoveObject(a51_lift3, 275.712830, 1821.519043, 23.451214, 4);
	        MoveObject(a51_lift4, 296.168213, 1821.519043, 23.451214, 4);
	        SendClientMessage(playerid, COLOR_LIGHTGREEN, "*  Area51 Lift Going Up");
	        a51_liftstatus = 0;
				}
				else if(a51_liftstatus == 0)
				{
				  MoveObject(a51_lift1, 281.667694, 1821.519043, 16.701317, 4);
				  MoveObject(a51_lift2, 290.248383, 1821.519043, 16.701317, 4);
				  MoveObject(a51_lift3, 275.712830, 1821.519043, 16.701317, 4);
				  MoveObject(a51_lift4, 296.168213, 1821.519043, 16.701317, 4);
				  SendClientMessage(playerid, COLOR_LIGHTRED, "* Area51 Lift Going Down");
				  a51_liftstatus = 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_LIGHTRED, "  You are not a Soldier");
			}
		}
		return 1;
	}
	return 0;
Код:
C:\Documents and Settings\Tech\Desktop\REAL SERVER\filterscripts\area51 gates.pwn(158) : error 030: compound statement not closed at the end of file (started at line 72)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

You missed the OnPlayerCommandText closing bracket (}), look at the end of your code. You just typed return 0; and you don't closed the oped bracket from line 72.

Here is the working code:

Код:
#include <a_samp>

#pragma dynamic 8192
#pragma tabsize 0

#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_LIGHTGREEN 0x9ACD32AA

forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);

new a51gs_status = 1;
new a51gs;
new a51_liftstatus = 1;
new a51_lift1;
new a51_lift2;
new a51_lift3;
new a51_lift4;
new a51gstatus = 1;
new a51g;
new obj1;
new obj2;

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;
}

public OnFilterScriptInit()
{
	print("/****************************************/");
	print("/ [FS] Area 51 Gates - By Jack Sparrow /");
	print("/****************************************/");
	a51gs = CreateObject(10184, 214.337631, 1875.739136, 13.162411, 0.0000, 0.0000, 270.0000);//Area 51 Garage Shutter
	a51_lift1 = CreateObject(985, 281.667694, 1821.519043, 16.701317, 270.6186, 0.0000, 270.0000);//Area 51 Lift1
	a51_lift2 = CreateObject(986, 290.248383, 1821.519043, 16.651318, 270.6186, 0.0000, 90.0000);//Area 51 Lift2
	a51_lift3 = CreateObject(985, 275.712830, 1821.519043, 16.701317, 270.6186, 0.0000, 270.0000);//Area 51 Lift3
	a51_lift4 = CreateObject(986, 296.168213, 1821.519043, 16.701317, 270.6186, 0.0000, 90.0000);//Area 51 Lift4
	a51g = CreateObject(7657, 135.377380, 1997.332397, 20.203087, 0.0000, 0.0000, 180.4818);// Main Entrance
	obj1 = CreateObject(3279, 103.999695, 1932.790771, 16.758234, 0.0000, 0.0000, 0.0000);//Area 51 Loookout Post
	obj2 = CreateObject(987, 340.080139, 1794.643188, 15.133865, 0.0000, 0.0000, 33.7500);//Area 51 East Blockade
	return 1;
}

public OnFilterScriptExit()
{
	DestroyObject(a51gs);
	DestroyObject(a51_lift1);
	DestroyObject(a51_lift2);
	DestroyObject(a51_lift3);
	DestroyObject(a51_lift4);
	DestroyObject(a51g);
	DestroyObject(obj1);
	DestroyObject(obj2);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp("/gate", cmdtext, true) == 0)
	{
		if(PlayerToPoint(15, playerid, 142.377380, 1998.332397, 20.203087))
		{
			if(GetPlayerSkin(playerid) == 287)
			{
				if(a51gstatus == 1)
				{
					MoveObject(a51g, 135.377380, 1997.332397, 16, 4);
					SendClientMessage(playerid, COLOR_LIGHTGREEN, "*	Area51 Gate Open");
					a51gstatus = 0;
				}
				else if(a51gstatus == 0)
				{
					MoveObject(a51g, 135.377380, 1997.332397, 20.203087 , 4);
					SendClientMessage(playerid, COLOR_LIGHTRED, "*	Area51 Gate Closed");
					a51gstatus = 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_LIGHTRED, "	You are not a Soldier");
			}
		}
	return 1;
	}
	if(strcmp("/gate1", cmdtext, true) == 0)
	{
		if(PlayerToPoint(10, playerid, 214.337631, 1875.739136, 13.162411))
		{
		  if(GetPlayerSkin(playerid) == 287)
		  {
		    if(a51gs_status == 1)
		    {
		      MoveObject(a51gs, 214.337631, 1875.739136, 9.000, 4);
		      SendClientMessage(playerid, COLOR_LIGHTGREEN, "*  Area51 Garage Open");
		      a51gs_status = 0;
				}
				else if(a51gs_status == 0)
				{
				  MoveObject(a51gs, 214.337631, 1875.739136, 13.162411, 4);
				  SendClientMessage(playerid, COLOR_LIGHTRED, "* Area51 Garage Closed");
				  a51gs_status = 1;
				}
			}
			else
			{
			  SendClientMessage(playerid, COLOR_LIGHTRED, "  You are not a Soldier");
			}
		}
		return 1;
	}
	if(strcmp("/gate2", cmdtext, true, 8) == 0)
	{
	  if(PlayerToPoint(25, playerid, 281.667694, 1821.519043, 16.701317))
	  {
	    if(GetPlayerSkin(playerid) == 287)
	    {
	      if(a51_liftstatus == 1)
	      {
	        MoveObject(a51_lift1, 281.667694, 1821.519043, 23.451214, 4);
	        MoveObject(a51_lift2, 290.248383, 1821.519043, 23.451214, 4);
	        MoveObject(a51_lift3, 275.712830, 1821.519043, 23.451214, 4);
	        MoveObject(a51_lift4, 296.168213, 1821.519043, 23.451214, 4);
	        SendClientMessage(playerid, COLOR_LIGHTGREEN, "*  Area51 Lift Going Up");
	        a51_liftstatus = 0;
				}
				else if(a51_liftstatus == 0)
				{
				  MoveObject(a51_lift1, 281.667694, 1821.519043, 16.701317, 4);
				  MoveObject(a51_lift2, 290.248383, 1821.519043, 16.701317, 4);
				  MoveObject(a51_lift3, 275.712830, 1821.519043, 16.701317, 4);
				  MoveObject(a51_lift4, 296.168213, 1821.519043, 16.701317, 4);
				  SendClientMessage(playerid, COLOR_LIGHTRED, "* Area51 Lift Going Down");
				  a51_liftstatus = 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_LIGHTRED, "  You are not a Soldier");
			}
		}
		return 1;
	}
	return 0;
}
Hope I helped...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)