Need help PLEASE -
Hamudi_Chi - 30.11.2010
Ok so i was trying to make objects move up and down by them selfs...I tried alot of stuff and I could not figure it out!
This is the setup i have.
new ob1;
new ob2;
ob1 = CreateObject(925,-1136.44543457,-987.37402344,148.59642029,0.00000000,0.00000000,0. 00000000);
ob2 = CreateObject(2669,-1136.31091309,-991.23712158,150.75749207,0.00000000,0.00000000,18 0.00000000);
and the moveobject should be like this for each.
MoveObject(ob1 , -1136.44543457, -987.37402344, 130, 3.1);
MoveObject(ob2 , -1136.31091309,-991.23712158, 160, 3.1);
Re: Need help PLEASE -
randomkid88 - 30.11.2010
Have you tried doing it with a timer?
pawn Код:
forward MoveGates();
public OnGamemodeInit()
{
SetTimer("MoveGates", 2000, true); //2000 is 2 seconds, which means it will check every 2 seconds. Change it to whatever you want.
}
public MoveGates()
{
if(IsPlayerInRangeOfPoint(playerid, 15.0, -1136.44543457, -987.37402344, 148.59642029))
{
MoveObject(ob1 , -1136.44543457, -987.37402344, 130, 3.1);
MoveObject(ob2 , -1136.31091309,-991.23712158, 160, 3.1);
}
else
{
MoveObject(ob1 , -1136.44543457, -987.37402344, 148.59642029, 3.1);
MoveObject(ob2 , -1136.31091309,-991.23712158, 150.75749207, 3.1);
}
return 1;
}
Re: Need help PLEASE -
Hamudi_Chi - 30.11.2010
This works but it is not a gate it is objects that move up and down by them selfs i tryed almost everything i can come up with! did not work, I even tried making my own
Код:
new Float:x;
new Float:y;
new Float:z;
GetObjectPos(ob1,x,y,z);
if (z == 130)
{
MoveObject(ob1, -1136.44543457, -987.37402344, 148);
}
else
{
MoveObject(ob1, -1136.44543457, -987.37402344, 130);
}
}
but still doesn't work!! Please can you tell me another way to do it?
Re: Need help PLEASE -
randomkid88 - 30.11.2010
So you just want them to move up and down repeatedly? You can do that with my method that I posted. Just take out the IsPlayerInRangeOfPoint and replace it with what you have above.
Re: Need help PLEASE -
Hamudi_Chi - 03.12.2010
ok, thx i got it ! this is what i have now!
Код:
forward MoveGates();
new Float:z;
new Float:x;
new Float:y;
public OnGamemodeInit()
{
SetTimer("MoveGates", 2000, true); //2000 is 2 seconds, which means it will check every 2 seconds. Change it to whatever you want.
}
public MoveGates()
{
GetObjectPos(ob1, x, y, z);
if (z == 148.59642029)
{
MoveObject(ob1 , -1136.44543457, -987.37402344, 130, 3.1);
MoveObject(ob2 , -1136.31091309,-991.23712158, 160, 3.1);
}
else
{
MoveObject(ob1 , -1136.44543457, -987.37402344, 148.59642029, 3.1);
MoveObject(ob2 , -1136.31091309,-991.23712158, 150.75749207, 3.1);
}
return 1;
}
Re: Need help PLEASE -
randomkid88 - 03.12.2010
That should work. Depending on your move speed, you might want to adjust the "2000" to something more or less, because:
If object 1 takes even 2.2 seconds to get to the z position, 148, the timer has already moved on and you will have to wait until the next cycle, another 2 seconds, before it moves again. If it takes less time, it sits there waiting. It isn't a big deal really depending on what you want to do with it.
Just experiment with it!