PDA

View Full Version : Gate does not move how I want it to.


Stefand
12/06/2013, 11:31 AM
I made a automatic open PD gate, but it does not show motion, when you come close it just stands open without moving.

I dont see any mistakes in my script so..


pdgate = CreateObject(968, 1544.68005, -1630.89001, 13.05000, 0.00000, 90.00000, 90.00000);

if(Factions[Player[i][Faction]][CommandTypes] == 1 || Factions[Player[i][Faction]][CommandTypes] == 3)
{
if(pdgatestatus == 0)
{
if(IsPlayerInRangeOfPoint(i, 20, 1544.6823, -1627.3782, 12.3759))
{
pdgatestatus = 1;
MoveObject(pdgate, 1544.68005, -1630.89001, 13.05000, 1, 0,0, 90.00);
SetTimerEx("ClosePDGate", 7000, false, "");
}
}
}

public ClosePDGate()
{
if(pdgatestatus == 1)
{
pdgatestatus = 0;
MoveObject(pdgate, 1544.68005, -1630.89001, 13.05000, 1, 0.00000, 90.00000, 90.00000);
}
return 1;
}

EDIT: Picture added

https://dl.dropboxusercontent.com/u/75413998/Untitled.png

AntonioCroatia
12/06/2013, 11:57 AM
you don't have i

try this:


pdgate = CreateObject(968, 1544.68005, -1630.89001, 13.05000, 0.00000, 90.00000, 90.00000);

if(!IsPlayerConnected(i));
{
if(Factions[Player[i][Faction]][CommandTypes] == 1 || Factions[Player[i][Faction]][CommandTypes] == 3)
{
if(pdgatestatus == 0)
{
if(IsPlayerInRangeOfPoint(i, 20, 1544.6823, -1627.3782, 12.3759))
{
pdgatestatus = 1;
MoveObject(pdgate, 1544.68005, -1630.89001, 13.05000, 1, 0,0, 90.00);
SetTimerEx("ClosePDGate", 7000, false, "");
}
}
}
}

public ClosePDGate()
{
if(pdgatestatus == 1)
{
pdgatestatus = 0;
MoveObject(pdgate, 1544.68005, -1630.89001, 13.05000, 1, 0.00000, 90.00000, 90.00000);
}
return 1;
}
sry I'm on mobile

Stefand
12/06/2013, 12:01 PM
I have i, its under a check that checks every 1 sec, so when it is close to the object it will automaticly open. It opens but not correct...

AntonioCroatia
12/06/2013, 12:04 PM
does you got any warn error?

Stefand
12/06/2013, 12:07 PM
nope, again IT WORKS but not correctly, it just spawn in the position how it should be after moving

Pottus
12/06/2013, 12:19 PM
You didn't even set it to move correctly, you need to give a small movement on the X, Y or Z axis.

http://wiki.sa-mp.com/wiki/MoveObject

"Important Note: This function can be used to make objects rotate smoothly. In order to achieve this however, the object must also be moved. The specified rotation is the rotation the object will have after the movement. Hence the object will not rotate when no movement is applied. For a script example take a look at the ferriswheel.pwn filterscript made by Kye included in the server package (SA-MP 0.3d and above)."

CreateObject(968, 1544.68005, -1630.89001, 13.05000, 0.00000, 90.00000, 90.00000);
MoveObject(pdgate, 1544.68005, -1630.89001, 13.05000, 1, 0,0, 90.00);
MoveObject(pdgate, 1544.68005, -1630.89001, 13.05000, 1, 0.00000, 90.00000, 90.00000);

Stefand
12/06/2013, 02:06 PM
Pottus;2566257']You didn't even set it to move correctly, you need to give a small movement on the X, Y or Z axis.

http://wiki.sa-mp.com/wiki/MoveObject

"Important Note: This function can be used to make objects rotate smoothly. In order to achieve this however, the object must also be moved. The specified rotation is the rotation the object will have after the movement. Hence the object will not rotate when no movement is applied. For a script example take a look at the ferriswheel.pwn filterscript made by Kye included in the server package (SA-MP 0.3d and above)."

CreateObject(968, 1544.68005, -1630.89001, 13.05000, 0.00000, 90.00000, 90.00000);
MoveObject(pdgate, 1544.68005, -1630.89001, 13.05000, 1, 0,0, 90.00);
MoveObject(pdgate, 1544.68005, -1630.89001, 13.05000, 1, 0.00000, 90.00000, 90.00000);

So how should the code look like then?


CreateObject(968, 1544.68, -1630.89, 13.05, 0.00, 90.00, 90.00);
MoveObject(pdgate, 1544.68, -1630.89, 13.05, 1, 0.00,0.00, 90.00);
MoveObject(pdgate, 1544.68, -1630.89, 13.05, 1, 0.000, 90.00, 90.00);

Stefand
12/06/2013, 10:13 PM
Oke tried the code above same problem..

park4bmx
12/06/2013, 10:20 PM
you are trying to move the Gate in the exact same position !
the only difference i saw was under the conditon if(pdgatestatus == 0)
you didnt add the last rotation parameter if you want it to rotate that then you need to add a [b]value[/u] !
e.g. 0.00

Stefand
12/06/2013, 10:27 PM
you are trying to move the Gate in the exact same position !
the only difference i saw was under the conditon if(pdgatestatus == 0)
you didnt add the last rotation parameter if you want it to rotate that then you need to add a [b]value[/u] !
e.g. 0.00

Check two posts up, its changed and still not working

park4bmx
12/06/2013, 10:32 PM
The pivot of the object rotation can be on a different parameter how do you know is the second one ?

Stefand
12/06/2013, 10:34 PM
What do you mean? Did you see the picture on the first post? That is what suppose to happen but then in smooth motion..

park4bmx
12/06/2013, 10:37 PM
So they do move but don't show the animation ?

Stefand
13/06/2013, 05:40 AM
So they do move but don't show the animation ?

Correct it dissapears and spawns in the position of the open gate, it does not show motion

park4bmx
13/06/2013, 08:37 AM
you can only rotate an object if you have moved the object.
The chosen rotation is the rotation the object will have after the movement, the object will not rotate when no movement is applied!

Stefand
13/06/2013, 09:12 AM
Strange.. My other gates work fine with rotations

park4bmx
13/06/2013, 09:35 AM
just move the object a few inches (+0.05)

Stefand
13/06/2013, 12:24 PM
just move the object a few inches (+0.05)

Worked, Thank you so much xD REP Plusssss