Moving object
#1

well just a question to see wich is the best and eaasiest way to make thos a moving object
lets say i created a object and i want this object to allways [fly|move] around and get the closest player to it
for example a shark object that will float at certaint speed and get the closest player to it?
i havent done anything like this but might tomorrow or soon so yeah any tips or ways to do it?
Reply
#2

Sorry for what looks like bad indentation but basically, this is how to do it.
Meh actually its not that bad.

pawn Код:
new object;
public OnGameModeInit()
{
  SetTimer("ObjectCheck", 500, true);
  object = CreateObject(3092, -1118.052368, -978.442566, 129.008102, 0.0000, 0.0000, 282.8144);
}

forward ObjectCheck();
public ObjectCheck()
{
  new Float:x, Float:y, Float:z;
    GetObjectPos(object, x, y, z);
    for(new i=0; i<MAX_PLAYERS; i++)
    {
      if(IsPlayerInRangeOfPoint(i, 5, x, y, z))
      {
        new Float:a, Float:b, Float:c;
        GetPlayerPos(i, a, b, c);
        MoveObject(object, a, b, c, 2.0);

      }
    }
}
Reply
#3

thanks yeah i thouhgt something like this will work and can you help me on how to set a camera in spectating mod behind this object?
i dont have idea about this one tried and failed lol
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)