MoveObject (rotate) is lagging/desynced
#1

Was not quite sure where to post this, so yeah...

When I try to rotate an object that the z-pos is greater than 31, nothing happens (it don't rotate)
I've tested rotating the object from object z-pos 0-31, and it works as it should.

Sounds like a client problem, but I've seen that same object rotate in other servers. (Yes, with object z-pos > 31)

OnObjectMoved is being called as it should.

Here is how to create my problem:
/look - Teleports me to the object at z-pos 31
/rot90 0 - The door is opening
/rot90 0 - The door is closing
/look 1 - Teleports me to the object at z-pos 100
/rot90 1 - Nothing happens
**alt-tab for 1-10sec** - The door appear as opened
/rot90 1 - Nothing happens
**alt-tab for 1-10sec** - The door appear as closed

EDIT: If I press & hold ESC (so it flash/spam) I can see the object rotate (object z-pos > 31)
pawn Код:
#include <a_samp>
#include <zcmd>

new
    RotData[2],
    open_close[sizeof(RotData)]
;
public OnFilterScriptInit()
{
    RotData[0] = CreateObject(2004, 0.0, 0.0, 31.0, 0.0, 0.0, 0.0);
    RotData[1] = CreateObject(2004, 0.0, 0.0, 100.0, 0.0, 0.0, 0.0); //Greater than 31
    return true;
}

public OnFilterScriptExit()
{
    for(new i; i < sizeof(RotData); i++)
    {
        if(!IsValidObject(RotData[i])) continue;
        DestroyObject(RotData[i]);
    }
    return true;
}

COMMAND:rot90(playerid, params[])
{
    new rot_id = strval(params);
    if(0 <= rot_id < sizeof(RotData) && !isnull(params))
    {
        new Float:fPos[3];
        GetObjectPos(RotData[rot_id], fPos[0], fPos[1], fPos[2]);

        if(!open_close[rot_id])
        {
            MoveObject(RotData[rot_id], fPos[0], fPos[1], fPos[2]+0.0001, 0.0001, 0.0, 0.0, -90.0);
        }
        else MoveObject(RotData[rot_id], fPos[0], fPos[1], fPos[2]-0.0001, 0.0001, 0.0, 0.0, 0.0);
        open_close[rot_id] = !open_close[rot_id];
    }
    else SendClientMessage(playerid, -1, "/rot90 0 - 1");
    return true;
}

COMMAND:look(playerid, params[])
{
    SetPlayerPos(playerid, -0.8, -1.0, !strval(params) ? 31 : 100);
    TogglePlayerControllable(playerid, false);

    SetPlayerFacingAngle(playerid, 15.0);
    SetCameraBehindPlayer(playerid);
    return true;
}
EDIT:
Found a solution for anyone else facing the same problem:
Use SetObjectPos(objid, x, y, 0.0001); before MoveObject
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)