I need help to make my gate moving...
#1

Ok, ive made a small change with help from a friend, but we still have problems solving it, My gates will still not move and i really want the same password for them all.


#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

#include <a_samp>

new agate;
new bgate;
new cgate;
new Hgate1;
new Hgate2;
new Hgate3;


public OnPlayerSpawn(playerid)
{
Hgate1 =0;
Hgate2 =0;
Hgate3 =0;
return 1;
}

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Moving doors loaded");
print("--------------------------------------\n");
agate = CreateObject(19458, 2433.04, -2064.56, -15.71,0.000000,0.000000, 90.00);//closed
bgate = CreateObject(19458, 2457.01, -2036.56, -15.78,0.000000,0.000000, 0.00); //Closed
cgate = CreateObject(8674, 2473.69, -2083.73, -16.37,0.000000, 180.00, 0.00); //Closed
return 1;
}
public OnFilterScriptExit()
{
print("\n--------------------------------------");
print(" Moving doors unloaded");
print("--------------------------------------\n");
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{

if(strcmp(cmdtext,"/Hgate1", true) == 0)
{
if(Hgate1 == 0)
{
MoveObject(agate, 2430.00, -2064.50, -15.71, 2, 0.00, 90.00);//Opening
Hgate1 = 1;
}
if(Hgate1 == 1)
{
MoveObject(agate, 2433.04, -2064.56, -15.71, 2, 0.00, 90.00);//Closing
Hgate1 = 0;
}
return 1;
}
if(strcmp(cmdtext,"/Hgate2", true) == 0)
{
if(Hgate2 == 0)
{
MoveObject(bgate, 2457.01, -2033.15, -15.78, 2, 0.000000, 0.00);//Opening
Hgate2 = 1;
}
if(Hgate2 == 1)
{
MoveObject(bgate, 2457.01, -2036.56, -15.78, 2,0.000000, 0.00);//Closing
Hgate2 = 0;
}
return 1;
}
if(strcmp(cmdtext,"/Hgate3", true) == 0)
{
if(Hgate3 == 0)
{
MoveObject(cgate, 2475.15, -2083.73, -16.37, 2, 180.00, 0.00);//Opening
Hgate3 = 1;
}
if(Hgate3 == 1)
{
MoveObject(cgate, 2473.69, -2083.73, -16.37, 2, 180.00, 0.00);//Closing
Hgate3 = 0;
}
return 1;
}
return 0;
}
#endif
Reply
#2

show the error.
Reply
#3

Look at the parameters
pawn Код:
CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance);
MoveObject(objectid, Float:X, Float:Y, Float:Z, Float:Speed, Float:RotX = -1000.0, Float:RotY = -1000.0, Float:RotZ = -1000.0);
Reply
#4

Try this.
pawn Код:
#include <a_samp>

new vgate;

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
vgate = CreateObject(19458, 2433.04, -2064.56, -15.71, 0.00, 0.00, 90.00);//closed
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext,"/ovgate", true) == 0)
{
MoveObject(vgate, 2430.00, -2064.50, -15.71, -1000, -1000, -1000);
return 1;
}
if(strcmp(cmdtext,"/cvgate", true) == 0)
{
MoveObject(vgate, 2433.04, -2064.56, -15.71, -1000, -1000, -1000);
return 1;
}
return 0;
}
Reply
#5

Wow, when i did open the gate it just flew away, do you have any skype or something so we can communicate there?
Reply
#6

Hmm doesn't make, the changes in the coord x isn't that much, maybe its the rotations anyways check your PM's.
Reply
#7

Quote:
Originally Posted by Yur
Посмотреть сообщение
Wow, when i did open the gate it just flew away, do you have any skype or something so we can communicate there?
Well to begin.

The top-mode, where you can find all the "New" add this code:
Код:
new gate;
With this function defines the name of its gates.

-Then, when you add an object to a mode (gate building) code should look like this:
Код:
CreateObject (980, 2441.199951, -1658.800048, 15.100000, 0.000000, 0.000000, 90.027465);
(This I lupo coordinates of objects), but since we make an object that is to be shifted, code should look like this:
Код:
gate = CreateObject (980, 2441.199951, -1658.800048, 15.100000, 0.000000, 0.000000, 90.027465);
This gateway = it means that it is a facility that we defined at the top (new gates

-The following is a little tougher. You need to create a command that will open the gates of ours. The command should look like this:
i
Код:
f (strcmp (cmdtext, "/ open", true))
{
****MoveObject (gates, 309.799987, -1554.099975, 37.799999, 0.8, 0, 0, 90.027465);
****SetTimer ("zkapija", 12000, 0);
****return 1;
}
Now to explain what's the deal on 0.3e. The last 3 digits behind the speed
Код:
, 0, 0, 322);
The last 3 numbers ozacavaju ROTATION object. Since the majority of the last 3 digits are zeros that look like 0,0,0); BUILDING rotates. In order to prevent this function in the commands MoveObject, last 3 digits of this code

Код:
gate = CreateObject (980, 2441.199951, -1658.800048, 15.100000, 0.000000, 0.000000, 90.027465);
that. precise numbers of 0.000000, 0.000000, 90.027465); MoveObject put in behind the speed. If these numbers are the same in MoveObject CreateObject match, then there will be problems that you will not rotate properly gate than rotate.

Getting back to the explanation of the function of the command. MoveObject you function for moving objects. In her place the coordinates of the object you want to move the object.
Код:
(gates,
means that the object is moving, and since we have defined new gate at the top, and then MoveObject function must be the name of that object ID.

Код:
309.799987, -1554.099975, 37.799999
These numbers represent the coordinates of the object to be achieved by typing commands.

Код:
, 0.8
the speed at which an object is moving.

Код:
, 0, 0, 90.027465
and the last three numbers represent the rotation as we have said.

Код:
SetTimer ("zkapija", 12000, 0);
This function we start tge timer. "zkapija" put the name callibacka with which you want to close that facility gate. 12,000 is the time for which the gate will be closed from the time of opening, and the 0 and the right to say what it means xD.

-When we have made a command and calliback with which we close the gate. At the top of fashion, where you can find all this forward Forwards add:
Код:
zkapija forward;
Forward has so called because in it the timer so called.
Now add to the bottom of this mode calliback:
Код:
public zkapiju ()
{
****MoveObject (gate, 2441.199951, -1658.800048, 15.100000, 0.8, 0, 0, 90.027465);
****return 1;
}
This all has the same meaning as in function MoveObject command to open the gate. If you want to close the gate to return to the same position as before opening it modate to put the same coordinates as in this function:
Код:
Gate = CreateObject (980, 2441.199951, -1658.800048, 15.100000, 0.000000, 0.000000, 90.027465);
-But do not forget to put the same Poetry x, y, z coordinate closing speed!
And of course the last 3 numbers you need to place the same as in the CreateObject function that you can not rotate the object. And that's it [/ b]

And at the end of the story, I explained you how to make floating-gate closure but with a new function. At the end of the story was the thing in the last 3 numbers in that rotation functions CreateObject and MoveObject. From now on, it is easier to make a ramp that can be made with a single function but as you should before 2 coda that:
Код:
SetObjectPos (ID, 1218.4964599609, -923.35882568359, 42.84375);
*********SetObjectRot (id, 0, 0, 12); / / coordinator of the open gate
If you use the Streamer need to download the new Streamer for 0.3e features that you would cast Error When you add a rotation to the end of the function and of course instead of CreateObject function and put MoveObject CreateDynamicObject and MoveDynamicObject.
Reply
#8

How can i make a command that both closes and opens the gates like " /hgate a ", so i dont have to write
"/gateo" and "/gatec"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)