MoveDynamicObject strange bug
#2

Well the only thing I can really see is your 'if' 'else' statements.

pawn Код:
new var = 1; //Variable is set to 1
if(var == 1) //Variable is equal to 1, so this is called.
{
    var = 0; //Variable is set to 0
}
else //Variable is no longer set to 1, so this is called.
{
    var = 1; //Variable is set to 1
}
//Variable is now it's original value, 1.
This is a common mistake which can easily be fixed by using 'else if' rather than 'else'. Or another alternative is this:
pawn Код:
if(sMap[id][MAP_OBJECT_DB][ide] == m_objid)
{
    if(!sMoves[i][MOVE_CURPOS])
    {
        new Float:opos[3], m_debug[128];
        GetDynamicObjectPos(sMap[id][MAP_OBJECT_ID][ide], opos[0], opos[1], opos[2]);
        format(m_debug, sizeof(m_debug), "FROM %f, %f, %f", opos[0], opos[1], opos[2]);
        SendClientMessageToAll(-1, m_debug);
        format(m_debug, sizeof(m_debug), "TO %f, %f, %f", sMoves[i][MOVE_NEWPOS][0], sMoves[i][MOVE_NEWPOS][1], sMoves[i][MOVE_NEWPOS][2]);
        SendClientMessageToAll(-1, m_debug);
        if(sMoves[i][MOVE_NEWPOS][3] == 0.0 && sMoves[i][MOVE_NEWPOS][4] == 0.0 && sMoves[i][MOVE_NEWPOS][5] == 0.0) SendClientMessageToAll(-1, "No rotation");
        MoveDynamicObject(sMap[id][MAP_OBJECT_ID][ide], sMoves[i][MOVE_NEWPOS][0], sMoves[i][MOVE_NEWPOS][1], sMoves[i][MOVE_NEWPOS][2], sMoves[i][MOVESPEED], sMoves[i][MOVE_NEWPOS][3], sMoves[i][MOVE_NEWPOS][4], sMoves[i][MOVE_NEWPOS][5]);
    }
    else MoveDynamicObject(sMap[id][MAP_OBJECT_ID][ide], sMoves[i][MOVE_OLDPOS][0], sMoves[i][MOVE_OLDPOS][1], sMoves[i][MOVE_OLDPOS][2], sMoves[i][MOVESPEED], sMoves[i][MOVE_OLDPOS][3], sMoves[i][MOVE_OLDPOS][4], sMoves[i][MOVE_OLDPOS][5]);
    sMoves[i][MOVE_CURPOS] = (sMoves[i][MOVE_CURPOS]) ? (0) : (1);
    return 1;
}
See if this changes anything.
Reply


Messages In This Thread
MoveDynamicObject strange bug - by shadowdog - 23.03.2015, 13:24
Re: MoveDynamicObject strange bug - by Threshold - 23.03.2015, 13:36
Re: MoveDynamicObject strange bug - by shadowdog - 23.03.2015, 13:47

Forum Jump:


Users browsing this thread: 1 Guest(s)