SA-MP Forums Archive
Object Moving Too Fast - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Object Moving Too Fast (/showthread.php?tid=561004)



Object Moving Too Fast - ProjectMan - 31.01.2015

I have a bug that looks like this: [ame]http://www.youtube.com/watch?v=l7ZvkTp_tQQ[/ame]

This is my code:

pawn Код:
public Zones_Update()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {

                if( IsPlayerInRangeOfPoint(i,7.0,1544.699951, -1630.829956, 13.040000) && PlayerInfo[i][pTeam] == TEAM_COPS)
                {
                    MoveDynamicObject(LSPDGate,1544.699951, -1630.829956, 13.040000,0.05, 0.0,0.0,90.0);
                    }
                    else
                    {
                    MoveDynamicObject(LSPDGate,1544.699951, -1630.829956, 13.040000,0.05, 0.0,90.0,90.0);
                }
        }
    }
    return 1;
}
Speed of 0.05 still does the same. I have no idea what is wrong. BTW this public is in a timer.


Re: Object Moving Too Fast - zaibaslr2 - 31.01.2015

Quote:
Originally Posted by ProjectMan
Посмотреть сообщение
I have a bug that looks like this: http://www.youtube.com/watch?v=l7ZvkTp_tQQ

This is my code:

pawn Код:
public Zones_Update()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {

                if( IsPlayerInRangeOfPoint(i,7.0,1544.699951, -1630.829956, 13.040000) && PlayerInfo[i][pTeam] == TEAM_COPS)
                {
                    MoveDynamicObject(LSPDGate,1544.699951, -1630.829956, 13.040000,0.05, 0.0,0.0,90.0);
                    }
                    else
                    {
                    MoveDynamicObject(LSPDGate,1544.699951, -1630.829956, 13.040000,0.05, 0.0,90.0,90.0);
                }
        }
    }
    return 1;
}
Speed of 0.05 still does the same. I have no idea what is wrong. BTW this public is in a timer.
Did you try a little higher speed? Like 1 or 2?


Re: Object Moving Too Fast - Schneider - 31.01.2015

Edit: Excuse me, it's not in milliseconds..


Re: Object Moving Too Fast - ProjectMan - 31.01.2015

Quote:
Originally Posted by zaibaslr2
Посмотреть сообщение
Did you try a little higher speed? Like 1 or 2?
Yes. Any speed makes no difference.


Re: Object Moving Too Fast - IstuntmanI - 31.01.2015

https://sampwiki.blast.hk/wiki/MoveObject

Quote:

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).

So you also have to move the object a bit:
pawn Код:
public Zones_Update()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {

                if( IsPlayerInRangeOfPoint(i,7.0,1544.699951, -1630.829956, 13.040000) && PlayerInfo[i][pTeam] == TEAM_COPS)
                {
                    MoveDynamicObject(LSPDGate,1544.699951, -1630.829956, 13.040000,0.05, 0.0,0.0,90.0);
                    }
                    else
                    {
                    MoveDynamicObject(LSPDGate,1544.699951, -1630.829956 + 0.05, 13.040000,0.05, 0.0,90.0,90.0);
                }
        }
    }
    return 1;
}
^ this will move it in one second (not really sure about the order, if it doesn't work, try changing the "+ 0.05" from the second to first), because it moves 0.05 units, and moves with a speed of 0.05 units per second.


Re: Object Moving Too Fast - ProjectMan - 31.01.2015

Quote:
Originally Posted by IstuntmanI
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/MoveObject



So you also have to move the object a bit:
pawn Код:
public Zones_Update()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {

                if( IsPlayerInRangeOfPoint(i,7.0,1544.699951, -1630.829956, 13.040000) && PlayerInfo[i][pTeam] == TEAM_COPS)
                {
                    MoveDynamicObject(LSPDGate,1544.699951, -1630.829956, 13.040000,0.05, 0.0,0.0,90.0);
                    }
                    else
                    {
                    MoveDynamicObject(LSPDGate,1544.699951, -1630.829956 + 0.05, 13.040000,0.05, 0.0,90.0,90.0);
                }
        }
    }
    return 1;
}
^ this will move it in one second (not really sure about the order, if it doesn't work, try changing the "+ 0.05" from the second to first), because it moves 0.05 units, and moves with a speed of 0.05 units per second.
Brilliant. It works now. Never knew about this. Thanks!


Re: Object Moving Too Fast - Sime30 - 31.01.2015

Try like 0.0008


Re: Object Moving Too Fast - Karolukas123 - 01.02.2015

Good evening, just use RotateObject (gates object name, 0.0000, 0.0000, 0.0000, speed);