SA-MP Forums Archive
Keep Doing it - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Keep Doing it (/showthread.php?tid=277588)



Keep Doing it - RowdyrideR - 18.08.2011

hi guys
i was asking anyone knows how to make something moving forever?
like

i want an object to move right then when it reaches to the place it moves to left again then right .... and doing this forever!
if you got what i mean? :S

Thx..


Re: Keep Doing it - Wesley221 - 18.08.2011

https://sampwiki.blast.hk/wiki/SetTimer
https://sampwiki.blast.hk/wiki/GetObjectPos
Create a timer which moves the object, and check when the object pos is at the first destination, then move him to the next position, etc etc


Re: Keep Doing it - RowdyrideR - 18.08.2011

i think i did that


Re: Keep Doing it - Norck - 18.08.2011

I quess in this case it's better to use OnObjectMoved callback instead of timer, kinda:
pawn Код:
// gObj - global var which stores objectid
// bool:gState - global var which stores current state of the object (false = 'left', true = 'right')
public OnObjectMoved(objectid)
{
    if(objectid == gObj)
    {
        if(gState)
        {
            // Move object to the 'left' here  
            gState = false;          
        }
        else
        {
            // Move object to the 'right' here
            gState = true;
        }
    }
    return 1;
}