SA-MP Forums Archive
Problem with objects :S - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with objects :S (/showthread.php?tid=187619)



Problem with objects :S - [H]265 - 03.11.2010

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


Re: Problem with objects :S - KaleOtter - 03.11.2010

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.


Re: Problem with objects :S - [H]265 - 03.11.2010

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


Re: Problem with objects :S - [H]265 - 03.11.2010

bump, srry


Re: Problem with objects :S - Cameltoe - 03.11.2010

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;
}



Re: Problem with objects :S - Hal - 03.11.2010

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.


Re: Problem with objects :S - [H]265 - 03.11.2010

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;
}



Re: Problem with objects :S - Cameltoe - 03.11.2010

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;
}



Re: Problem with objects :S - [H]265 - 03.11.2010

tnx again


Re: Problem with objects :S - [H]265 - 04.11.2010

EDIT: Again the same problem :S


Re: Problem with objects :S - gamer931215 - 04.11.2010

Edit: nevermind, i need glasses