01.12.2010, 16:31
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
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 |
pawn Код:
/save
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;
}
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. |
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