SA-MP Forums Archive
MoveObject Automatically - 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: MoveObject Automatically (/showthread.php?tid=237749)



MoveObject Automatically - Gemini - 10.03.2011

How can I make a object, move automatically, without using a command like /open blablabla.
Because I already know how to do that, but now I would like to make a moving container, between 2 ships, its in a DM zone. Offcourse you cant keep writing '/move container' all the time when you're in a dm zone, so i would like to make this move between 2 coordinates, 3043.60839844,1032.44091797,18.58981705 and 3092.70214844,1016.84442139,18.58981705. Moving back and forth without a command.

Is this possible? if yes, how?


Re: MoveObject Automatically - Riddick94 - 10.03.2011

pawn Code:
if(IsPlayerInRangeOfPoint(playerid, Float:Range, Float:X, Float:Y, Float:Z)
{
MoveObject(YourVariable, X, Y, Z);
}



Re: MoveObject Automatically - Gemini - 10.03.2011

Is it synced? Because I made this container so people can jump on it and go to the other side of the dm zone (ship).


Re: MoveObject Automatically - Gemini - 10.03.2011

And does it move back and forth between the coordinates with this command? Or does it only move once?


Re: MoveObject Automatically - Riddick94 - 10.03.2011

pawn Code:
if(IsPlayerInRangeOfPoint(playerid, Float:Range, Float:X, Float:Y, Float:Z)
{
    for(new i, Max = GetMaxPlayers(); i < Max; i++)
    {
        MoveObject(i, YourVariable, X, Y, Z); // Open.
        }else{
        MoveObject(i, YourVariable, X, Y, Z); // Close.
    }
}
I think it should working.