MoveObject, Have I done this wrong?
#1

Hi all, so I've been trying to make these automatic gates, and it seems to have worked, except when i want the barriers to move, they seem to 'teleport' instead of animate. Is that caused by lag, or is it not possible to actually animate them?
Video...
Here's my code.

pawn Код:
public OnPlayerUpdate(playerid)
{
    if(GetPVarInt(playerid, "Admin") != 0) {
    if(PlayerToPoint(5, playerid, 1297.25671387,-2057.27441406,58.80771637)) {
    MoveObject(Barrier1, 1297.25671387,-2064.52441406,58.80771637, 1.00, 0,0,0);
    MoveObject(Barrier2, 1297.25671387,-2050.27441406,58.8077163, 1.00, 0,0,0);
    SetTimer("BarrierTime", 7000, false);
    }
        }
    return 1;
}
public BarrierTime()
{
    MoveObject(Barrier1, 1297.25671387,-2064.52441406,58.80771637, 2.00, 270.00000000,0.00000000,0.00000000);
    MoveObject(Barrier2, 1297.25671387,-2050.27441406,58.80771637, 2.00, 90.00000000,0.00000000,0.00000000);
    return 1;
}
And if anyone knows if theres a way to stop that camera thing happening, it's because I've put an object(speaker) on the back seats, but i don't know how to fix it.
Thanks, Aston.
Reply
#2

MoveObject(objectid, X, Y, Z, speed, Float:RotX, Float:RotY, Float:RotZ);

RotX, Y and Z should match your CreateObject rotations.

EDIT: Default is 1000, if left blank.
Reply
#3

They do, I copied the two createobject lines and changed the params to mach MoveObject ones, but they just don't animate when they move, it's like i've donee SetObjectPos orsomething
Reply
#4

Sorry, I just finished watching the video... I would try moving your OnPlayerUpdate code somewhere else... I think because it is under OnPlayerUpdate, it is basically working every few seconds. Have you forwarded BarrierTime?
Reply
#5

Oh... Try using :
pawn Код:
SetObjectRot(objectid, Float:RotX, Float:RotY, Float:RotZ);
MoveObject doesn't normally work smoothly when the rotations on each MoveObject are different.
Reply
#6

Quote:
Originally Posted by Threshold
Посмотреть сообщение
Oh... Try using :
pawn Код:
SetObjectRot(objectid, Float:RotX, Float:RotY, Float:RotZ);
MoveObject doesn't normally work smoothly when the rotations on each MoveObject are different.
SetObjectRot will 'teleport' the object.
Reply
#7

Unless you use MoveObject before it...
Reply
#8

Try using this:
pawn Код:
public OnPlayerUpdate(playerid)
{
    if(GetPVarInt(playerid, "Admin") != 0) {
    if(PlayerToPoint(5, playerid, 1297.25671387,-2057.27441406,58.80771637)) {
    MoveObject(Barrier1, 1297.25671387,-2064.52441406,58.80771637, 1.00, 0,0,0);
    MoveObject(Barrier2, 1297.25671387,-2050.27441406,58.8077163, 1.00, 0,0,0);
    SetTimer("BarrierTime", 7000, false);
    }
        }
    return 1;
}
public BarrierTime()
{
    MoveObject(Barrier1, 1297.25671387,-2064.52441406,58.80771637, 2.00, 0,0,0);
    SetObjectRot(Barrier1, 270,0,0);
    MoveObject(Barrier2, 1297.25671387,-2050.27441406,58.80771637, 2.00, 0,0,0);
    SetObjectRot(Barrier2, 90,0,0);
    return 1;
}
Sorry for the late reply, I'm watching a movie :P

(If this doesn't work, try moving the code to somewhere other than OnPlayerUpdate)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)