02.10.2016, 12:26
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
code is
Код:
[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
PHP код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new playername[64], count=0;
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
new modelid = GetVehicleModel(vehicleid);
if(vehicleid == terrortank)
{
if(terrortanktimer != 0)
{
ClearAnimations(playerid);
SendClientMessage(playerid, COLOR_SILVER, "Error: You must wait sometime to use this vehicle again.");
return 1;
}
}
if(vehicleid == armytank)
{
if(armytanktimer != 0)
{
ClearAnimations(playerid);
SendClientMessage(playerid, COLOR_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 i = 0; i < PLAYERS; i++)
{
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_userfiles, playername), "Airforce") == 0)
{
SendClientMessage(playerid,COLOR_RED,"You can't use this Hunter!");
ClearAnimations(playerid);
return 1;
}
for(new i = 0; i < PLAYERS; i++)
{
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 == 0 || ispassenger == 1)
{
for(new i = 0 ; i < 1000 ; i++)
{
if(vehicleid == hitman[i])
{
if(gTeam[playerid] != Hitman)
{
ClearAnimations(playerid);
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_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(playerid, COLOR_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_userfiles, playername), "Airforce") == 0)
{
ClearAnimations(playerid);
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_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;
}