[Tutorial] How to make moving/rotating objects
#1

Hello guys, i have learn with a toturial but it was a litle hard to understund then i will try to make it the most simple then possible explaining all!

So to make an object move you need:

1є: Have the object in your script... i will use this one:

pawn Code:
CreateObject(971,263.51126099,-1333.59973145,55.90000153,0.00000000,0.00000000,35.99719238);
I want it to open and move to:

pawn Code:
CreateObject(971,256.13381958,-1338.08825684,55.71572876,0.00000000,0.00000000,35.99719238);
Ok, first we will define the objectid and we can do that:

In the top of your script put:

pawn Code:
#include <a_samp>

new tutgate;
What do new tutgate; do? It containts the object ID after creating it (CreateObjects returns the object ID)"
Now, we will put the object into the GameMode/FilterScript:
Put this at Public OnGameModeInit or public OnFilterScriptInit:

pawn Code:
tutgate = CreateObject(971,263.51126099,-1333.59973145,55.90000153,0.00000000,0.00000000,35.99719238);
Now, lets go make the commands!

You will do this under public OnPlayerCommandText(playerid, cmdtext[])

pawn Code:
if(strcmp(cmdtext, "/Opentutgate", true) == 0)
{
    MoveObject(tutgate, 256.13381958,-1338.08825684,55.71572876, 1);
    SendClientMessage(playerid, 0xB4B5B7FF, "TutGate Opened");
    return 1;
}
Ok, now i will explain all:

pawn Code:
if(strcmp(cmdtext, "/Opentutgate", true) == 0)
This is the normal format of a strcmp cmd...

pawn Code:
{
You allways need to open the script with a breacket...

pawn Code:
MoveObject(tutgate, 256.13381958,-1338.08825684,55.71572876, 1);
MoveObject = Function that make it move!
tutgate = Object to move!
256.13381958,-1338.08825684,55.71572876 = Coordenates to move!
1 = Speed it move, it can open fast or slow!

pawn Code:
SendClientMessage(playerid, 0xB4B5B7FF, "TutGate Opened");
SendClientMessage = Send mensage to the player whos types it!
playerid = define taht only who type the cmd see the message!
0xB4B5B7FF = Color of message!
"TutGate is Opened" = Message

pawn Code:
}
That close your script!

All explained, to make the close cmd, only do the some but put the coordenates to close!

It will look just like this:

pawn Code:
#include <a_samp>
new tutgate;

public OnFilterScriptInit()
{
    tutgate = CreateObject(971,263.51126099,-1333.59973145,55.90000153,0.00000000,0.00000000,35.99719238);
    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/Opentutgate", true) == 0)
    {
        MoveObject(tutgate, 256.13381958,-1338.08825684,55.71572876, 1);
        SendClientMessage(playerid, 0xB4B5B7FF, "TutGate Opened");
        return 1;
    }
    return 0;
}
About Rotate Objects...

It is the something but the code should be like that:

[pawn]
Not MoveObject but yes:

SetObjectRot(ObjectId, coordenateX, coordenateY, coordenateZ);

Hope it is HelpFull!
Reply


Messages In This Thread
How to make moving/rotating objects - by ricardo178 - 24.01.2011, 20:38
Re: How to make moving/rotating objects - by Anthonyx3' - 24.01.2011, 21:00
Re: How to make moving/rotating objects - by ricardo178 - 24.01.2011, 21:48
Re: How to make moving/rotating objects - by Anthonyx3' - 24.01.2011, 21:55
Re: How to make moving/rotating objects - by ricardo178 - 24.01.2011, 22:05
Re : How to make moving/rotating objects - by Hip-hop - 26.01.2011, 14:31
Re: Re : How to make moving/rotating objects - by ricardo178 - 26.01.2011, 16:47
Re: How to make moving/rotating objects - by Kwarde - 26.01.2011, 18:18
Re: How to make moving/rotating objects - by ricardo178 - 26.01.2011, 18:47
Re : How to make moving/rotating objects - by Cedriic - 28.01.2011, 06:18

Forum Jump:


Users browsing this thread: 1 Guest(s)