Move Object Problem for ID 0
#1

PHP код:
forward GATECHECK();
public 
GATECHECK()
{
    for(new 
x =-1; x < MAX_PLAYERS; x++)
    {
         if( 
IsPlayerInRangeOfPoint(x, 10.0, -874.09363, 1992.82996, 61.10401) && (tCP[DAM] == TEAM_NONE || tCP[DAM] == gTeam[x]))
         {
   
MoveObject(DAMGATE11,-874.09363, 1992.82996, 61.10401-7.5, 2.5, 0.00000, 0.00000, 130.08006);
   
MoveObject(DAMGATE12,-868.90326, 1986.79724, 61.06929-7.5, 2.5, 0.00000, 0.00000, 131.40002);
   }
   else
   {
   
MoveObject(DAMGATE11,-874.09363, 1992.82996, 61.10401, 2.5,0.00000, 0.00000, 130.08006);
   
MoveObject(DAMGATE12,-868.90326, 1986.79724, 61.06929, 2.5, 0.00000, 0.00000, 131.40002);
   }
         if( 
IsPlayerInRangeOfPoint(x, 10.0, -556.04486, 1999.05920, 60.82679) && (tCP[DAM] == TEAM_NONE ||tCP[DAM] == gTeam[x]))
         {
   
MoveObject(DAMGATE21,-556.04486, 1999.05920, 60.82679-7.5, 2.5, 0.00000, 0.00000, -126.48004);
   
MoveObject(DAMGATE22,-551.18463, 2005.36987, 60.81766-7.5, 2.5, 0.00000, 0.00000, -128.46001);
   }
   else
   {
   
MoveObject(DAMGATE21,-556.04486, 1999.05920, 60.82679, 2.5, 0.00000, 0.00000, -126.48004);
   
MoveObject(DAMGATE22,-551.18463, 2005.36987, 60.81766, 2.5, 0.00000, 0.00000, -128.46001);
   }
    }
    return 
1;
} 
It works for ID 1+ but not for ID 0 IDK why
Reply
#2

You should start your loop with x=0 instead of x=-1.
You're having this statement: tCP[DAM] == gTeam[x]

This will try to access gTeam[-1] and that will cause an intern crash, and the function will stop working.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)