some problem from crashdetector
#1

Код:
[23:14:01] [debug]  Accessing element at index 458 past array upper bound 215
[23:14:01] [debug] AMX backtrace:
[23:14:01] [debug] #0 0033cbb0 in public Speedo () from swnrullz.amx
Код:
public Speedo()
{
	new kmcar[MAX_PLAYERS];
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerInAnyVehicle(i))
		{
		    kmcar[i] = GetPlayerVehicleID(i);
 			TextDrawShowForPlayer(i, boxkm[i]);
			TextDrawShowForPlayer(i, rez[i]);
			TextDrawShowForPlayer(i, motorizare[i]);
 			TextDrawShowForPlayer(i, combustibil[i]);
	 	 	TextDrawShowForPlayer(i, kmrulati[i]);
 			TextDrawShowForPlayer(i, viteza[i]);
		  	TextDrawShowForPlayer(i, metri[i]);
		 	TextDrawShowForPlayer(i, km[i]);
		 	TextDrawShowForPlayer(i, litri[i]);
 	 		TextDrawShowForPlayer(i, modelidcar[i]);
 	 		TextDrawShowForPlayer(i, kmh[i]);
	 	 	TextDrawShowForPlayer(i, rezistenta[i]);
 	 		TextDrawShowForPlayer(i, modelkilometraj[i]);
 			if(IsADieselCar(kmcar[i]))TextDrawShowForPlayer(i, motorina[i]);
			else TextDrawShowForPlayer(i, benzina[i]);
			
			new estr[16],speed = GetSpeed(i);
			format(estr,16,"%d km/h", speed);
			TextDrawSetString(kmh[i], estr);
			new estr1[16], Float: health;
			GetVehicleHealth(GetPlayerVehicleID(i), health);
			format(estr1,16,"%.2f", health);
			TextDrawSetString(rezistenta[i], estr1);

			new estr2[16];
			format(estr2,16,"%s", Vozila[GetVehicleModel(GetPlayerVehicleID(i)) - 400]);
			TextDrawSetString(modelidcar[i], estr2);

			new estr3[16];
			format(estr3,16,"%d L", Gas[GetPlayerVehicleID(i)]);
			TextDrawSetString(litri[i], estr3);
			CarInfo[GetPlayerVehicleID(i)][cMetre] += (speed*10)/780;
			if(CarInfo[GetPlayerVehicleID(i)][cMetre] > 999)
			{
				CarInfo[GetPlayerVehicleID(i)][cKilometre] += 1;
				CarInfo[GetPlayerVehicleID(i)][cMetre] = 0;
			}
			new estr4[16];
			format(estr4,16,"%d", CarInfo[GetPlayerVehicleID(i)][cMetre]/100);
			TextDrawSetString(metri[i], estr4);
			new estr5[16];
			if(CarInfo[GetPlayerVehicleID(i)][cKilometre] >= 0 && CarInfo[GetPlayerVehicleID(i)][cKilometre] < 10)
			{	format(estr5,16,"00000%d.", CarInfo[GetPlayerVehicleID(i)][cKilometre]); }
			if(CarInfo[GetPlayerVehicleID(i)][cKilometre] >= 10 && CarInfo[GetPlayerVehicleID(i)][cKilometre] < 100)
			{	format(estr5,16,"0000%d.", CarInfo[GetPlayerVehicleID(i)][cKilometre]);	}
			if(CarInfo[GetPlayerVehicleID(i)][cKilometre] >= 100 && CarInfo[GetPlayerVehicleID(i)][cKilometre] < 1000)
			{	format(estr5,16,"000%d.", CarInfo[GetPlayerVehicleID(i)][cKilometre]);	}
			if(CarInfo[GetPlayerVehicleID(i)][cKilometre] >= 1000 && CarInfo[GetPlayerVehicleID(i)][cKilometre] < 10000)
			{	format(estr5,16,"00%d.", CarInfo[GetPlayerVehicleID(i)][cKilometre]);	}
			if(CarInfo[GetPlayerVehicleID(i)][cKilometre] >= 10000 && CarInfo[GetPlayerVehicleID(i)][cKilometre] < 100000)
			{	format(estr5,16,"0%d.", CarInfo[GetPlayerVehicleID(i)][cKilometre]);		}
			if(CarInfo[GetPlayerVehicleID(i)][cKilometre] >= 100000)
			{	format(estr5,16,"0%d.", CarInfo[GetPlayerVehicleID(i)][cKilometre]); 	}
			TextDrawSetString(km[i], estr5);
		}
		else
		{
			TextDrawHideForPlayer(i, boxkm[i]);
			TextDrawHideForPlayer(i, rez[i]);
		 	TextDrawHideForPlayer(i, motorina[i]);
	 	 	TextDrawHideForPlayer(i, benzina[i]);
	 	 	TextDrawHideForPlayer(i, kerosen[i]);
			TextDrawHideForPlayer(i, motorizare[i]);
		 	TextDrawHideForPlayer(i, combustibil[i]);
	 	 	TextDrawHideForPlayer(i, kmrulati[i]);
	 	 	TextDrawHideForPlayer(i, viteza[i]);
	 	 	TextDrawHideForPlayer(i, metri[i]);
	 	 	TextDrawHideForPlayer(i, km[i]);
	 	 	TextDrawHideForPlayer(i, litri[i]);
	 	 	TextDrawHideForPlayer(i, modelidcar[i]);
	 	 	TextDrawHideForPlayer(i, kmh[i]);
	 	 	TextDrawHideForPlayer(i, rezistenta[i]);
	 	 	TextDrawHideForPlayer(i, modelkilometraj[i]);
		}
	}
}
Reply
#2

show how do you define all of these variables
Reply
#3

Quote:
Originally Posted by HuSs3n
Посмотреть сообщение
show how do you define all of these variables
Код:
new Text: boxkm[MAX_PLAYERS];
new Text: rez[MAX_PLAYERS];
new Text: motorina[MAX_PLAYERS];
new Text: kerosen[MAX_PLAYERS];
new Text: benzina[MAX_PLAYERS];
new Text: motorizare[MAX_PLAYERS];
new Text: combustibil[MAX_PLAYERS];
new Text: kmrulati[MAX_PLAYERS];
new Text: viteza[MAX_PLAYERS];
new Text: metri[MAX_PLAYERS];
new Text: km[MAX_PLAYERS];
new Text: litri[MAX_PLAYERS];
new Text: modelidcar[MAX_PLAYERS];
new Text: kmh[MAX_PLAYERS];
new Text: rezistenta[MAX_PLAYERS];
new Text: modelkilometraj[MAX_PLAYERS];
OnGameModeInit
Код:
	for(new z; z < MAX_PLAYERS; z++)
	{
		boxkm[z] = TextDrawCreate(642.000000, 360.000000, "_");
		TextDrawBackgroundColor(boxkm[z], 255);
		TextDrawFont(boxkm[z], 1);
		TextDrawLetterSize(boxkm[z], 0.800000, 9.600003);
		TextDrawColor(boxkm[z], -1);
		TextDrawSetOutline(boxkm[z], 0);
		TextDrawSetProportional(boxkm[z], 1);
		TextDrawSetShadow(boxkm[z], 1);
		TextDrawUseBox(boxkm[z], 1);
		TextDrawBoxColor(boxkm[z], 255);
		TextDrawTextSize(boxkm[z], 457.000000, 289.000000);

		rez[z] = TextDrawCreate(461.000000, 386.000000, "Rezistenta:");
		TextDrawBackgroundColor(rez[z], -16776961);
		TextDrawFont(rez[z], 1);
		TextDrawLetterSize(rez[z], 0.500000, 1.500000);
		TextDrawColor(rez[z], 255);
		TextDrawSetOutline(rez[z], 1);
		TextDrawSetProportional(rez[z], 1);

		motorina[z] = TextDrawCreate(561.000000, 400.000000, "Motorina");
		TextDrawBackgroundColor(motorina[z], 255);
		TextDrawFont(motorina[z], 1);
		TextDrawLetterSize(motorina[z], 0.500000, 1.500000);
		TextDrawColor(motorina[z], -1);
		TextDrawSetOutline(motorina[z], 1);
		TextDrawSetProportional(motorina[z], 1);

		kerosen[z] = TextDrawCreate(561.000000, 400.000000, "Kerosen");
		TextDrawBackgroundColor(kerosen[z], 255);
		TextDrawFont(kerosen[z], 1);
		TextDrawLetterSize(kerosen[z], 0.500000, 1.500000);
		TextDrawColor(kerosen[z], -1);
		TextDrawSetOutline(kerosen[z], 1);
		TextDrawSetProportional(kerosen[z], 1);

		benzina[z] = TextDrawCreate(562.000000, 400.000000, "Benzina");
		TextDrawBackgroundColor(benzina[z], 255);
		TextDrawFont(benzina[z], 1);
		TextDrawLetterSize(benzina[z], 0.500000, 1.500000);
		TextDrawColor(benzina[z], -1);
		TextDrawSetOutline(benzina[z], 1);
		TextDrawSetProportional(benzina[z], 1);

		motorizare[z] = TextDrawCreate(460.000000, 399.000000, "Motorizare:");
		TextDrawBackgroundColor(motorizare[z], -16776961);
		TextDrawFont(motorizare[z], 1);
		TextDrawLetterSize(motorizare[z], 0.500000, 1.500000);
		TextDrawColor(motorizare[z], 255);
		TextDrawSetOutline(motorizare[z], 1);
		TextDrawSetProportional(motorizare[z], 1);

		combustibil[z] = TextDrawCreate(461.000000, 412.000000, "Combustibil:");
		TextDrawBackgroundColor(combustibil[z], -16776961);
		TextDrawFont(combustibil[z], 1);
		TextDrawLetterSize(combustibil[z], 0.500000, 1.500000);
		TextDrawColor(combustibil[z], 255);
		TextDrawSetOutline(combustibil[z], 1);
		TextDrawSetProportional(combustibil[z], 1);

		kmrulati[z] = TextDrawCreate(462.000000, 427.000000, "Km rulati:");
		TextDrawBackgroundColor(kmrulati[z], -16776961);
		TextDrawFont(kmrulati[z], 1);
		TextDrawLetterSize(kmrulati[z], 0.500000, 1.500000);
		TextDrawColor(kmrulati[z], 255);
		TextDrawSetOutline(kmrulati[z], 1);
		TextDrawSetProportional(kmrulati[z], 1);

		viteza[z] = TextDrawCreate(461.000000, 373.000000, "Viteza:");
		TextDrawBackgroundColor(viteza[z], -16776961);
		TextDrawFont(viteza[z], 1);
		TextDrawLetterSize(viteza[z], 0.500000, 1.500000);
		TextDrawColor(viteza[z], 255);
		TextDrawSetOutline(viteza[z], 1);
		TextDrawSetProportional(viteza[z], 1);

		modelkilometraj[z] = TextDrawCreate(460.000000, 360.000000, "Model:");
		TextDrawBackgroundColor(modelkilometraj[z], -1);
		TextDrawFont(modelkilometraj[z], 1);
		TextDrawLetterSize(modelkilometraj[z], 0.500000, 1.500000);
		TextDrawColor(modelkilometraj[z], 255);
		TextDrawSetOutline(modelkilometraj[z], 1);
		TextDrawSetProportional(modelkilometraj[z], 1);

		kmh[z] = TextDrawCreate(523.000000, 373.000000, "_");
		TextDrawBackgroundColor(kmh[z], 255);
		TextDrawFont(kmh[z], 1);
		TextDrawLetterSize(kmh[z], 0.500000, 1.500000);
		TextDrawColor(kmh[z], -1);
		TextDrawSetOutline(kmh[z], 1);
		TextDrawSetProportional(kmh[z], 1);

		rezistenta[z] = TextDrawCreate(555.000000, 386.000000, "_");
		TextDrawBackgroundColor(rezistenta[z], 255);
		TextDrawFont(rezistenta[z], 1);
		TextDrawLetterSize(rezistenta[z], 0.500000, 1.500000);
		TextDrawColor(rezistenta[z], -1);
		TextDrawSetOutline(rezistenta[z], 1);
		TextDrawSetProportional(rezistenta[z], 1);

		modelidcar[z] = TextDrawCreate(519.000000, 360.000000, "_");
		TextDrawBackgroundColor(modelidcar[z], -1);
		TextDrawFont(modelidcar[z], 1);
		TextDrawLetterSize(modelidcar[z], 0.500000, 1.500000);
		TextDrawColor(modelidcar[z], 255);
		TextDrawSetOutline(modelidcar[z], 1);
		TextDrawSetProportional(modelidcar[z], 1);

		litri[z] = TextDrawCreate(564.000000, 412.000000, "_");
		TextDrawBackgroundColor(litri[z], 255);
		TextDrawFont(litri[z], 1);
		TextDrawLetterSize(litri[z], 0.500000, 1.500000);
		TextDrawColor(litri[z], -1);
		TextDrawSetOutline(litri[z], 1);
		TextDrawSetProportional(litri[z], 1);

		km[z] = TextDrawCreate(549.000000, 427.000000, "_");
		TextDrawBackgroundColor(km[z], 255);
		TextDrawFont(km[z], 1);
		TextDrawLetterSize(km[z], 0.500000, 1.500000);
		TextDrawColor(km[z], -1);
		TextDrawSetOutline(km[z], 1);
		TextDrawSetProportional(km[z], 1);

		metri[z] = TextDrawCreate(627.000000, 427.000000, "_");
		TextDrawBackgroundColor(metri[z], 255);
		TextDrawFont(metri[z], 1);
		TextDrawLetterSize(metri[z], 0.500000, 1.500000);
		TextDrawColor(metri[z], -1);
		TextDrawSetOutline(metri[z], 1);
		TextDrawSetProportional(metri[z], 1);
	}
Код:
stock GetPlayerSpeed(playerid)
{
        if(playerid != INVALID_PLAYER_ID)
        {
                new Float:Pos[3],Float:PS;
                GetPlayerVelocity(playerid, Pos[0], Pos[1], Pos[2]);
                PS = floatsqroot(Pos[0]*Pos[0] + Pos[1]*Pos[1] + Pos[2]*Pos[2])*200;
                return floatround(PS,floatround_round);
        }
        return INVALID_PLAYER_ID;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)