Move Object Problem for ID 0
#1

PHP код:
forward GATECHECK();
public 
GATECHECK()
{
    for(new 
=-1MAX_PLAYERSx++)
    {
         if( 
IsPlayerInRangeOfPoint(x10.0, -874.093631992.8299661.10401) && (tCP[DAM] == TEAM_NONE || tCP[DAM] == gTeam[x]))
         {
   
MoveObject(DAMGATE11,-874.093631992.8299661.10401-7.52.50.000000.00000130.08006);
   
MoveObject(DAMGATE12,-868.903261986.7972461.06929-7.52.50.000000.00000131.40002);
   }
   else
   {
   
MoveObject(DAMGATE11,-874.093631992.8299661.104012.5,0.000000.00000130.08006);
   
MoveObject(DAMGATE12,-868.903261986.7972461.069292.50.000000.00000131.40002);
   }
         if( 
IsPlayerInRangeOfPoint(x10.0, -556.044861999.0592060.82679) && (tCP[DAM] == TEAM_NONE ||tCP[DAM] == gTeam[x]))
         {
   
MoveObject(DAMGATE21,-556.044861999.0592060.82679-7.52.50.000000.00000, -126.48004);
   
MoveObject(DAMGATE22,-551.184632005.3698760.81766-7.52.50.000000.00000, -128.46001);
   }
   else
   {
   
MoveObject(DAMGATE21,-556.044861999.0592060.826792.50.000000.00000, -126.48004);
   
MoveObject(DAMGATE22,-551.184632005.3698760.817662.50.000000.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: 2 Guest(s)