Auto Restarting Server
#1

Hello guys i have a TDM server the problem is its getting auto restart on some times when i use crash detect then its showing this error

Код:
[13:14:48] [debug] AMX backtrace:
[13:14:48] [debug] #0 0010d9ac in public OnPlayerEnterVehicle (0, 11, 0) from MVT.amx
[13:14:48] [debug] Run time error 4: "Array index out of bounds"
[13:14:48] [debug]  Accessing element at index 2273 past array upper bound 2272
code is

PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
  new 
playername[64], count=0;
  
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
  new 
modelid GetVehicleModel(vehicleid);
  if(
vehicleid == terrortank)
  {
    if(
terrortanktimer != 0)
    {
      
ClearAnimations(playerid);
      
SendClientMessage(playeridCOLOR_SILVER"Error: You must wait sometime to use this vehicle again.");
      return 
1;
    }
  }
  if(
vehicleid == armytank)
  {
    if(
armytanktimer != 0)
    {
     
ClearAnimations(playerid);
     
SendClientMessage(playeridCOLOR_SILVER"Error: You must wait sometime to use this vehicle again.");
     return 
1;
    }
  }
  if(
vehicleid == terrortank || vehicleid == armytank)
  {
        if(
GetPlayerScore(playerid) < 3000)
        {
          
SendClientMessage(playerid,COLOR_RED,"You can't use this vehicle till 3000 score!");
        
ClearAnimations(playerid);
        return 
1;
        }
        for(new 
0PLAYERSi++)
        {
                if(
IsPlayerConnected(i))
                {
                    
count++;
                }
        }
         if(
count 8)
        {
            
SendClientMessage(playerid,COLOR_WHITE,"{005E80}GF: {FFFFFF}There is no need to use the Tank now! (There must be atleast 8 people online)");
              
ClearAnimations(playerid);
              return 
1;
        }
  }
  if(
modelid == 425)
  {
        if(
dini_Int(AddDirFile(dir_userfilesplayername), "Airforce") == 0)
        {
              
SendClientMessage(playerid,COLOR_RED,"You can't use this Hunter!");
              
ClearAnimations(playerid);
              return 
1;
        }
        for(new 
0PLAYERSi++)
        {
                if(
IsPlayerConnected(i))
                {
                    
count++;
                }
        }
        if(
count 8)
        {
            
SendClientMessage(playerid,COLOR_WHITE,"{005E80}GF: {FFFFFF}There is no need to use the Hunter now! (There must be atleast 8 people online)");
              
ClearAnimations(playerid);
              return 
1;
        }
  }
  if(
ispassenger == || ispassenger == 1)
  {
      for(new 
1000 i++)
      {
        if(
vehicleid == hitman[i])
           {
           if(
gTeam[playerid] != Hitman)
           {
              
ClearAnimations(playerid);
              
RemovePlayerFromVehicle(playerid);
              
SendClientMessage(playeridCOLOR_RED"You are not member of Hitman and you are not allowed use Hitman vehicles!");
              return 
1;
           }
        }
        if(
vehicleid == alpha[i])
        {
            if(
gTeam[playerid] != AlphaSquad)
               {
                  
ClearAnimations(playerid);
                   
RemovePlayerFromVehicle(playerid);
                   
SendClientMessage(playeridCOLOR_RED"You are not member of Alpha Squad and you are not allowed use Alpha Squad vehicles!");
                   return 
1;
            }
        }
        if(
vehicleid == saf[i])
        {
                  if(
dini_Int(AddDirFile(dir_userfilesplayername), "Airforce") == 0)
                  {
                                    
ClearAnimations(playerid);
                                    
RemovePlayerFromVehicle(playerid);
                                    
SendClientMessage(playeridCOLOR_RED"You are not member of San Andreas Airforce and you are not allowed use San Andreas Airforce vehicles!");
                                    return 
1;
                }
         }
       }
  }
  if (
ispassenger == 0)
  {
        if (
vehiclelocked[playerid][vehicleid])
        {
            
ClearAnimations(playerid);
            return 
1;
        }
  }
  return 
1;

Reply
#2

Hard to find, can u compile gamemode with -d3?
Or maybe u know what can be indexed as 2272/2273?
Reply
#3

-d3 means like this?

Код:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:          16736 bytes
Code size:          1449936 bytes
Data size:         24432028 bytes
Stack/heap size:      16384 bytes; estimated max. usage=17397 cells (69588 bytes)
Total requirements:25915084 bytes
Reply
#4

-d3 is gonna show which line is broken in crash detect logs.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)