Moving Objects Back To Where it Started Moving?
#1

Hey Guys I need To Ask A Question :
Is It Possible to move Object back to where it started moving?
pawn Код:
if(strcmp("/movef", cmdtext, true, 10) ==0)
                    {
                    MoveObject(objectid2,-1753.5853,885.3674,295.8750,19.00);
                    return 1;
                    }
If Yes Plz Tell Me How To Do It Using To Move Back The Object To Where It Was
Reply
#2

yes it is... Use again MoveObjects and use coords , i mean use orignal coords from create object... For this make another cmd or use timer.
Reply
#3

This is basic right here:

pawn Код:
if(strcmp("/movef", cmdtext, true, 10) ==0)
{
    if(gatename <= 0)
    {
        MoveObject(objectid2,-1753.5853,885.3674,295.8750,19.00);
    }
    else if(gatename >= 1)
    {
        MoveObject(objectid2,originalposx,originalposy,originalposz);
    }
    return 1;
}
First, you should create a global variable for the gate it is. So, as you see, if gatename is less then or equal to 0, it would move it to the cords you specified above. If it is greater then or equal to 1, it would move it back to the original position, which you must edit yourself, as you didn't show a createobject for the gate.

Notice, feel free to change it as you like, or, if you want two commands instead of making a global variable, just show me the first createobject for objectid2.

Or as the above poster said, you could probably make a timer too that would close after a certain amount of milliseconds has past.
Reply
#4

yes just use MoveObject with the cordinates you created the object in first place!
example
pawn Код:
//needs to be at the top
new Gate1;//Its global
if(strcmp("/movef", cmdtext, true, 10) ==0)
    {
        if (Gate1==0){
                Gate1=1;
                MoveObject(objectid2,-1753.5853,885.3674,295.8750,19.00);
        }else{
                Gate1=0;
                MoveObject(objectid2,0,0,0,19.00);//the X,Y,Z of the original object pos
        }
        return 1;
    }
Reply
#5

pawn Код:
if(strcmp("/movef", cmdtext, true, 10) ==0)
                    {
                    MoveObject(objectid2,-1753.5853,885.3674,295.8750,19.00);
                    return 1;
                    } //this is the cmd
objectid2 = CreateObject(19338,2340.0117,-377.1778,757.0559,0.0,0.0,0.0,0.0); //the object
new objectid2; //on top of script
I want to make 2 cmd the first /movef to move the object to a location and the 2nd /moveb to move the object back to its original place
Reply
#6

pawn Код:
if(strcmp("/movef", cmdtext, true, 10) ==0)
{
    MoveObject(objectid2,-1753.5853,885.3674,295.8750,19.00);
    return 1;
}
if(strcmp("/moveb", cmdtext, true, 10) ==0)
{
    MoveObject(objectid2,2340.0117,-377.1778,757.0559,19.00);
    return 1;
}
That simple, just add the coords of the createobject into the new moveobject under the new command.
Reply
#7

Thx All For Replies It Helped Me Alot and thank you Kindred For the Code It Worked
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)