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



help - P<3TS - 15.08.2012

hello
how can i make a object moving up and down randomly without anyones interference.?


Re: help - Joe Vagos - 15.08.2012

could u clearify more


Re: help - P<3TS - 15.08.2012

the object will move up and down with any commands or without going near it.
it moves randomly.
I just need the example code please...


Re: help - Ballu Miaa - 15.08.2012

Okay but first. Make a CreateObject code with the correct model id , coordinates. I'll move it properly without any command. Once i've tested it. Ill paste it over here.


Re: help - IceMeteor - 15.08.2012

I use timer to make the object move by itself, just see at my filterscript


Re: help - P<3TS - 15.08.2012

here is the coords

Quote:

CreateObject(3865, -2712.88, 583.54, 16.30, 0.00, 0.00, 270.01); //down

CreateObject(3865, -2712.88, 583.54, 34.95, 0.00, 0.00, 270.01);//up




Re: help - [MM]RoXoR[FS] - 15.08.2012

TESTED

pawn Код:
//At top
new pipe;//To store Object ID
new loc; // To store current location of object

public OnGameModeInit()
{
//And all your codes...
    loc = 0; //Currently it is down
    pipe = CreateObject(3865, -2712.88, 583.54, 16.30, 0.00, 0.00, 270.01); //down
    new time = MoveObject(pipe,-2712.88, 583.54, 34.95,2); //Will move it up
    SetTimer("MovePipe",time,true);//time is time it takes to go up/down
    return 1;
}

forward MovePipe();
public MovePipe()
{
    switch(loc)
    {
        case 0:
        {
            MoveObject(pipe, -2712.88, 583.54, 16.30,2);
            loc = 1;
        }
        case 1:
        {   MoveObject(pipe,-2712.88, 583.54, 34.95,2);
            loc = 0;
        }
    }
    return 1;
}
//To make it move up/down



Re: help - P<3TS - 15.08.2012

Its is working
But how can i make if the object reached at the top or down then it should wait 5 seconds to go up/down again?


Re: help - [MM]RoXoR[FS] - 15.08.2012

pawn Код:
SetTimer("MovePipe",time + 5000,true);



Re: help - P<3TS - 15.08.2012

Thank you very much bro )) i must give you rep otherwise i'm an idiot
+rep