[Tutorial] Moving Objects
#1

Moving Objects Tutorial
By Skizzo_Trick

Hello everyone,im soo borred so i decided to make a Moving Objects Tutorial.
For beginning,let's put the object
Put this in GM/FS Beginning:
pawn Код:
new Gate;//This will create your object/gate name
Ok,now let's define that gate:
pawn Код:
Gate = CreateObject(2587, X, Y, Z, Xr, Yr, Zr);
Quote:
2587 ---ID of the Object
2001.195679 ----X Position
1547.113892 ----Y Position
14.283400 ----Z Position
0.0, 0.0, 96.0 ---- X,Y,Z Rotations of the object

You can always find X,Y,Z positions with
pawn Код:
/save
InGame!


Now let's put the objects moving!
Put this after OnPlayerCommandText:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
        if (strcmp("/pgate", cmdtext, true, 10) == 0)
            {
            MoveObject(Gate,X, Y, Z+/-3,0.97);//This will move the gate
            }
            return 1;
        }
        if (strcmp("/pgateclose", cmdtext, true, 10) == 0)
            {
            MoveObject(Gate,X, Y, Z,3,0.97);//This will move the gate back to the old position
            }
            return 1;
        }

return 1;
}
My commands will move the gate up/down!

Quote:
Gate ----The object name that we have fixed in the GM Begin
X ----The new X position(can be the same with first one if you wish to move the gate in another position!)
Y ----The new Y position(can be the same with first one if you wish to move the gate in another position!)
Z ----The new Z Position(can be the same with first one if you wish to move the gate in another position!)
0.97 ----The speed of which the object will be moved with.

This was the simple mod,but if you want an automatic gate,try this

pawn Код:
public OnPlayerCommandText(...)
{
        if (strcmp("/pgate", cmdtext, true, 10) == 0)
            {
            MoveObject(Gate,X, Y, Z+/-3,0.97);//This will move the gate
            SendClientMessage(playerid,COLOR_BLUE,"You have opened the gate,it will be closed in 7 seconds!");//This will send an message announcing the gate Stats!
            SetTimer("GateClose", 7000, 0);//This will start the counting till the gate will be closed!
            }
            return 1;
        }

return 1;
}


forward GateClose(playerid)//This will forward the closing gate function
public GateClose(playerid)//This will define the closing gate function
{
      MoveObject(Gate,X, Y, Z-/+3,0.97);//This will move the gate
      PlayerPlaySound(playerid, 1153, x,y,z);// This will play the gate sound near the gate
      return 1;
}


1)Do not copy/paste this tutorial
2)All the rights goes to Skizzo_Trick
Reply


Messages In This Thread
Moving Objects - by SkizzoTrick - 01.12.2010, 16:31
Re: Moving Objects - by Ruffles. - 01.12.2010, 19:59
Re: Moving Objects - by SkizzoTrick - 01.12.2010, 20:16
Re: Moving Objects - by scripter1 - 01.12.2010, 20:51
Re: Moving Objects - by Mean - 03.12.2010, 21:19
Re: Moving Objects - by Sweet_Mafia™ - 04.12.2010, 20:17
Re: Moving Objects - by SkizzoTrick - 04.12.2010, 20:41
Re: Moving Objects - by Sweet_Mafia™ - 05.12.2010, 02:28
Re: Moving Objects - by Scenario - 05.12.2010, 02:53
Re: Moving Objects - by Sweet_Mafia™ - 05.12.2010, 08:40
Re: Moving Objects - by SkizzoTrick - 05.12.2010, 08:52
Re: Moving Objects - by omer5198 - 05.12.2010, 13:12
Re: Moving Objects - by Sweet_Mafia™ - 05.12.2010, 15:20
Re: Moving Objects - by Sweet_Mafia™ - 05.12.2010, 17:41
Re: Moving Objects - by SkizzoTrick - 05.12.2010, 17:50
Re: Moving Objects - by Sweet_Mafia™ - 05.12.2010, 20:34
Re: Moving Objects - by SkizzoTrick - 23.01.2011, 12:57
Re: Moving Objects - by whisperftw - 28.01.2011, 15:38
Re: Moving Objects - by ricardo178 - 28.01.2011, 18:09
Re: Moving Objects - by antonio112 - 05.02.2011, 12:30
Re: Moving Objects - by SkizzoTrick - 06.02.2011, 14:24
Re: Moving Objects - by [M.A]Angel[M.A] - 21.02.2011, 02:34
Re: Moving Objects - by boslosos - 13.05.2015, 07:10
Re: Moving Objects - by Mitchyjones - 18.08.2016, 04:07

Forum Jump:


Users browsing this thread: 1 Guest(s)