SA-MP Forums Archive
[HELP] Run time error 4 "Array Index out bounds" - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] Run time error 4 "Array Index out bounds" (/showthread.php?tid=533354)



[HELP] Run time error 4 "Array Index out bounds" - Shura - 24.08.2014

Hello, my console on my server will still states, need to know who is and if I can help

Код:
Run time error 4 "Array Index out bounds"
Accessing negative element at index -1
Backtrace (most recent call first)
# SeverTimers()+0x47c at C:/User/gamemode.pwn:53513
# 1 public SeverTimers @ y_T () + 0x14 at C: /User/gamemode.pwn: 53494

I need help urgently, please, give reputation to change.

From already thank you very much for reading.



Re: [HELP] Run time error 4 "Array Index out bounds" - ThePhenix - 24.08.2014

Show the place where you call SeverTimers() function and also show us that function.


Respuesta: [HELP] Run time error 4 "Array Index out bounds" - Shura - 24.08.2014

Here I leave the severtimers, need something to help me?

Код:
timer severTimers[1000]()
{
	if(iAdverTimer >= 1)
		--iAdverTimer;
	foreach(Player, i)
	{
	    SyncPlayerTime(i);
	    if(IsPlayerConnectedEx(i))
	    {
			if(Tied[i] > 0) TogglePlayerControllable(i, 0);
	        if(GetPVarInt(i, "EMSAttempt") == -1) ApplyAnimation(i, "CRACK", "crckidle1",4.0,0,1,1,1,-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(IsPlayerConnectedEx(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 %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, "~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(TaxiDriver[i] != -1)
			{
				if(GetPlayerVehicleID(i) == GetPlayerVehicleID(TaxiDriver[i]) )
				{
				    if(TaxiTiempo[i] >= 31)
				    {
				        TaxiTiempo[i] = 1;
				        TaxiCosto[i] += TaxiTarifa[TaxiDriver[i]];
				    }
					TaxiTiempo[i] += 1;
					new string[80];
					format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~n~~y~%d Seg ~w~- $%d", TaxiTiempo[i], TaxiCosto[i]);
					GameTextForPlayer(i, string, 1200, 3);
					GameTextForPlayer(TaxiDriver[i], string, 1200, 3);
					if(TaxiCosto[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][pAdmin] < 4)
			{
				new string[74 + MAX_PLAYER_NAME];
			    format( string, sizeof( string ), "[ADMINISTRACIУN] >"#COL_WHITE" %s (ID %d) es posible que use "#COL_VIOLET"Cheat de JetPack.", GetPlayerNameEx(i), i);
				ABroadCast(VIOLETA_ADMIN, string, 2 );
				format(string, sizeof(string), "%s (ID %d) es posible que use Cheat de JetPack.", GetPlayerNameEx(i), i);
				Log("logs/hack.log", string);
			}
			if(IsPlayerInRangeOfPoint(i, 2, 1544.2, -1353.4, 329.4)) { GivePlayerValidWeapon(i, 46); }
		}
	}
}