Automatically moving object
#1

how can i make a object moving up and down continuosly without anyones presence or using cmds?
It should move randomly.
How to script? anyone plz help
Reply
#2

Use general timers.
Reply
#3

Do you want them to move up once a player is near them?

Here's a code so when you approach the gate it goes up so you can pass.

pawn Код:
new object; // Save here your object

public OnPlayerUpdate(playerid)
{

if(IsPlayerInRangeOfPoint(playerid, 2.0, object)
{
MoveObject(object, /*coordinates*/); // Coordinates for gate UP
}
else
{
MoveObject(object, /*coordinates*/); // Coordinates for gate DOWN
}

}
Reply
#4

Not like that as i told above i want it to move the objects without anyone's interference.Like moving up and down continuously.
Reply
#5

Quote:
Originally Posted by P<3TS
Посмотреть сообщение
Not like that as i told above i want it to move the objects without anyone's interference.Like moving up and down continuously.
https://sampwiki.blast.hk/wiki/SetTimer
https://sampwiki.blast.hk/wiki/MoveObject
Reply
#6

But i dont know how to code that
can you show me an example code so that it is easy to study
Reply
#7

pawn Код:
// Top
new
    theObject;

// Gamemode Init
theObject = CreateObject(...);
MoveObject(theObject, ...);

// Anywhere else
forward @MoveObject(objectid, Float:X, Float:Y, Float:Z, Float:Speed);
@MoveObject(objectid, Float:X, Float:Y, Float:Z, Float:Speed) return MoveObject(objectid, X, Y, Z, Speed);

public OnObjectMoved(objectid)
{
    new rand = 1000 * random(10); // how many seconds between moving? (10)
    SetTimerEx("@MoveObject", rand, 0, "dffff", objectid, /* insert x, y, z */, 3.0);
    return 1;
}
Reply
#8

Vince i did something like you said

i want to move this object up and down
pawn Код:
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
But it is showing errors and all, can you please set those cords in the code which you given me?
Reply
#9

help please
Reply
#10

Anyone?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)