[Tutorial] How to script a moving Gate
#1

Tutorial about "How to script moving gates" by [CPL]Juicy_J

Step 1: Get the cords

You need to place an opened and a closed gate. You need from both the cords.
For an example with this system you can get them: Click me


Step 2: Where can i find the cords.

It saves the object cords to a file in scriptilfes directory

Step 3: Opengate and Closegate cords.

Now you have the cords for the both. Now open your Gamemode.

Step 4: Opengate

Search for "new". Add a new "gatename"
Example : new hqgate;


Search now for OnPlayerCommandText. Add somewhere in the middle of OnPlayerCommandText this section.
If you want that you cant open the gate everywhere, go ingame - to the place where you placed the gate. Type there /save - hq radius. Open your San Andreas folder and you will find the cords from the radius at "Savedpositions". if(PlayerToPoint) is the place for the radius.


With Descriptions

Код:
//-----------------------------------[Moving Gate Commands By [Jay Jones]-------------------------------------------------

if(strcmp(cmdtext,"/opengate", true) == 0)
  {
   if (gTeam[playerid] == TEAM_GROVE)                    
   {                                               x          y         z    <- | - FOR THE RADIUS
		 if(PlayerToPoint(15.0, playerid,283.2922,-1543.4369,24.7436))
		 {                                                              |
 	   MoveObject(hqgate, 289.919067, -1547.427734, 27.193420, 1.500000);     <--opened
     return 1;          |         |             |           |           |       |
     }      REMEMBER THE NAME     x             y           z     Gate Speed
  }                                                                             |
}       
                                                                                | 
if(strcmp(cmdtext,"/closegate", true) == 0)                                     
  {                                                                              \
   if (gTeam[playerid] == TEAM_GROVE)                                 
   {                                                                               \
		 if(PlayerToPoint(15.0, playerid,283.2922,-1543.4369,24.7436))  ALL HERE THE SAME
		 {
 	   MoveObject(hqgate, 283.870544, -1543.398804, 27.193420, 1.500000);     <--closed
     return 1;
     }
  }
}
The right code. Without Descriptions

Код:
if(strcmp(cmdtext,"/opengate", true) == 0)
  {
   if (gTeam[playerid] == TEAM_GROVE)
   {
		 if(PlayerToPoint(15.0, playerid,283.2922,-1543.4369,24.7436))
		 {
 	   MoveObject(hqgate, 289.919067, -1547.427734, 27.193420, 1.500000);
     return 1;
     }
  }
}

if(strcmp(cmdtext,"/closegate", true) == 0)
  {
   if (gTeam[playerid] == TEAM_GROVE)
   {
		 if(PlayerToPoint(15.0, playerid,283.2922,-1543.4369,24.7436))
		 {
 	   MoveObject(hqgate, 283.870544, -1543.398804, 27.193420, 1.500000);
     return 1;
     }
  }
}
Copy this section and edit it with your cords. Put the cords for /opengate, when the gate is opened. And put the cords for /closegate, when the gate is closed. Thats it for the "opengate" section. Now back to Closegate.

Step 5: Closegate.

Search for public OnGameModeInit
Add a line like this under public OnGameModeInit
Here an example:


Код:
hqgate = CreateObject(980, 1786.589233, -1128.866577, 24.734344, 0.0000, 0.0000, 0.0000);//closed
                       |        |           |              |
                  Object Id     x           y              z
Well thats it. I hope you understood all. If you have any questions, post them here.

Jay Jones aka [CPL]Juicy_J
Reply


Messages In This Thread
[Tutorial] How to script a moving Gate - by [18SG]Juicy_J - 18.07.2008, 18:48
Re: [Tutorial] How to script moving Gates - by sebihunter - 18.07.2008, 18:54
Re: [Tutorial] How to script a moving Gate - by whooper - 18.07.2008, 18:56
Re: [Tutorial] How to script a moving Gate - by [18SG]Juicy_J - 18.07.2008, 18:57
Re: [Tutorial] How to script a moving Gate - by flakey - 18.07.2008, 19:25
Re: [Tutorial] How to script a moving Gate - by bFe - 18.07.2008, 19:27
Re: [Tutorial] How to script a moving Gate - by [18SG]Juicy_J - 18.07.2008, 19:40
Re: [Tutorial] How to script a moving Gate - by NEW_IE - 18.07.2008, 20:09
Re: [Tutorial] How to script a moving Gate - by Giacomand - 19.07.2008, 21:30
Re: [Tutorial] How to script a moving Gate - by [18SG]Juicy_J - 20.07.2008, 06:34
Re: [Tutorial] How to script a moving Gate - by Rks25 - 21.07.2008, 20:21
Re: [Tutorial] How to script a moving Gate - by mamane - 01.09.2008, 16:19
Re: [Tutorial] How to script a moving Gate - by [18SG]Juicy_J - 03.09.2008, 17:19
Re: [Tutorial] How to script a moving Gate - by Vialpando - 14.09.2008, 02:13
Re: [Tutorial] How to script a moving Gate - by VaD - 16.09.2008, 12:49
Re: [Tutorial] How to script a moving Gate - by [18SG]Juicy_J - 16.09.2008, 14:52
Re: [Tutorial] How to script a moving Gate - by Xander5270 - 16.09.2008, 15:12
Re: [Tutorial] How to script a moving Gate - by [18SG]Juicy_J - 16.09.2008, 15:34
Re: [Tutorial] How to script a moving Gate - by Xander5270 - 16.09.2008, 16:01
Re: [Tutorial] How to script a moving Gate - by zid990 - 16.09.2008, 16:11
Re: [Tutorial] How to script a moving Gate - by [18SG]Juicy_J - 16.09.2008, 17:05
Re: [Tutorial] How to script a moving Gate - by Xander5270 - 16.09.2008, 17:08
Re: [Tutorial] How to script a moving Gate - by Magor - 16.09.2008, 17:14
Re: [Tutorial] How to script a moving Gate - by [18SG]Juicy_J - 16.09.2008, 17:25
Re: [Tutorial] How to script a moving Gate - by Magor - 16.09.2008, 17:28
Re: [Tutorial] How to script a moving Gate - by Xander5270 - 16.09.2008, 17:56
Re: [Tutorial] How to script a moving Gate - by hadzx - 07.11.2010, 18:29
Re: [Tutorial] How to script a moving Gate - by DeathOnaStick - 07.11.2010, 18:30
Re: [Tutorial] How to script a moving Gate - by Pillhead2007 - 15.08.2012, 19:43
Re: [Tutorial] How to script a moving Gate - by Dan. - 15.08.2012, 19:50
Re: [Tutorial] How to script a moving Gate - by Astrais - 19.12.2012, 12:46
Re: [Tutorial] How to script a moving Gate - by CrazyChoco - 19.12.2012, 13:19
Re : [Tutorial] How to script a moving Gate - by Kethrios - 19.12.2012, 13:29
Re: [Tutorial] How to script a moving Gate - by doreto - 19.12.2012, 13:44
Re: [Tutorial] How to script a moving Gate - by Gamer_007 - 19.12.2012, 15:04
Re: [Tutorial] How to script a moving Gate - by Mike_Peterson - 19.12.2012, 15:10
Re: [Tutorial] How to script a moving Gate - by AhmedWael - 03.02.2014, 10:28
Re: [Tutorial] How to script a moving Gate - by UnknownGamer - 03.02.2014, 10:38

Forum Jump:


Users browsing this thread: 7 Guest(s)