24.01.2011, 20:38
(
Last edited by ricardo178; 26/01/2011 at 06:49 PM.
)
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:
I want it to open and move to:
Ok, first we will define the objectid and we can do that:
In the top of your script put:
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:
Now, lets go make the commands!
You will do this under public OnPlayerCommandText(playerid, cmdtext[])
Ok, now i will explain all:
This is the normal format of a strcmp cmd...
You allways need to open the script with a breacket...
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!
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
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:
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!
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);
pawn Code:
CreateObject(971,256.13381958,-1338.08825684,55.71572876,0.00000000,0.00000000,35.99719238);
In the top of your script put:
pawn Code:
#include <a_samp>
new tutgate;
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);
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;
}
pawn Code:
if(strcmp(cmdtext, "/Opentutgate", true) == 0)
pawn Code:
{
pawn Code:
MoveObject(tutgate, 256.13381958,-1338.08825684,55.71572876, 1);
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");
playerid = define taht only who type the cmd see the message!
0xB4B5B7FF = Color of message!
"TutGate is Opened" = Message
pawn Code:
}
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;
}
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!