Attempted to read/write array element at negative index -400 while loading cars in car shop
#1

Hey today i scripted a car shop system but it shows me this in the console
Код:
Attempted to read/write array element at negative index -400
and this in the code


Код:
  		    new caridd = dtc_AutohausCar[playerid] -1;
  		    if(caridd < 0)
  		    {
  		        caridd = AhCars;
  		    }
  		    new car,preis,counter;
  		    for(new ah = 0; ah < sizeof(dtcKaufliste);ah++)
	        {
	            if(dtcKaufliste[ah][dtc_Autohaus] == autohaus)
				{
		        	if( counter == caridd)
		        	{
		        	    car = dtcKaufliste[ah][dtc_CarModel];
						preis = dtcKaufliste[ah][dtc_CarPreis];
		        	}
	        		counter ++;
				}
	        }
			new c1 = random(120);
        	new c2 = random(120);
			DestroyVehicle(dtc_AutohausSCar[playerid]);
			dtc_AutohausSCar[playerid] = CreateVehicle(car, DtcSonstiges[autohaus][1][0],DtcSonstiges[autohaus][1][1],DtcSonstiges[autohaus][1][2],DtcSonstiges[autohaus][1][3],c1,c2,-1);
        	SetVehicleVirtualWorld(dtc_AutohausSCar[playerid],55+playerid);
			PlayerTextDrawShow(playerid,CarKauf[playerid]);
        	format(string,sizeof(string),"~r~---------- AUTOHAUS ----------~n~~g~Fahrzeug: ~w~%s~n~~g~Preis: ~w~$%d~n~~b~Auswaehlen:~n~~w~ <LMB<~b~&~w~>RMB> ~n~~b~Kaufen:~w~ Enter ~n~~b~Abbrechen:~w~ Tab",CarName[car-400],preis);
			PlayerTextDrawSetString(playerid,CarKauf[playerid],string);
			dtc_AutohausCar[playerid] = caridd;
The string size is 300

i think this is because of the carname but idk how to solve it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)