Simple GATE [HELP]
#1

Hello guys i am kinda new to scripting and i learned every thing about basic scripting but i can't learn how i make gates... can some one make a gate for me so i can see how you did it and i learn...

I want this gate that can only be open by cops. As many people know i already asked about how to make a gate open but that was a different method and i learned how to do that but i can't under stand how you make a gate that opens by a command and that only cops can open this gate.

Gates:

Код:
CreateObject(988,1781.16040039,-1534.00585938,8.56611252,0.00000000,0.00000000,87.33950806); //(ws_apgate) Yard 1 close
CreateObject(988,1781.18664551,-1533.96008301,11.65782928,0.00000000,0.00000000,87.33950806); //(ws_apgate) Yard 1 Open
I would like the command /prisongateopen

Thanks a lot Karl1195.
Reply
#2

ffs have a look at the tuts
Reply
#3

maybe i did? i can't under stand .... if u cant help don't post i understand more when i got it ready and basic...
Reply
#4

if you can understand npc connecting, you can understand this
Reply
#5

I got it already, let me write it, just a sec
Reply
#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
#7

Message me if you have any problems
Reply
#8

If you create a marker for it to open when a player steps inside, how would u do it? Without a cmd
Reply
#9

Quote:
Originally Posted by Snipa
Посмотреть сообщение
If you create a marker for it to open when a player steps inside, how would u do it? Without a cmd
Sorry, I have no idea
Reply
#10

Quote:
Originally Posted by [FU]Victious
Посмотреть сообщение
if you can understand npc connecting, you can understand this
Not nessicarly dude, calm the fuck down. He is new and there was no reason to just blow up on him just now. If you can't be nice, help out then leave the Scripting Discussion area and go make a GF edit or something. I know i may not be the nicest right now, but you need to stop ok?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)