Jump to content
  • 0

Nu functioneaza comanda /v


Gabriel03

Question

Nu merge comanda /v, nu apare dialogul.

Server Log:

[03:59:13] [debug] Run time error 4: "Array index out of bounds"
[03:59:13] [debug]  Accessing element at negative index -400

Functia care ar trebuii sa arate dialogul

stock ShowPlayerVehicle(playerid) {
	new szTitle[180], szDialog[2048], szDialog2[2048], vstatus[1024];
	if(GetVehicles(playerid) == 0) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Nu ai un vehicul personal!");	
	format(szTitle, sizeof(szTitle), "Vehicles (%d/%d)", GetVehicles(playerid), TotalSlots(playerid));			
	for(new i = 0; i < 10; i++) {
		if(i < 5) {
			if(i < 3) {
				if(PlayerInfo[playerid][pCarKey][i] != 0) {
					new car =  PlayerInfo[playerid][pCarKey][i];
					if(IsVehicleOccupied(CarInfo[car][Spawned])) format(vstatus, sizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
					else if(CarInfo[car][Spawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
					else format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
					format(szDialog, sizeof(szDialog), "%s\n", vstatus);
					strcat(szDialog2, szDialog);
				}
				else strcat(szDialog2, "{FFD857}<slot liber>\n"), sVehicle[i][playerid] = 0;
			}
			else {
				if(PlayerInfo[playerid][pCarKey][i] != 0) {
					new car =  PlayerInfo[playerid][pCarKey][i];
					if(IsVehicleOccupied(CarInfo[car][Spawned])) format(vstatus, sizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
					else if(CarInfo[car][Spawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
					else format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
					format(szDialog, sizeof(szDialog), "%s\n", vstatus);
					strcat(szDialog2, szDialog);
				}
				else if(PlayerInfo[playerid][pPremiumAccount] == 1) strcat(szDialog2, "{FFD857}<slot liber>\n"), sVehicle[i][playerid] = 0;			
			}
		}
		else {
			if(PlayerInfo[playerid][pCarKey][i] != 0) {
				new car =  PlayerInfo[playerid][pCarKey][i];
				if(IsVehicleOccupied(CarInfo[car][Spawned])) format(vstatus, sizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
				else if(CarInfo[car][Spawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
				else format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
				format(szDialog, sizeof(szDialog), "%s\n", vstatus);
				strcat(szDialog2, szDialog);
			}
			else if(PlayerInfo[playerid][pSlot][i-5] == 1) strcat(szDialog2, "{FFD857}<slot liber>\n"), sVehicle[i][playerid] = 0;		
		}
	}
	ShowPlayerDialog(playerid, DIALOG_GARAGE, DIALOG_STYLE_LIST, szTitle, szDialog2, "Ok", "Exit");
	return 1;
}
function LoadCar(id) {
	if(CarInfo[id][cModel] != 0) return 1;
	new query[256];
	mysql_format(SQL, query, 128, "SELECT * FROM `cars` WHERE `ID`='%d'", id);	
	new Cache: db = mysql_query(SQL, query);
	if(cache_get_row_count() > 0) {
		new i = 0;
		CarInfo[id][cID] = id;
		CarInfo[id][cModel] = cache_get_field_content_int(i, "Model");
		CarInfo[id][cLocationx] = cache_get_field_content_float(i, "Locationx");
		CarInfo[id][cLocationy] = cache_get_field_content_float(i, "Locationy");
		CarInfo[id][cLocationz] = cache_get_field_content_float(i, "Locationz");
		CarInfo[id][cAngle] = cache_get_field_content_float(i, "Angle");
		CarInfo[id][cColorOne] = cache_get_field_content_int(i, "ColorOne");
		CarInfo[id][cColorTwo]  = cache_get_field_content_int(i, "ColorTwo");
		cache_get_field_content(i, "Owner", CarInfo[id][cOwner], SQL, 129);
		cache_get_field_content(i, "Text", CarInfo[id][cText], SQL, 129);
		CarInfo[id][cTextColor] = cache_get_field_content_int(i, "ColorText");
		CarInfo[id][cValue] = cache_get_field_content_int(i, "Value");
		CarInfo[id][cDays] = cache_get_field_content_int(i, "days");
		cache_get_field_content(i, "License", CarInfo[id][cLicense], SQL, 129);
		CarInfo[id][cAlarm] = cache_get_field_content_int(i, "Alarm");
		CarInfo[id][cLock] = cache_get_field_content_int(i, "Lockk");
		CarInfo[id][mod0] = cache_get_field_content_int(i, "mod0");
		CarInfo[id][mod1] = cache_get_field_content_int(i, "mod1");
		CarInfo[id][mod2] = cache_get_field_content_int(i, "mod2");
		CarInfo[id][mod3] = cache_get_field_content_int(i, "mod3");
		CarInfo[id][mod4] = cache_get_field_content_int(i, "mod4");
		CarInfo[id][mod5] = cache_get_field_content_int(i, "mod5");
		CarInfo[id][mod6] = cache_get_field_content_int(i, "mod6");
		CarInfo[id][mod7] = cache_get_field_content_int(i, "mod7");
		CarInfo[id][mod8] = cache_get_field_content_int(i, "mod8");
		CarInfo[id][mod9] = cache_get_field_content_int(i, "mod9");
		CarInfo[id][mod10] = cache_get_field_content_int(i, "mod10");
		CarInfo[id][mod11] = cache_get_field_content_int(i, "mod11");
		CarInfo[id][mod12] = cache_get_field_content_int(i, "mod12");
		CarInfo[id][mod13] = cache_get_field_content_int(i, "mod13");
		CarInfo[id][paintjob] = cache_get_field_content_int(i, "paintjob");
		CarInfo[id][KM] = cache_get_field_content_float(i, "KM");
		CarInfo[id][Userid] = cache_get_field_content_int(i, "Userid");
		CarInfo[id][Confiscated] = cache_get_field_content_int(i, "Confiscated");
		CarInfo[id][Spawned] = 0;
		CarInfo[id][cSpecial] = cache_get_field_content_int(i, "Special");
		CarInfo[id][cTax] = cache_get_field_content_int(i, "Tax");
		CarInfo[id][cPoints] = cache_get_field_content_int(i, "Points");
		CarInfo[id][cFuel] = cache_get_field_content_int(i, "Fuel");
		CarInfo[id][cNeon] = cache_get_field_content_int(i, "Neon");
		cache_delete(db);
	}
	return 1;
}

Mersi anticipat!

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
13 hours ago, Banditul said:

Problema e la partea cu aVehiclesNames. Cand incerci iei numele modelului .

Problema e ca CarInfo[car][cModel] e 0 si scazand 400 din 0 rezulta -400.

Probabil ori nu se incarca corect din baza de date ori chiar este 0 in baza de date

Am rezolvat, mersi ca mi-ai adus aminte de baza de date... Am sters tot din tabelul cu masini personale dar am uitat sa sterg si din tabelul cu jucatori Car Key-urile... 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.