SA-MP Forums Archive
Moving objects - 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: Moving objects (/showthread.php?tid=459175)



Moving objects - Lajko1 - 21.08.2013

Hello!

I don't have single idea how I should make Moving objects, I know how to make single movable objects like doors and so on but a thing I want to make is object that is moving left and right non stop, how should I make this ?


Re: Moving objects - sleepysnowflake - 21.08.2013

timers and moving objects, onobjectmoved many choices really


Re: Moving objects - Lajko1 - 21.08.2013

Uhh maybe example code ?


Re: Moving objects - Lajko1 - 21.08.2013

Anyone ? :/


Re: Moving objects - cray1100 - 21.08.2013

My script for example...
pawn Код:
new Garagedoor1;
new Gatetime;
Garagedoor1 = CreateObject(16773, 914.78003, 872.05969, 16.29810,   0.00000, 0.00000, 90.00000);


==============================================================
Gatetime = MoveObject(Garagedoor1, 914.78003, 872.05969, 8.3654, 3.00);
SetTimer("GateClose", Gatetime, 0);
pawn Код:
forward GateClose(playerid);
public GateClose(playerid)
{
    MoveObject(Garagedoor1, 914.78003, 872.05969, 16.29810, 3.00);
    return 1;
}

This opens, and closes as soon as it opens all the way... What exactly do you need? I can script it bro.


Re: Moving objects - cray1100 - 21.08.2013

From what i see, you want an object to start moving as soon as your script is loaded, and not stop moving, and it will move left to right to left and so on, non-stop...


pawn Код:
new Garagedoor1;
Garagedoor1 = CreateObject(16773, 914.78003, 872.05969, 16.29810,   0.00000, 0.00000, 90.00000);
new Gatetime;
pawn Код:
CMD:movegate(playerid, params[])
{
Gatetime = MoveObject(Garagedoor1, 914.78003, 872.05969, 8.3654, 3.00);
SetTimer("GateClose", Gatetime, 0);
return1;
}
pawn Код:
forward GateClose(playerid);
forward GateOpen(playerid);
public GateClose(playerid)
{
MoveObject(Garagedoor1, 914.78003, 872.05969, 8.3654, 3.00);
SetTimer("GateOpen", Gatetime, 0);
return 1;
}
public GateOpen(playerid)
{
MoveObject(Garagedoor1, 914.78003, 872.05969, 16.29810, 3.00);
SetTimer("GateClose", Gatetime, 0);
return 1;
}
This the modified version of my code, it will continuously move a garage door up and down in my server, I dont know if this is what you wanted but this works, and you can call the command anyway you want...