CrashDetect Error
#1

Hello , crashdetect plugin detect this error on my gamemode :
Код HTML:
[09:17:43] [debug] Run time error 4: "Array index out of bounds"
[09:17:43] [debug]  Accessing element at index 255 past array upper bound 99
[09:17:43] [debug] AMX backtrace:
[09:17:43] [debug] #0 00067320 in public OtherTimer () from RG.amx
[09:17:44] [debug] Run time error 4: "Array index out of bounds"
[09:17:44] [debug]  Accessing element at index 255 past array upper bound 99
[09:17:44] [debug] AMX backtrace:
[09:17:44] [debug] #0 00067320 in public OtherTimer () from RG.amx
[09:17:45] [debug] Run time error 4: "Array index out of bounds"
[09:17:45] [debug]  Accessing element at index 255 past array upper bound 99
[09:17:45] [debug] AMX backtrace:
[09:17:45] [debug] #0 00067320 in public OtherTimer () from RG.amx
[09:17:46] [debug] Run time error 4: "Array index out of bounds"
[09:17:46] [debug]  Accessing element at index 255 past array upper bound 99
[09:17:46] [debug] AMX backtrace:
[09:17:46] [debug] #0 00067320 in public OtherTimer () from RG.amx
[09:17:47] [debug] Run time error 4: "Array index out of bounds"
[09:17:47] [debug]  Accessing element at index 255 past array upper bound 99
[09:17:47] [debug] AMX backtrace:
[09:17:47] [debug] #0 00067320 in public OtherTimer () from RG.amx
[09:17:48] [debug] Run time error 4: "Array index out of bounds"
[09:17:48] [debug]  Accessing element at index 255 past array upper bound 99
[09:17:48] [debug] AMX backtrace:
[09:17:48] [debug] #0 00067320 in public OtherTimer () from RG.amx
[09:17:49] [debug] Run time error 4: "Array index out of bounds"
[09:17:49] [debug]  Accessing element at index 255 past array upper bound 99
[09:17:49] [debug] AMX backtrace:
[09:17:49] [debug] #0 00067320 in public OtherTimer () from RG.amx
[09:17:50] [debug] Run time error 4: "Array index out of bounds"
[09:17:50] [debug]  Accessing element at index 255 past array upper bound 99
[09:17:50] [debug] AMX backtrace:
[09:17:50] [debug] #0 00067320 in public OtherTimer () from RG.amx
This apper again and again and again in my server_log.txt (8.000.000 in just 12 h) .

This is function :
Код HTML:
function OtherTimer()
{
	new string[256];
	new Float:oldposx, Float:oldposy, Float:oldposz;
    for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
	    {
	        new vehicleid = GetPlayerVehicleID(i);
            if(SafeTime[i] > 0)
			{
				SafeTime[i]--;
			}
			if(SafeTime[i] == 1)
			{
				if(gPlayerAccount[i] == 1 && gPlayerLogged[i] == 0)
				{
    				new loginname[256];
					new loginstring[256];
					GetPlayerName(i,loginname,sizeof(loginname));
					format(loginstring,sizeof(loginstring),"{a9c4e4}Bun venit inapoi pe Reality-Gaming RPG \n{a9c4e4}Cont:{008000} %s \n{a9c4e4}Acest cont este inregistrat",loginname);
					ShowPlayerDialog(i,12346,DIALOG_STYLE_PASSWORD,"Login",loginstring,"Login","Exit");
				}
			}
		    if(GetPlayerState(i) == 2)
		    {
				GetPlayerPos(i, TelePos[i][3], TelePos[i][4], TelePos[i][5]);
				if(TelePos[i][5] > 550.0)
				{
					TelePos[i][0] = 0.0;
					TelePos[i][1] = 0.0;
				}
				if(TelePos[i][0] != 0.0)
				{
					new distance = GetPlayerSpeed(i, true);
					if ((BusrouteEast[i][0] == 0 && BusrouteWest[i][0] == 0))
					{
						if(gSpeedo[i] == 2)
						{
							if(distance <10)
							{
								format(string, sizeof(string), "~n~~g~mph :   ~w~%.0f",distance);
							}
							if(distance > 10 && distance < 100)
							{
								format(string, sizeof(string), "~n~~g~mph :  ~w~%.0f",distance);
							}
							if(distance > 100)
							{
								format(string, sizeof(string), "~n~~g~mph : ~w~%.0f",distance);
							}
							GameTextForPlayer(i, string, 2000, 5);
						}
					}
				}
				if(TelePos[i][5] < 550.0 && TelePos[i][3] != 0.0)
				{
					TelePos[i][0] = TelePos[i][3];
					TelePos[i][1] = TelePos[i][4];
				}
			}
		    if(PlayerInfo[i][pLocal] != 255 && PlayerInfo[i][pInt] != 0)
			{
				new house = PlayerInfo[i][pLocal];
				GetPlayerPos(i, oldposx, oldposy, oldposz);
				if(oldposz != 0.0)
				{
					if(oldposz < 600.0)
					{
						if(house == 242)
						{
						    SetPlayerInterior(i,0);
							SetPlayerPos(i,-2518.5967,-623.2701,132.7679);
							PlayerInfo[i][pInt] = 0;
							SetPlayerVirtualWorld(i,0);
							PlayerInfo[i][pVirWorld] = 0;
							PlayerInfo[i][pLocal] = 255;
						}
						else if(house < 175 && house != 10000)
						{
							SetPlayerPos(i, HouseInfo[house][hEntrancex], HouseInfo[house][hEntrancey],HouseInfo[house][hEntrancez]);
							PlayerInfo[i][pLocal] = 255;
							SetPlayerInterior(i,0);
							SetPlayerVirtualWorld(i,0);
							PlayerInfo[i][pVirWorld] = 0;
							PlayerInfo[i][pInt] = 0;
						}
					}
				}
			}
		    if(CellTime[i] > 0)
			{
				if (CellTime[i] == cchargetime)
				{
					CellTime[i] = 1;
					if(Mobile[Mobile[i]] == i)
					{
						CallCost[i] = CallCost[i]+callcost;
					}
				}
				CellTime[i] = CellTime[i] +1;
				if (Mobile[Mobile[i]] == 255 && CellTime[i] == 5)
				{
				    if(IsPlayerConnected(Mobile[i]))
				    {
						new called[MAX_PLAYER_NAME];
						GetPlayerName(Mobile[i], called, sizeof(called));
						format(string, sizeof(string), "* %s's phone rings.", called);
						ProxDetector(30.0, Mobile[i], string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
						RingTone[Mobile[i]] = 10;
					}
				}
			}
			if(CellTime[i] == 0 && CallCost[i] > 0)
			{
				format(string, sizeof(string), "~w~The call cost~n~~r~%d EuroCent",CallCost[i]);
				GameTextForPlayer(i, string, 5000, 1);
				new eurocenti = PlayerInfo[i][pEuroCent];
		        PlayerInfo[i][pEuroCent] = eurocenti - CallCost[i];
				SBizzInfo[2][sbTill] += CallCost[i];
				ExtortionSBiz(2, CallCost[i]);
				CallCost[i] = 0;
			}
			if(TransportTime[i] > 0)
			{
			    if(TransportTime[i] >= 16)
				{
					TransportTime[i] = 1;
					if(TransportDriver[i] < 999)
					{
						if(IsPlayerConnected(TransportDriver[i]))
						{
	      					TransportCost[i] += TransportValue[TransportDriver[i]];
						    TransportCost[TransportDriver[i]] = TransportCost[i];
						}
					}
				}
			    TransportTime[i] += 1;
			    format(string, sizeof(string), "~r~%d ~w~: ~g~%s",TransportTime[i],DecimalPoint(TransportCost[i]));
			    GameTextForPlayer(i, string, 1500, 6);
       			if(GetPlayerMoney(i) < TransportCost[i])
          		{
            		format(string, sizeof(string), "* Ai nevoie de %s pentru a merge mai departe.", DecimalPoint(TransportCost[i]));
					SendClientMessage(i, COLOR_WHITE, string);
					RemovePlayerFromVehicle(i);
     			}
			}
			if (BusrouteEast[i][0] != 0 || BusrouteWest[i][0] != 0)
			{
				if (!IsPlayerInAnyVehicle(i) || !IsABus(GetPlayerVehicleID(i)))
				if (vehicleid != 0)
				{
					if (!IsABus(vehicleid))
					{
						if (BusrouteEast[i][0] != 0) BusrouteEnd(i, BusrouteEast[i][1]);
						else if (BusrouteWest[i][0] != 0) BusrouteEnd(i, BusrouteWest[i][1]);
					}
				}
				else
				{
					if (BusrouteEast[i][0] != 0) BusrouteEnd(i, BusrouteEast[i][1]);
					else if (BusrouteWest[i][0] != 0) BusrouteEnd(i, BusrouteWest[i][1]);
				}
			}
			if (IsABus(vehicleid) && GetPlayerState(i) == 2 && PlayerInfo[i][pJob] != 14)
			{
				SetVehicleToRespawn(vehicleid);
			}
			if(IsAnOwnableCar(vehicleid) && GetPlayerState(i) == PLAYER_STATE_DRIVER)
			{
				new Float:x, Float:y, Float:z;
				GetVehiclePos(vehicleid, x, y, z);
				new distance = GetDistances2(x, y, z, vPos[0][vehicleid], vPos[1][vehicleid], vPos[2][vehicleid]);
				vPos[0][vehicleid] = x;
				vPos[1][vehicleid] = y;
				vPos[2][vehicleid] = z;
				VehicleDistance[vehicleid] += distance;
				if (VehicleDistance[vehicleid] > 370)
				{
					CarInfo[vehicleid][odometer]++;
					VehicleDistance[vehicleid] = 0;
				}
			}
		}
	}
	return 1;
}
new Float:vPos[3][MAX_VEHICLES]; // ---------------------------
new VehicleDistance[MAX_VEHICLES]; //

Any ideea please ?


SOLVED
Reply
#2

1 - Change loginname[256] to loginname[32]
2 - Have this little stock around :
Код:
stock GetName(playerid)
{
	new name[32];
	GetPlayerName(playerid,name,sizeof(name));
	return name;
}
//Exemple code :
//format(str, sizeof(str),"Welcome sir : %s",GetName(playerid));
// No need to have the new name, Getplayername ..
if it doesn't work, tell me the error and I can help more I guess
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)