[Tutorial #1]Made Easy(Gates)
#1

GATES
Ok alot of people need help with gates so heres a short tutorial.
.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
Ok the First thing we need is the news:
You can change the name to whatever you want.
Код:
new gate1; >goes at the top
if your doing 2 gates then put another new
Код:
new gate2; >goes at the top
How can the gate open if theres no Object.
You need to have an object created for each gate.
Код:
gate1 = CreateObject(modelid,X.X,Y.Y,Z.Z,RX.RX,RY.RY,RZ.RZ); //closing gate cords
or
Код:
gate2 = CreateObject(modelid,X.X,Y.Y,Z.Z,RX.RX,RY.RY,RZ.RZ); //closing gate cords
----------------------------------------------------------
Now for your Commands
IF you just want it for were ever your at then heres a good example of a cmd with 1 gate.
Код:
if (strcmp(cmdtext, "/og1", true)==0){
    SendClientMessage(playerid,COLOR_GREY,"YOUR TEXT HERE.");
		MoveObject (gate1,0.0,0.0,0.0,SPEED); //minimun speed=3.0
		return 1;
	}if (strcmp(cmdtext, "/cg1", true)==0){
    SendClientMessage(playerid,COLOR_GREY,"YOUR TEXT HERE");
		MoveObject (gate1,0.0,0.0,0.0, SPEED);//minimun speed=3.0
		return 1;         ^
	}
The cords for that would be the cords that the object whats created
Now if you want an easyeir way for the speed then put some defines
Код:
#define speed 3.0 //change ur spead here
Gates w/ PlayerToPoint
Now for gates that will only open for a player if your in a certain area.
Every thing is the same except for the Cmd.
Ok your gonna need the forward for the public function
Код:
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z); //top of FS or GM
Now for the public
Код:
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);
		//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
		if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
		{
			return 1;
		}
	}
	return 0;
}
Код:
if (strcmp(cmdtext, "/og1", true)==0)
{
if(PlayerToPoint(3.0, playerid,0.0,0.0,0.0)) //the cords were the player has to be to use the cmd
{
    SendClientMessage(playerid,COLOR_GREY,"YOUR TEXT HERE.");
		MoveObject (gate1,0.0,0.0,0.0,SPEED); //minimun speed=3.0
		return 1;
	}}if (strcmp(cmdtext, "/cg1", true)==0){

if(PlayerToPoint(3.0, playerid,0.0,0.0,0.0)) //the cords were the player has to be to use the cmd
{
    SendClientMessage(playerid,COLOR_GREY,"YOUR TEXT HERE");
		MoveObject (gate1,0.0,0.0,0.0, SPEED);//minimun speed=3.0
		return 1;         
	}}
Thats that.
Open & Close Gates for Players with certain team
Again every thing is still the same only your adding the team
Код:
gteam
Код:
if (strcmp(cmdtext, "/og1", true)==0)
{
if(PlayerToPoint(3.0, playerid,0.0,0.0,0.0)) //the cords were the player has to be to use the cmd
{

for(new i=0; i<MAX_PLAYERS; i++)
  {
  if(gTeam[i] == TEAM_POLICE)//change this to the team you want
{
    SendClientMessage(playerid,COLOR_GREY,"YOUR TEXT HERE.");
		MoveObject (gate1,0.0,0.0,0.0,SPEED); //minimun speed=3.0
		return 1;
	}}}}if (strcmp(cmdtext, "/cg1", true)==0){

if(PlayerToPoint(3.0, playerid,0.0,0.0,0.0)) //the cords were the player has to be to use the cmd
{

for(new i=0; i<MAX_PLAYERS; i++)
  {
  if(gTeam[i] == TEAM_POLICE)//Change this to the team you want
{
    SendClientMessage(playerid,COLOR_GREY,"YOUR TEXT HERE");
		MoveObject (gate1,0.0,0.0,0.0, SPEED);//minimun speed=3.0
		return 1;         
}}}}
------------------------------------------------------------------
Thats it.you can go on from.
The Players:
Score
Certain Ammount of Cash
a certain level or (ex: Key/licence)

You enjoy and do it safe.Lol

~Passout_IE/NEW_IE


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
Reply


Messages In This Thread
[Tutorial #1]Made Easy(Gates) - by NEW_IE - 10.09.2008, 05:06
Re: [Tutorial #1]Made Easy(Gates) - by Jose 510 - 10.09.2008, 05:10
Re: [Tutorial #1]Made Easy(Gates) - by NEW_IE - 10.09.2008, 05:27
Re: [Tutorial #1]Made Easy(Gates) - by Jose 510 - 10.09.2008, 05:35
Re: [Tutorial #1]Made Easy(Gates) - by Jose 510 - 10.09.2008, 05:37
Re: [Tutorial #1]Made Easy(Gates) - by Tez2k7 - 10.09.2008, 07:05
Re: [Tutorial #1]Made Easy(Gates) - by mamorunl - 10.09.2008, 08:33
Re: [Tutorial #1]Made Easy(Gates) - by Aliii - 13.10.2008, 12:01
Re: [Tutorial #1]Made Easy(Gates) - by Eric_Natsu - 27.12.2008, 23:21
Re: [Tutorial #1]Made Easy(Gates) - by LarzI - 27.12.2008, 23:25

Forum Jump:


Users browsing this thread: 2 Guest(s)