Help, i will give up.. -
Laredox - 03.03.2018
I have tried a thousand and one ways to fix this crash that detects me and nothing, could someone help me? I would appreciate it for life.
Код:
[15:06:03] [debug] Run time error 4: "Array index out of bounds"
[15:06:03] [debug] Attempted to read/write array element at index 65535 in array of size 100
[15:06:03] [debug] AMX backtrace:
[15:06:03] [debug] #0 00416ba8 in severTimers () at C:\Users\Toledops\Desktop\port_1968\gamemodes\NS4.pwn:69077
[15:06:03] [debug] #1 004166e0 in public severTimers@_yT () at C:\Users\Toledops\Desktop\port_1968\gamemodes\NS4.pwn:69058
Code;
Код:
timer severTimers[1000]()
{
if(iAdverTimer >= 1)
--iAdverTimer;
foreach(Player, i)
{
SyncPlayerTime(i);
if(IsPlayerConnected(i))
{
if(Tied[i] > 0) TogglePlayerControllable(i, 0);
if(GetPVarInt(i, "EMSAttempt") == -1) ApplyAnimation(i, "SWAT", "gnstwall_injurd", 4.0, 0, 1, 1, 1, 0, 1);
if(CellTime[i] > 0)
{
if (CellTime[i] == cchargetime)
{
CellTime[i] = 1;
if(Mobile[Mobile[i]] == i) { CallCost[i] = CallCost[i]+callcost; }
}
CellTime[i]++;
if(Mobile[Mobile[i]] == -1 && CellTime[i] == 5)
{
if(IsPlayerConnected(Mobile[i]))
{
new called[MAX_PLAYER_NAME], string[96];
GetPlayerName(Mobile[i], called, sizeof(called));
format(string, sizeof(string), "* Telephone %s ring", called);
ProxDetector(30.0, Mobile[i], string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
}
if(CellTime[i] == 0 && CallCost[i] > 0)
{
new string[24];
format(string, sizeof(string), "~w~Cost call %d",CallCost[i]);
GameTextForPlayer(i, string, 5000, 1);
GivePlayerCash(i, -CallCost[i]);
CallCost[i] = 0;
}
for(new h = 0; h < sizeof(Points); h++)
{
if(IsPlayerInRangeOfPoint(i, 2.0, Points[h][Pointx], Points[h][Pointy], Points[h][Pointz])){
if(Points[h][Type] == 3 && Info[i][pPot] < 3){
GameTextForPlayer(i, "hierba", 5000, 5);
}
else if(Points[h][Type] == 1 && GetPVarInt(i, "Packages") == 0){
GameTextForPlayer(i, "pieces.", 5000, 5);
}
else if(Points[h][Type] == 4){
GameTextForPlayer(i, "~w~drugs crack", 5000, 5);
}
else if(Points[h][Type] == 5){
GameTextForPlayer(i, "~w~drugs hierba", 5000, 5);
}
}
}
if(IsPlayerInAnyVehicle(i))
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER) SetPlayerArmedWeapon(i, 0);
else if(Info[i][pWeapons][4] == 0) SetPlayerArmedWeapon(i, 0);
else SetPlayerArmedWeapon(i, 29);
}
if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK && JetPack[i] == 0 && Info[i][pAdministrador] < 4)
{
new string[74 + MAX_PLAYER_NAME];
format( string, sizeof( string ), "{AA3333}Warning{FFFF00}: %s (ID %d) cheat jetpack .", GetPlayerNameEx(i), i);
ABroadCast( COLOR_YELLOW, string, 2 );
format(string, sizeof(string), "%s (ID %d) es posible que use Cheat de JetPack.", GetPlayerNameEx(i), i);
Log("logs/hack.log", string);
}
}
}
}
Re: Help, i will give up.. -
m4karow - 03.03.2018
maybe this is the wrong line
if(Mobile[Mobile[i]] == -1 && CellTime[i] == 5)
your Mobile[i] might be INVALID_PLAYER_ID.
correct use example
new targetid = Mobile[i];
if(targetid != INVALID_PLAYER_ID)
{
....
}
Re: Help, i will give up.. -
Laredox - 03.03.2018
That solution also fix this problem? .. I just put what you put and did not give me errors or warnings, I'll try to see and tell you.
Код:
[15:06:03] [debug] #1 004166e0 in public severTimers@_yT () at C:\Users\Toledops\Desktop\port_1968\gamemodes\NS4.pwn:69058
Re: Help, i will give up.. -
Sew_Sumi - 03.03.2018
What m4karow said above, but more check where Mobile[Mobile[i]] could be going awry.
By theory, when they disconnect, it should be set to -1, not INVALID_PLAYER_ID.
PHP код:
if (CellTime[i] == cchargetime)
{
CellTime[i] = 1;
if(Mobile[Mobile[i]] == i) { CallCost[i] = CallCost[i]+callcost; }
}
CellTime[i]++;
if(Mobile[Mobile[i]] == -1 && CellTime[i] == 5)
Re: Help, i will give up.. -
andim - 03.03.2018
You can give me your YSI?
Please.
Re: Help, i will give up.. -
Laredox - 03.03.2018
I've done it in all the ways and that debug still comes out ... and that's where it keeps the remaining sanction time, that thing and some things, I do not know if it's important ..
Re: Help, i will give up.. -
m4karow - 03.03.2018
show the whole timer code and mark the 69058 line
Re: Help, i will give up.. -
Laredox - 03.03.2018
Код:
//line error 2timer severTimers[1000]()
{
if(iAdverTimer >= 1)
--iAdverTimer;
foreach(Player, i)
{
SyncPlayerTime(i);
if(IsPlayerConnected(i) && gPlayerLogged{i} == 1)
{
if(Tied[i] > 0) TogglePlayerControllable(i, 0);
if(GetPVarInt(i, "EMSAttempt") == -1) ApplyAnimation(i, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0, 1);
if(CellTime[i] > 0)
{
if (CellTime[i] == cchargetime)
{
CellTime[i] = 1;
if(Mobile[Mobile[i]] == i)
{
CallCost[i] = CallCost[i]+callcost;
}
}
CellTime[i]++;
// line error 1 if (Mobile[Mobile[i]] == INVALID_PLAYER_ID && CellTime[i] == 5)
{
if(IsPlayerConnected(Mobile[i]))
{
new called[MAX_PLAYER_NAME], string[96];
GetPlayerName(Mobile[i], called, sizeof(called));
format(string, sizeof(string), "* El telйfono de %s esta sonando", called);
ProxDetector(30.0, Mobile[i], string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
}
if(CellTime[i] == 0 && CallCost[i] > 0)
{
new string[24];
format(string, sizeof(string), "~w~Costo de llamada~n~~r~%d",CallCost[i]);
GivePlayerCash(i, -CallCost[i]);
GameTextForPlayer(i, string, 5000, 1);
CallCost[i] = 0;
}
for(new h = 0; h < sizeof(Points); h++)
{
if(IsPlayerInRangeOfPoint(i, 2.0, Points[h][Pointx], Points[h][Pointy], Points[h][Pointz])){
if(Points[h][Type] == 3 && Info[i][pPot] < 3){
GameTextForPlayer(i, "~w~Usa /comprarhierba para comprar algo de ~n~~r~hierba", 5000, 5);
}
else if(Points[h][Type] == 1 && GetPVarInt(i, "Packages") == 0){
GameTextForPlayer(i, "~w~Usa /materiales para comprar ~n~~r~paquetes de materiales.", 5000, 5);
}
else if(Points[h][Type] == 4){
GameTextForPlayer(i, "~w~Usa /comprarcrack para comprar ~n~algo de ~r~crack", 5000, 5);
}
else if(Points[h][Type] == 5){
GameTextForPlayer(i, "~w~Usa /paquete para comprar un ~n~~r~paquete de droga", 5000, 5);
}
}
}
if(TransportDriver[i] < 999)
{
if(GetPlayerVehicleID(i) != GetPlayerVehicleID(TransportDriver[i]) || !TransportDuty[TransportDriver[i]])
{
if(IsPlayerConnected(TransportDriver[i]))
{
new string[24];
TransportMoney[TransportDriver[i]] += TransportCost[i];
TransportTime[TransportDriver[i]] = 0;
TransportCost[TransportDriver[i]] = 0;
format(string, sizeof(string), "~w~Pasajero se fue~n~~g~ganaste %d",TransportCost[i]);
GameTextForPlayer(TransportDriver[i], string, 5000, 1);
TransportDriver[i] = 999;
}
}
else if(TransportTime[i] >= 16)
{
TransportTime[i] = 1;
GivePlayerCash(i, -TransportValue[TransportDriver[i]]);
if(TransportDriver[i] < 999)
{
if(IsPlayerConnected(TransportDriver[i]))
{
TransportCost[i] += TransportValue[TransportDriver[i]];
TransportCost[TransportDriver[i]] = TransportCost[i];
}
}
}
TransportTime[i] += 1;
new string[24];
format(string, sizeof(string), "~r~%d ~w~: ~g~%d",TransportTime[i],TransportCost[i]);
GameTextForPlayer(i, string, 15000, 6);
GameTextForPlayer(TransportDriver[i], string, 15000, 6);
if(TransportCost[i] > GetPlayerCash(i))
{
RemovePlayerFromVehicle(i);
new Float:slx, Float:sly, Float:slz;
GetPlayerPos(i, slx, sly, slz);
SetPlayerPos(i, slx, sly, slz + 2);
GameTextForPlayer(i, "~r~No tienes mбs dinero para pagar el taxi!", 4000, 4);
}
}
if(IsPlayerInAnyVehicle(i))
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER) SetPlayerArmedWeapon(i, 0);
else if(Info[i][pWeapons][4] == 0) SetPlayerArmedWeapon(i, 0);
else SetPlayerArmedWeapon(i, 29);
}
if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK && JetPack[i] == 0 && Info[i][pAdministrador] < 4)
{
new string[74 + MAX_PLAYER_NAME];
format( string, sizeof( string ), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) es posible que use Cheat de JetPack .", GetPlayerNameEx(i), i);
ABroadCast( COLOR_YELLOW, string, 2 );
format(string, sizeof(string), "%s (ID %d) es posible que use Cheat de JetPack.", GetPlayerNameEx(i), i);
Log("LOGS/hack.log", string);
format(string, sizeof(string), "AdmCmd: %s ha sido auto-expulsado, razуn: jetpack hack.", GetPlayerNameEx(i), i);
ABroadCast(COLOR_YELLOW, string, 0 );
Kick(i);
}
if(IsPlayerInRangeOfPoint(i, 2.5, 1544.2, -1353.4, 329.4))
{
GivePlayerValidWeapon(i, 46); // Paracaidas en el edificio mбs alto de LS.
}
/*if(Info[i][pJailed] == 1 && !IsPlayerInRangeOfPoint(i, 120, -3578.6624,-2300.2500,0.1042) && Info[i][pAdministrador] < 1)
{
new stringX[128]; // Da kick si no estб en su lugar de jail.
format(stringX, sizeof(stringX), "[AntiHack]: %s (ID %d) ha sido auto-expulsado del servidor, razуn: salir fuera de jail.", GetPlayerNameEx(i), i);
ABroadCast(COLOR_YELLOW, stringX, 0 );
Kick(i);
}*/
}
}
}
[13:32:36] [debug] AMX backtrace:
[13:32:36] [debug] #0 004180e4 in severTimers () at C:\Users\Toledops\Desktop\Nueva carpeta\gamemodes\NS4.pwn:69274
[13:32:36] [debug] #1 00417bc0 in public severTimers@_yT () at C:\Users\Toledops\Desktop\Nueva carpeta\gamemodes\NS4.pwn:69252
[13:32:37] [debug] Run time error 4: "Array index out of bounds"
[13:32:37] [debug] Attempted to read/write array element at index 65535 in array of size 100
Re: Help, i will give up.. -
Sew_Sumi - 03.03.2018
Why did you change that, there's a purpose that it serves by being set to -1.
What have you been doing around the time this started happening, as it's likely that your edits have broken the system, and changing the system to cope with that breakage, will likely break it more.
SOMEWHERE in your script you are setting Mobile[playerid] to INVALID_PLAYER_ID, and because you have
you are picking up i's Mobile INVALID_PLAYER_ID, and that makes it try to get Mobile[65535] which doesn't exist as Mobile is only 100.
Mobile[playerid] should be set to -1 when it's not on a call/fresh connected/disconnected. That's why in that check, it was checking for -1.
Re: Help, i will give up.. -
Laredox - 03.03.2018
In the whole system call is made in INVALID_PLAYER_ID ... definitions, saved .. everything .. should I change that you tell me?
That only happens when the server exceeds 30 users, and at 50 60 it starts to fail to take the login and others.