MoveObject more times -
Freddy Z - 02.04.2010
I know the command MoveObject, but how can i make an object move more times? i mean, once the object moved, how do you make it move again somwhere else and so on?
Using only one /textcommand for once
Re: MoveObject more times -
mysql - 02.04.2010
You could add a timer to check when object get to that pos it moves again to other pos.
Re: MoveObject more times -
Freddy Z - 03.04.2010
But the function called must be public...
since i want the player to be on the moving object, i did this
pawn Код:
public OnObjectMoved(objectid)
{
if(IsPlayerInRangeOfPoint(playerid,10,994.28308105469, 1051.5045166016, 50.0))
{
MoveObject(obj,971.3954,2968.8677,110.6146, 75.00);
}
if(IsPlayerInRangeOfPoint(playerid,10,971.3954,2968.8677,110.6146))
{
MoveObject(obj,-3046.0269,3009.7258,110.6146,75.00);
}
return 1;
}
But
pwn(271) : error 017: undefined symbol "playerid"
pwn(275) : error 017: undefined symbol "playerid"
Re: MoveObject more times -
bajskorv123 - 03.04.2010
pawn Код:
//Filterscriptinit
SetTimer("Move", 500, false);
//Somewhere in script
forward Move(objectid);
public Move(objectid)
{
MoveObject(obj1, Float:X, Float:Y, Float:Z, 2.5000);
SetTimer("MoveNext", (MoveObject(obj1, Float:X, Float:Y, Float:Z, 2.5000)), false);//Calculates how long it will take for obj1 to move
}
forward MoveNext(objectid);
public MoveNext(objectid)
{
MoveObject(obj2, Float:X, Float:Y, Float:Z, 2.5000);
SetTimer("MoveNext2", (MoveObject(obj2, Float:X, Float:Y, Float:Z, 2.5000)), false);
}
forward MoveNext2(objectid);
public MoveNext2(objectid)
{
MoveObject(obj3, Float:X, Float:Y, Float:Z, 2.5000);
SetTimer("MoveNext2", (MoveObject(obj3, Float:X, Float:Y, Float:Z, 2.5000)), false);
}
Then keep doing it like that, the example above will do the following:
1. Filterscript starts, sets a 0.5 second timer to start the "Move" function.
2. Timer starts "Move" function wich moves obj1 to X Y Z then sets a timer to start "MoveNext" function when obj1 is finished.
3. Timer starts "MoveNext" function wich moves obj2 to X Y Z then sets a timer to start "MoveNext2" function when obj2 is finished.
4. Timer starts "MoveNext2" function wich moves obj3 to X Y Z then sets a timer to start "MoveNext3" function when obj3 is finished.
5. Then you can keep doing it like that.
Re: MoveObject more times -
Freddy Z - 03.04.2010
I added what you've written at the bottom of the script but
pwn(97
: error 017: undefined symbol "obj1"
pwn(984) : error 017: undefined symbol "obj2"
pwn(985) : error 017: undefined symbol "obj2"
pwn(991) : error 017: undefined symbol "obj3"
pwn(992) : error 017: undefined symbol "obj3"
pawn Код:
forward Move(objectid);
public Move(objectid)
{
MoveObject(obj1, Float:X, Float:Y, Float:Z, 2.5000);
SetTimer("MoveNext", (MoveObject(obj1, Float:X, Float:Y, Float:Z, 2.5000)), false);//Calculates how long it will take for obj1 to move
}
forward MoveNext(objectid);
public MoveNext(objectid)
{
MoveObject(obj2, Float:X, Float:Y, Float:Z, 2.5000);
SetTimer("MoveNext2", (MoveObject(obj2, Float:X, Float:Y, Float:Z, 2.5000)), false);
}
forward MoveNext2(objectid);
public MoveNext2(objectid)
{
MoveObject(obj3, Float:X, Float:Y, Float:Z, 2.5000);
SetTimer("MoveNext2", (MoveObject(obj3, Float:X, Float:Y, Float:Z, 2.5000)), false);
}
Re: MoveObject more times -
Crezy-Boy - 03.04.2010
Check your CreateObject codes, choose the objects you want to move and add obj1= infront of it.
Re: MoveObject more times -
Freddy Z - 07.04.2010
i want to move one object only