Simple GATE [HELP]
#6

First define the new gates

Код:
//on top
new Gate1;
new Gate2;
Then, to spawn the gates, use the following two lines

Код:
Gate1 = CreateObject(988,1781.16040039,-1534.00585938,8.56611252,0.00000000,0.00000000,87.33950806); //(ws_apgate) Yard 1 close
Gate2 = CreateObject(988,1781.18664551,-1533.96008301,11.65782928,0.00000000,0.00000000,87.33950806); //(ws_apgate) Yard 1 Open
This can go in the OnGamemodeInit or OnFilterscriptInit.

After this, comes the command.

Код:
if (strcmp("/prisongateopen", cmdtext, true) == 0)
	{
	MoveObject(Gate1, 11781.16040039, -1534.00585938, 14.56611252, 1.4); //raise gate1
	MoveObject(Gate2, 11781.18664551, -1533.96008301, 17.65782928, 1.4); //raise gate2
	}
	return 1;
}
And the Close Command

Код:
if (strcmp("/prisongateclose", cmdtext, true) == 0)
	{
	MoveObject(Gate1, 11781.16040039, -1534.00585938, 8.56611252, 1.4); //lower gate1
	MoveObject(Gate2, 11781.18664551, -1533.96008301, 11.65782928, 1.4); //lower gate2
	}
	return 1;
}
I am not sure how to make it only open if you are a cop. You could do it if you are only admin tho. I am sure there is a way of doing it if you are only a cop, but I do not know how. This will at least let you open and close the gates. (If you want the gates to go sideways or down, just change the coordinates in the MoveObjects)

----------------------------------------------------------------------------------------
----------------------------Not sure if anything below this will work----------------------
----------------------------------------------------------------------------------------

You can try setting up a new variable like so
Код:
new CopId[][] =
{
    "280",
    "281",
    "282",
    "283",
    "284",
    "285",
    "286",
    "287",
    "288"
};
Put that in the top of your file. It is the list of cops's skin ids then change the commands to...

Open
Код:
if (strcmp("/prisongateopen", cmdtext, true) == 0)
	{
	new skinid;
	skinid = GetPlayerSkin(playerid);
	if(skinid = CopId){
		MoveObject(Gate1, 11781.16040039, -1534.00585938, 14.56611252, 1.4); //raise gate1
		MoveObject(Gate2, 11781.18664551, -1533.96008301, 17.65782928, 1.4); //raise gate2
	} else {
	return sendClientMessage(playerid,0x24FF0AB9,"You must be a cop to open these doors");
	}
	return 1;
}
Close
Код:
if (strcmp("/prisongateclose", cmdtext, true) == 0)
{
	new skinid;
	skinid = GetPlayerSkin(playerid);
	if(skinid = CopId){
		MoveObject(Gate1, 11781.16040039, -1534.00585938, 8.56611252, 1.4); //lower gate1
		MoveObject(Gate2, 11781.18664551, -1533.96008301, 11.65782928, 1.4); //lower gate2
	} else {
	return SendClientMessage(playerid,0x24FF0AB9,"You must be a cop to close these doors");
	}
	return 1;
}
Again, I am not sure if this will work!
Reply


Messages In This Thread
Simple GATE [HELP] - by Karl1195 - 10.08.2010, 21:50
Re: Simple GATE [HELP] - by WillyP - 10.08.2010, 22:53
Re: Simple GATE [HELP] - by Karl1195 - 10.08.2010, 22:55
Re: Simple GATE [HELP] - by WillyP - 11.08.2010, 00:09
Re: Simple GATE [HELP] - by Nathan_Taylor - 11.08.2010, 02:46
Re: Simple GATE [HELP] - by Nathan_Taylor - 11.08.2010, 02:53
Re: Simple GATE [HELP] - by Nathan_Taylor - 11.08.2010, 02:57
Re: Simple GATE [HELP] - by Snipa - 11.08.2010, 03:09
Re: Simple GATE [HELP] - by Nathan_Taylor - 11.08.2010, 03:10
Re: Simple GATE [HELP] - by Steven82 - 11.08.2010, 21:33

Forum Jump:


Users browsing this thread: 1 Guest(s)