Problem with objects :S
#1

I making INC file someting like "new pickup" problem is in this code

pawn Код:
stock CreateRing(Float:X,Float:Y,Float:Z)
{
     obj1 = CreateObject(3438,X,Y,Z+6,0.00000000,90.00000000,300);
     obj2 = CreateObject(3438,X,Y,Z-1,0.00000000,90.00000000,300);
     return true;
}
And i have one timer in INC

pawn Код:
forward MovingTimer();
public MovingTimer()
{
    new
    Float:X,
    Float:Y,
    Float:Z;
    foreach(Player, i)
    {
      if(Moving[i] == 0)
      {
        GetObjectPos(obj1 , X, Y, Z);
        MoveObject(obj1 , X, Y, Z-7,5);
        GetObjectPos(obj2, X, Y, Z);
        MoveObject(obj2, X, Y, Z+7,5);
        Moving[i] = 1;
      }
      else if(Moving[i] == 1)
      {
        GetObjectPos(obj1 , X, Y, Z);
        MoveObject(obj1 , X, Y, Z+7,5);
        GetObjectPos(obj2, X, Y, Z);
        MoveObject(obj2, X, Y, Z-7,5);
        Moving[i] = 0;
      }
    }
    return true;
}
And the problem is, when i create ring >

pawn Код:
CreateRing(2121.5203,1923.7277,10.6719);
evrything works fine BUT if i create more then one ring then just one ring changeing them position from timer, that's because of object id mess up :-/ so can someone help me how to fix it
Reply
#2

Well, you got obj1 and obj2.
If you make a new ring, your obj1 and obj2 ID will get changed to your new Ring, and your old ring will not moving anymore, if that was your problem.
Reply
#3

Yes yes yes, that is problem can you help me to fix that bug?
Reply
#4

bump, srry
Reply
#5

Quote:
Originally Posted by [H]265
Посмотреть сообщение
bump, srry
This forum has an 12 hour spam rule. Dont bump your own thread if 12 hours hasn't past.

what you could do is make an array.
pawn Код:
#define MAX_RING_OBJECTS 50

new Objects[MAX_RING_OBJECTS];

stock CreateRing(Float:X,Float:Y,Float:Z)
{
     new TempID;
     for(new i; i < MAX_RING_OBJECTS; i++)
     {
     if(i == 0)
     {
           TempID = i;
     }
     }
     Objects[TempID] = CreateObject(3438,X,Y,Z+6,0.00000000,90.00000000,300);
     TempID++;
     Objects[TempID] = CreateObject(3438,X,Y,Z-1,0.00000000,90.00000000,300);
     return true;
}
Reply
#6

Quote:
Originally Posted by [H]265
Посмотреть сообщение
bump, srry
Quote:
Originally Posted by [H]265
Посмотреть сообщение
Yes yes yes, that is problem can you help me to fix that bug?
Dont bump in a 30 minute time period.

EDIT: Nevar mind.
Reply
#7

Tnx alot, but can you just make this on your way:

pawn Код:
forward MovingTimer();
public MovingTimer()
{
    new
    Float:X,
    Float:Y,
    Float:Z;
    foreach(Player, i)
    {
      if(Moving[i] == 0)
      {
        GetObjectPos(obj1 , X, Y, Z);
        MoveObject(obj1 , X, Y, Z-7,5);
        GetObjectPos(obj2, X, Y, Z);
        MoveObject(obj2, X, Y, Z+7,5);
        Moving[i] = 1;
      }
      else if(Moving[i] == 1)
      {
        GetObjectPos(obj1 , X, Y, Z);
        MoveObject(obj1 , X, Y, Z+7,5);
        GetObjectPos(obj2, X, Y, Z);
        MoveObject(obj2, X, Y, Z-7,5);
        Moving[i] = 0;
      }
    }
    return true;
}
Reply
#8

I really don't have a clue about what you're trying to do here..

pawn Код:
forward MovingTimer();
public MovingTimer()
{
    new
    Float:X,
    Float:Y,
    Float:Z;
    for(new i; i < MAX_RING_OBJECTS; i++)
    {
    if(Objects[i] != 0){
    foreach(Player, a)
    {
      if(Moving[a] == 0)
      {
        GetObjectPos(Objects[i] , X, Y, Z);
        MoveObject(Objects[i] , X, Y, Z-7,5);
        i++;
        GetObjectPos(Objects[i], X, Y, Z);
        MoveObject(Objects[i], X, Y, Z+7,5);
        Moving[a] = 1;
      }
      else if(Moving[a] == 1)
      {
        GetObjectPos(Objects[i] , X, Y, Z);
        MoveObject(Objects[i] , X, Y, Z+7,5);
        i++;
        GetObjectPos(Objects[i], X, Y, Z);
        MoveObject(Objects[i], X, Y, Z-7,5);
        Moving[a] = 0;
      }
    }
    }
    }
    return true;
}
Reply
#9

tnx again
Reply
#10

EDIT: Again the same problem :S
Reply
#11

Edit: nevermind, i need glasses
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)